diff --git a/patches/graphics_patches.c b/patches/graphics_patches.c index 7d8b86d..6589665 100644 --- a/patches/graphics_patches.c +++ b/patches/graphics_patches.c @@ -93,6 +93,9 @@ RECOMP_PATCH void game_draw(s32 arg0){ gEXEnable(gfx++); gEXSetRefreshRate(gfx++, 60 / viMgr_func_8024BFA0()); // Input framerate is equal to 60 Hz divided by the frame divisor + // @recomp Turn off nearclipping (i.e. turn on depth clamp) to prevent the camera from clipping through lots of geometry in ultrawide aspect ratios. + gEXSetNearClipping(gfx++, FALSE); + func_802E39D0(&gfx, &mtx, &vtx, getActiveFramebuffer(), arg0); // @recomp Check for graphics stack overflow diff --git a/patches/lod_patches.c b/patches/lod_patches.c new file mode 100644 index 0000000..c15da2d --- /dev/null +++ b/patches/lod_patches.c @@ -0,0 +1,30 @@ +#include "patches.h" +#include "core1/mlmtx.h" + +typedef struct { + s32 cmd_0; + s32 size_4; + f32 max_8; + f32 min_C; + f32 unk10[3]; + s32 subgeo_offset_1C; +}GeoCmd8; + +extern f32 D_80383C98[3]; +extern void func_80339124(Gfx **gfx, Mtx **mtx, BKGeoList *geo_list); +extern float gu_sqrtf(float val); + +// @recomp Patched to force all LODs to act as if they were a fixed distance from the camera. +RECOMP_PATCH void func_80338B50(Gfx **gfx, Mtx **mtx, void *arg2) { + GeoCmd8 *cmd = (GeoCmd8 *)arg2; + f32 dist; + + if (cmd->subgeo_offset_1C) { + mlMtx_apply_vec3f(D_80383C98, cmd->unk10); + // @recomp Force distance for LOD to be 50. + dist = 50.0f; //gu_sqrtf(D_80383C98[0] * D_80383C98[0] + D_80383C98[1] * D_80383C98[1] + D_80383C98[2] * D_80383C98[2]); + if (cmd->min_C < dist && dist <= cmd->max_8) { + func_80339124(gfx, mtx, (BKGeoList *)((s32)cmd + cmd->subgeo_offset_1C)); + } + } +}