diff --git a/patches/sky_transform_tagging.c b/patches/sky_transform_tagging.c index 90b001f..41264b0 100644 --- a/patches/sky_transform_tagging.c +++ b/patches/sky_transform_tagging.c @@ -4,11 +4,6 @@ extern Mtx* sSkyboxDrawMatrix; void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) { - // @recomp skip drawing skyboxes with null textures as they hurt performance due to the accidental framebuffer effects they incur. - if (skyboxCtx->staticSegments[0] == NULL || skyboxCtx->staticSegments[1] == NULL) { - return; - } - OPEN_DISPS(gfxCtx); Gfx_SetupDL40_Opa(gfxCtx); @@ -18,6 +13,12 @@ void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId sSkyboxDrawMatrix = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); + // @recomp skip drawing skyboxes with null textures as they hurt performance due to the accidental framebuffer effects they incur. + // This needs to happen after sSkyboxDrawMatrix is allocated, otherwise the game will write to an invalid pointer later on which will cause a crash. + if (skyboxCtx->staticSegments[0] == NULL || skyboxCtx->staticSegments[1] == NULL) { + return; + } + Matrix_Translate(x, y, z, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateXFApply(skyboxCtx->rot.x); diff --git a/src/main/main.cpp b/src/main/main.cpp index f35e0de..0a48b4c 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -39,7 +39,7 @@ void exit_error(const char* str, Ts ...args) { } ultramodern::gfx_callbacks_t::gfx_data_t create_gfx() { - SDL_SetHint(SDL_HINT_WINDOWS_DPI_AWARENESS, "system"); + SDL_SetHint(SDL_HINT_WINDOWS_DPI_AWARENESS, "permonitorv2"); SDL_SetHint(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0"); if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) > 0) { exit_error("Failed to initialize SDL2: %s\n", SDL_GetError());