You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
applied falcobuster's long render distance fix
This commit is contained in:
@@ -564,23 +564,17 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
|
||||
* and no crashes occur.
|
||||
*/
|
||||
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
|
||||
#ifdef AVOID_UB
|
||||
// Avoid type-casting which is technically UB by calling the equivalent
|
||||
// guMtxF2L function. This helps little-endian systems, as well.
|
||||
guMtxF2L(src, dest);
|
||||
#else
|
||||
s32 asFixedPoint;
|
||||
register s32 i;
|
||||
register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes
|
||||
register s16 *t0 = (s16 *) dest + 16; // all fraction parts stored in last 16 bytes
|
||||
register f32 *t1 = (f32 *) src;
|
||||
Mat4 temp;
|
||||
register s32 i, j;
|
||||
|
||||
for( i = 0; i < 4; i++ ) {
|
||||
for( j = 0; j < 3; j++ ) {
|
||||
temp[i][j] = src[i][j] / WORLD_SCALE;
|
||||
}
|
||||
temp[i][3] = src[i][3];
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes
|
||||
*a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
|
||||
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
|
||||
}
|
||||
#endif
|
||||
guMtxF2L( temp, dest );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,14 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
/* Scales the world down by this factor, increasing how far you can render on
|
||||
* console in exchange for a slight loss in precision.
|
||||
*
|
||||
* For double extended boundary hacks, a value of 1.5f or 2.0f is good.
|
||||
* For quadruple extended bounds, use 3.f or 4.f
|
||||
*/
|
||||
#define WORLD_SCALE 2.f
|
||||
|
||||
/*
|
||||
* The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
|
||||
* 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
|
||||
|
||||
Reference in New Issue
Block a user