mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-09 17:42:55 +00:00
Fix HOOK_ON_HUD_RENDER rate at 30hz (#1022)
This commit is contained in:
parent
c3e5843c53
commit
7bc28a25d8
1 changed files with 19 additions and 1 deletions
|
|
@ -18,6 +18,8 @@
|
||||||
#include "pc/utils/misc.h"
|
#include "pc/utils/misc.h"
|
||||||
|
|
||||||
static Gfx* sSavedDisplayListHead = NULL;
|
static Gfx* sSavedDisplayListHead = NULL;
|
||||||
|
static Gfx* sHookHudRenderGfx = NULL;
|
||||||
|
static size_t sHookHudRenderGfxSize = 0;
|
||||||
|
|
||||||
struct DjuiRoot* gDjuiRoot = NULL;
|
struct DjuiRoot* gDjuiRoot = NULL;
|
||||||
struct DjuiText* gDjuiPauseOptions = NULL;
|
struct DjuiText* gDjuiPauseOptions = NULL;
|
||||||
|
|
@ -187,7 +189,23 @@ void djui_render(void) {
|
||||||
djui_base_render(&sDjuiRootBehind->base);
|
djui_base_render(&sDjuiRootBehind->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
smlua_call_event_hooks(HOOK_ON_HUD_RENDER, djui_reset_hud_params);
|
// To maintain consistency with other hooks, HOOK_ON_HUD_RENDER must run at 30 fps
|
||||||
|
// During interpolated frames, copy the generated display list without running the hook again
|
||||||
|
if (!sDjuiRendered60fps) {
|
||||||
|
Gfx *hookHudRenderStart = gDisplayListHead;
|
||||||
|
smlua_call_event_hooks(HOOK_ON_HUD_RENDER, djui_reset_hud_params);
|
||||||
|
size_t gfxSize = sizeof(Gfx) * (gDisplayListHead - hookHudRenderStart);
|
||||||
|
if (gfxSize > 0) {
|
||||||
|
if (gfxSize > sHookHudRenderGfxSize) {
|
||||||
|
sHookHudRenderGfx = realloc(sHookHudRenderGfx, gfxSize);
|
||||||
|
}
|
||||||
|
memcpy(sHookHudRenderGfx, hookHudRenderStart, gfxSize);
|
||||||
|
}
|
||||||
|
sHookHudRenderGfxSize = gfxSize;
|
||||||
|
} else if (sHookHudRenderGfx != NULL && sHookHudRenderGfxSize > 0) {
|
||||||
|
memcpy(gDisplayListHead, sHookHudRenderGfx, sHookHudRenderGfxSize);
|
||||||
|
gDisplayListHead += sHookHudRenderGfxSize / sizeof(Gfx);
|
||||||
|
}
|
||||||
|
|
||||||
djui_panel_update();
|
djui_panel_update();
|
||||||
djui_popup_update();
|
djui_popup_update();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue