diff --git a/popnhax/custom_categs.cc b/popnhax/custom_categs.cc index 7108446..3418e67 100644 --- a/popnhax/custom_categs.cc +++ b/popnhax/custom_categs.cc @@ -55,8 +55,8 @@ void get_subcateg_name_impl() uint32_t reimpl_value_1; uint32_t reimpl_value_2; -void (*get_subcateg_size)() = &get_subcateg_size_impl; -void (*get_subcateg_name)() = &get_subcateg_name_impl; +void (*get_subcateg_size)();// = &get_subcateg_size_impl; +void (*get_subcateg_name)();// = &get_subcateg_name_impl; void (*reimpl_func_1)(); void (*reimpl_func_2)(); void (*reimpl_func_3)(); @@ -75,12 +75,17 @@ void categ_inject_songlist_reimpl() __asm("push ebp\n"); __asm("push esi\n"); __asm("push edi\n"); - __asm("mov eax, dword ptr ds:[_reimpl_value_2]\n"); + + __asm("push ebx\n"); + __asm("mov ebx, dword ptr ds:[_reimpl_value_2]\n"); + __asm("mov eax, dword ptr ds:[ebx]\n"); + __asm("pop ebx\n"); + __asm("xor eax,esp\n"); __asm("push eax\n"); - __asm("lea eax, dword ptr ss:[esp+0x24]\n"); + __asm("lea eax, dword ptr [esp+0x24]\n"); __asm("mov dword ptr fs:[0], eax\n"); - __asm("lea ebp, dword ptr ss:[esp+0x34]\n"); + __asm("lea ebp, dword ptr [esp+0x34]\n"); __asm("xor ebx, ebx\n"); __asm("mov dword ptr ss:[esp+0x34], ebx\n"); __asm("subcateg_loop:\n"); @@ -117,7 +122,7 @@ void categ_inject_songlist_reimpl() __asm("jump_point_1:\n"); __asm("mov dword ptr ss:[esp+0x2C], 0xFFFFFFFF\n"); __asm("mov ecx, dword ptr ss:[ebp+0xB4]\n"); - __asm("lea esi, dword ptr ss:[ebp+0xA8]\n"); + __asm("lea esi, dword ptr [ebp+0xA8]\n"); __asm("mov dword ptr ss:[esp+0x14], eax\n"); __asm("test ecx, ecx\n"); __asm("jne jump_point_2\n"); @@ -148,9 +153,9 @@ void categ_inject_songlist_reimpl() __asm("mov eax, dword ptr ds:[esi]\n"); __asm("push edi\n"); __asm("push eax\n"); - __asm("lea eax, dword ptr ss:[esp+0x1C]\n"); + __asm("lea eax, dword ptr [esp+0x1C]\n"); __asm("push eax\n"); - __asm("lea ecx, dword ptr ss:[esp+0x24]\n"); + __asm("lea ecx, dword ptr [esp+0x24]\n"); __asm("push ecx\n"); __asm("mov eax, esi\n"); @@ -284,8 +289,8 @@ static bool patch_custom_categ_simple(const char *game_dll_fn) { reimpl_func_3 = (void (*)())( *((uint32_t*)(function_addr +0xBC)) + (uint32_t)(function_addr +0x04 +0xBC) ); reimpl_func_4 = (void (*)())( *((uint32_t*)(function_addr +0xD1)) + (uint32_t)(function_addr +0x04 +0xD1) ); - get_subcateg_size = (void (*)())( *((uint32_t*)(function_addr +0x36)) + (uint32_t)(function_addr +0x04 +0x36) ); - get_subcateg_name = (void (*)())( *((uint32_t*)(function_addr +0x62)) + (uint32_t)(function_addr +0x04 +0x62) ); + get_subcateg_size = (void (*)())( *((uint32_t*)(function_addr +0x37)) + (uint32_t)(function_addr +0x04 +0x37) ); + get_subcateg_name = (void (*)())( *((uint32_t*)(function_addr +0x63)) + (uint32_t)(function_addr +0x04 +0x63) ); MH_CreateHook((LPVOID)patch_addr, (LPVOID)hook_categ_listing, (void **)&real_categ_listing);