eclale compatibility

This commit is contained in:
CrazyRedMachine 2023-02-11 11:17:52 +01:00
parent 7d5eb13174
commit 495d70e59b

View File

@ -202,7 +202,7 @@ bool patch_hex(const char *find, uint8_t find_size, int64_t shift, const char *r
patch_memory(patch_addr, (char *)replace, replace_size);
#ifdef DEBUG
printf("AFTER PATCH :\n");
printf("\nAFTER PATCH :\n");
offset = (uint8_t *) ((int64_t)data + pattern_offset + shift - 5);
for (int i=0; i<32; i++)
{
@ -396,7 +396,7 @@ static bool patch_hd_on_sd(uint8_t mode) {
if (!patch_hex("\x0f\xb6\xc0\xf7\xd8\x1b\xc0\x25\x20\x01", 10, -5, "\xB8\xE0\x01\x00\x00\xC3\xCC\xCC\xCC", 9))
printf("popnhax: HD on SD: cannot find screen height function\n");
if (!patch_hex("\x84\xC0\x74\x0D\x8B\x4C", 6, 2, "\xEB", 1))
if (!patch_hex("\x8B\x54\x24\x20\x53\x51\x52\xEB\x0C", 9, -6, "\xEB", 1))
printf("popnhax: HD on SD: cannot find screen aspect ratio function\n");
}
@ -406,7 +406,7 @@ static bool patch_hd_on_sd(uint8_t mode) {
if (!patch_hex("\x6a\x01\x6a\x00\x50\x8b\x06\x33\xff", 9, -7, "\x90\x90", 2))
printf("popnhax: HD on SD: cannot patch credit/network position\n");
printf("popnhax: HD on SD mode %d",mode);
printf("popnhax: HD on SD mode %d\n",mode);
return true;
}
@ -418,7 +418,6 @@ static bool patch_pfree() {
/* stop stage counter (2 matches, 1st one suffices) */
{
fuzzy_search_task task;
FUZZY_START(task, 1)
FUZZY_CODE(task, 0, "\x83\xF8\x04\x77\x3E", 5)
@ -447,7 +446,11 @@ static bool patch_pfree() {
int64_t offset = find_block(data, dllSize, &task, 0);
if (offset == -1) {
printf("popnhax: pfree: failed to retrieve struct size and offset\n");
return false;
/* best effort for older games compatibility (works with eclale) */
offset_from_base = 0x54;
offset_from_stage1[0] = 0x04;
offset_from_stage1[1] = 0x05;
goto pfree_apply;
}
uint32_t child_fun_rel = *(uint32_t *) ((int64_t)data + offset - 0x04);
child_fun_loc = offset + child_fun_rel;
@ -490,6 +493,7 @@ static bool patch_pfree() {
//printf("popnhax: pfree: offset_from_base is %02x\n",offset_from_base);
}
pfree_apply:
int64_t first_loc = 0;
/* cleanup score and stats part1 */
{
@ -502,6 +506,7 @@ static bool patch_pfree() {
first_loc = find_block(data, dllSize, &task, 0);
if (first_loc == -1) {
printf("popnhax: pfree: cannot find stage update function\n");
return false;
}
@ -520,7 +525,7 @@ static bool patch_pfree() {
int64_t pattern_offset = find_block(data, 0x40, &task, first_loc);
if (pattern_offset == -1) {
printf("EUARGH\n");
printf("popnhax: pfree: cannot find stage update function\n");
return false;
}