CHudPause_patches: allocate options strings on stack

This commit is contained in:
Hyper 2024-11-24 22:05:38 +00:00
parent 3c48c17deb
commit db18572a70

View file

@ -5,18 +5,10 @@
void CHudPauseAddOptionsItemMidAsmHook(PPCRegister& pThis) void CHudPauseAddOptionsItemMidAsmHook(PPCRegister& pThis)
{ {
auto pStrMemory = __HH_ALLOC(8); guest_stack_var<Hedgehog::Base::CSharedString> menu("TopMenu");
guest_stack_var<Hedgehog::Base::CSharedString> name("option");
auto menu = Hedgehog::Base::CSharedString("TopMenu"); GuestToHostFunction<int>(0x824AE690, pThis.u32, menu.get(), name.get());
auto name = Hedgehog::Base::CSharedString("option");
// TODO: replace with wrapper to put these into guest memory.
memcpy(pStrMemory, &menu, 4);
memcpy((void*)((size_t)pStrMemory + 4), &name, 4);
GuestToHostFunction<int>(0x824AE690, pThis.u32, pStrMemory, (void*)((size_t)pStrMemory + 4));
__HH_FREE(pStrMemory);
} }
bool InjectOptionsBehaviour(uint32_t pThis, uint32_t count) bool InjectOptionsBehaviour(uint32_t pThis, uint32_t count)