From 8b3c29ae7de062156d62316a9c89ce1fb0676984 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 14 Oct 2022 00:26:13 +0100 Subject: [PATCH 1/2] hack Vram_alloc_4956C0 to never fail to not de-sync abi_break --- Source/AliveLibAE/VRam.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/AliveLibAE/VRam.cpp b/Source/AliveLibAE/VRam.cpp index 9c0bde781..128f254f6 100644 --- a/Source/AliveLibAE/VRam.cpp +++ b/Source/AliveLibAE/VRam.cpp @@ -166,7 +166,12 @@ EXPORT s16 CC Vram_alloc_4956C0(u16 width, s16 height, u16 colourDepth, PSX_RECT if (sVramNumberOfAllocations_5CC888 >= kMaxAllocs || !Vram_alloc_block_4957B0(&rect, depth)) { - return 0; + LOG_WARNING("Fat vram alloc hax"); + pRect->w = 1; + pRect->h = 1; + pRect->x = 1024 - 1; + pRect->y = 512 - 1; + return 1; } sVramAllocations_5CB888[sVramNumberOfAllocations_5CC888++] = rect; From e8793f7f636b8be0a3e755ec73d444431c42e570 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 14 Oct 2022 01:32:35 +0100 Subject: [PATCH 2/2] only do the hack when recording or playing back to avoid any visual glitches --- Source/AliveLibAE/VRam.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/AliveLibAE/VRam.cpp b/Source/AliveLibAE/VRam.cpp index 128f254f6..4b3beba94 100644 --- a/Source/AliveLibAE/VRam.cpp +++ b/Source/AliveLibAE/VRam.cpp @@ -4,6 +4,7 @@ #include "PsxDisplay.hpp" #include #include "Renderer/IRenderer.hpp" +#include "BaseGameAutoPlayer.hpp" const s32 kMaxAllocs = 512; @@ -166,12 +167,16 @@ EXPORT s16 CC Vram_alloc_4956C0(u16 width, s16 height, u16 colourDepth, PSX_RECT if (sVramNumberOfAllocations_5CC888 >= kMaxAllocs || !Vram_alloc_block_4957B0(&rect, depth)) { - LOG_WARNING("Fat vram alloc hax"); - pRect->w = 1; - pRect->h = 1; - pRect->x = 1024 - 1; - pRect->y = 512 - 1; - return 1; + if (GetGameAutoPlayer().IsRecording() || GetGameAutoPlayer().IsPlaying()) + { + LOG_WARNING("Fat vram alloc hax"); + pRect->w = 1; + pRect->h = 1; + pRect->x = 1024 - 1; + pRect->y = 512 - 1; + return 1; + } + return 0; } sVramAllocations_5CB888[sVramNumberOfAllocations_5CC888++] = rect;