forked from Popn_Tools/popnhax
fix local favorite end of credit crash with guest
This commit is contained in:
parent
03104c4ae9
commit
d17bd63f3a
1
dist/popnhax/popnhax.xml
vendored
1
dist/popnhax/popnhax.xml
vendored
@ -99,7 +99,6 @@
|
||||
<!-- PLEASE USE OFFLINE ONLY -->
|
||||
<practice_mode __type="bool">0</practice_mode>
|
||||
<!-- Press 9 on option select screen to go back to song selection (requires quick_retire) -->
|
||||
<!-- Note: causes issues with sounds on song select -->
|
||||
<back_to_song_select __type="bool">0</back_to_song_select>
|
||||
|
||||
|
||||
|
@ -680,6 +680,31 @@ static bool patch_custom_track_format(const char *game_dll_fn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void (*real_remove_fake_login)();
|
||||
void hook_remove_fake_login()
|
||||
{
|
||||
//getPlayerDataAddr was just called so eax contains _playerdata_addr
|
||||
__asm("push ebx\n");
|
||||
__asm("push ecx\n");
|
||||
__asm("lea ebx, [eax+0x1A5]\n"); //login status offset
|
||||
__asm("lea ecx, [eax+0x08]\n"); //friendid offset
|
||||
__asm("mov ecx, [ecx]\n");
|
||||
__asm("cmp ecx, 0x61666564\n"); //defa
|
||||
__asm("jne skip_remove_login\n");
|
||||
__asm("lea ecx, [eax+0x0C]\n"); //friendid offset
|
||||
__asm("mov ecx, [ecx]\n");
|
||||
__asm("cmp ecx, 0x00746C75\n"); //ult
|
||||
__asm("jne skip_remove_login\n");
|
||||
|
||||
//fake login detected, cleanup
|
||||
__asm("mov dword ptr [ebx], 0x00000000\n");
|
||||
|
||||
__asm("skip_remove_login:\n");
|
||||
__asm("pop ecx\n");
|
||||
__asm("pop ebx\n");
|
||||
real_remove_fake_login();
|
||||
}
|
||||
|
||||
static bool patch_favorite_categ(const char *game_dll_fn) {
|
||||
|
||||
DWORD dllSize = 0;
|
||||
@ -722,6 +747,19 @@ static bool patch_favorite_categ(const char *game_dll_fn) {
|
||||
|
||||
g_playerdata_ptr_addr = (*(uint32_t *)(data + pattern_offset + 0x25));
|
||||
}
|
||||
//and I need to remove the fake "logged in" status on credit end to prevent a crash
|
||||
{
|
||||
int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x74\x07\xBB\x01\x00\x00\x00\xEB\x02\x33\xDB", 13, 0);
|
||||
if (pattern_offset == -1) {
|
||||
LOG("popnhax: local_favorites: cannot find end of credit check if logged function\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t patch_addr = (int64_t)data + pattern_offset - 0x05;
|
||||
|
||||
MH_CreateHook((LPVOID)patch_addr, (LPVOID)hook_remove_fake_login,
|
||||
(void **)&real_remove_fake_login);
|
||||
}
|
||||
|
||||
//hook result screen to replace 3 functions
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user