From 34b2ee29ca51c0a02790c5070cc4b68352e44c02 Mon Sep 17 00:00:00 2001 From: Extrems Date: Sat, 15 Dec 2018 12:00:02 -0500 Subject: [PATCH] - Fix The Italian Job. - Fix Batman: Vengeance again. --- cube/swiss/source/patcher.c | 41 +++++++++++++++++++ .../source/patches/vi/VIConfigure1080i50.s | 4 +- .../source/patches/vi/VIConfigure1080i60.s | 4 +- .../swiss/source/patches/vi/VIConfigure240p.s | 4 +- .../swiss/source/patches/vi/VIConfigure288p.s | 4 +- .../swiss/source/patches/vi/VIConfigure480i.s | 4 +- .../swiss/source/patches/vi/VIConfigure480p.s | 4 +- .../swiss/source/patches/vi/VIConfigure576i.s | 4 +- .../swiss/source/patches/vi/VIConfigure576p.s | 4 +- .../source/patches/vi/VIConfigureHook2.s | 21 ++++------ 10 files changed, 64 insertions(+), 30 deletions(-) diff --git a/cube/swiss/source/patcher.c b/cube/swiss/source/patcher.c index b728c7ec..dc7842f9 100644 --- a/cube/swiss/source/patcher.c +++ b/cube/swiss/source/patcher.c @@ -1506,14 +1506,23 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) data[i + 53] = data[i + 5]; data[i + 5] = branchAndLink(VIConfigureHook1, VIConfigure + 5); data[i + 6] = 0x7C771B78; // mr r23, r3 + data[i + 18] = 0xA01E0016; // lhz r0, 22 (r30) + data[i + 21] = 0xA01E0002; // lhz r0, 2 (r30) + data[i + 35] = 0xA01E0016; // lhz r0, 22 (r30) + data[i + 38] = 0xA01E0002; // lhz r0, 2 (r30) + data[i + 55] = 0xA01E0000; // lhz r0, 0 (r30) + data[i + 63] = 0xA01E0000; // lhz r0, 0 (r30) data[i + 64] = 0x541807BE; // clrlwi r24, r0, 30 + data[i + 73] = 0xA01E0000; // lhz r0, 0 (r30) data[i + 97] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 107] = 0xA01E0014; // lhz r0, 20 (r30) data[i + 120] = 0xA01E0010; // lhz r0, 16 (r30) data[i + 122] = 0x801F0114; // lwz r0, 276 (r31) data[i + 123] = 0x28000001; // cmplwi r0, 1 data[i + 125] = 0xA01E0010; // lhz r0, 16 (r30) data[i + 126] = 0x5400003C; // clrrwi r0, r0, 1 data[i + 128] = 0xA01E0010; // lhz r0, 16 (r30) + data[i + 130] = 0xA07E0000; // lhz r3, 0 (r30) data[i + 218] = 0x801F0114; // lwz r0, 276 (r31) data[i + 219] = 0x28000002; // cmplwi r0, 2 data[i + 274] = branchAndLink(VIConfigureHook2, VIConfigure + 274); @@ -1525,7 +1534,16 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) data[i + 7] = data[i + 5]; data[i + 5] = branchAndLink(VIConfigureHook1, VIConfigure + 5); data[i + 6] = 0x7C781B78; // mr r24, r3 + data[i + 18] = 0xA01E0016; // lhz r0, 22 (r30) + data[i + 21] = 0xA01E0002; // lhz r0, 2 (r30) + data[i + 24] = 0xA01E0002; // lhz r0, 2 (r30) + data[i + 38] = 0xA01E0016; // lhz r0, 22 (r30) + data[i + 41] = 0xA01E0002; // lhz r0, 2 (r30) + data[i + 44] = 0xA01E0002; // lhz r0, 2 (r30) + data[i + 61] = 0xA01E0000; // lhz r0, 0 (r30) + data[i + 69] = 0xA01E0000; // lhz r0, 0 (r30) data[i + 90] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 100] = 0xA01E0014; // lhz r0, 20 (r30) data[i + 113] = 0xA01E0010; // lhz r0, 16 (r30) data[i + 118] = 0xA01E0010; // lhz r0, 16 (r30) data[i + 120] = 0x801F0114; // lwz r0, 276 (r31) @@ -1541,14 +1559,17 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) break; case 2: data[i + 7] = branchAndLink(VIConfigureHook1, VIConfigure + 7); + data[i + 8] = 0xA09F0000; // lhz r4, 0 (r31) data[i + 19] = 0x548307BE; // clrlwi r3, r4, 30 data[i + 35] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 55] = 0xA07F0014; // lhz r3, 20 (r31) data[i + 65] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 67] = 0x801B0000; // lwz r0, 0 (r27) data[i + 68] = 0x28000001; // cmplwi r0, 1 data[i + 70] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 71] = 0x5400003C; // clrrwi r0, r0, 1 data[i + 73] = 0xA01F0010; // lhz r0, 16 (r31) + data[i + 76] = 0xA07F0000; // lhz r3, 0 (r31) data[i + 102] = 0x38A00000 | (swissSettings.forceVOffset & 0xFFFF); data[i + 104] = 0x7CA42B78; // mr r4, r5 data[i + 222] = 0x801B0000; // lwz r0, 0 (r27) @@ -1557,13 +1578,16 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) break; case 3: data[i + 7] = branchAndLink(VIConfigureHook1, VIConfigure + 7); + data[i + 8] = 0xA09F0000; // lhz r4, 0 (r31) data[i + 27] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 46] = 0xA07F0014; // lhz r3, 20 (r31) data[i + 57] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 59] = 0x801C0000; // lwz r0, 0 (r28) data[i + 60] = 0x28000001; // cmplwi r0, 1 data[i + 62] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 63] = 0x5400003C; // clrrwi r0, r0, 1 data[i + 65] = 0xA01F0010; // lhz r0, 16 (r31) + data[i + 68] = 0xA07F0000; // lhz r3, 0 (r31) data[i + 94] = 0x38A00000 | (swissSettings.forceVOffset & 0xFFFF); data[i + 96] = 0x7CA42B78; // mr r4, r5 data[i + 214] = 0x801C0000; // lwz r0, 0 (r28) @@ -1572,22 +1596,30 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) break; case 4: data[i + 9] = branchAndLink(VIConfigureHook1, VIConfigure + 9); + data[i + 10] = 0xA01F0000; // lhz r0, 0 (r31) + data[i + 45] = 0xA07F0000; // lhz r3, 0 (r31) data[i + 62] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 81] = 0xA07F0014; // lhz r3, 20 (r31) data[i + 92] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 94] = 0x801C0000; // lwz r0, 0 (r28) data[i + 95] = 0x28000001; // cmplwi r0, 1 data[i + 97] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 98] = 0x5400003C; // clrrwi r0, r0, 1 data[i + 100] = 0xA01F0010; // lhz r0, 16 (r31) + data[i + 103] = 0xA07F0000; // lhz r3, 0 (r31) data[i + 129] = 0x38A00000 | (swissSettings.forceVOffset & 0xFFFF); data[i + 131] = 0x7CA42B78; // mr r4, r5 + data[i + 237] = 0xA0DF0000; // lhz r6, 0 (r31) data[i + 258] = 0x801C0000; // lwz r0, 0 (r28) data[i + 260] = 0x28000002; // cmplwi r0, 2 data[i + 458] = branchAndLink(VIConfigureHook2, VIConfigure + 458); break; case 5: data[i + 9] = branchAndLink(VIConfigureHook1, VIConfigure + 9); + data[i + 10] = 0xA09F0000; // lhz r4, 0 (r31) + data[i + 20] = 0xA01F0000; // lhz r0, 0 (r31) data[i + 65] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 84] = 0xA07F0014; // lhz r3, 20 (r31) data[i + 95] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 99] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 101] = 0x801C0000; // lwz r0, 0 (r28) @@ -1604,7 +1636,10 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) break; case 6: data[i + 9] = branchAndLink(VIConfigureHook1, VIConfigure + 9); + data[i + 10] = 0xA09F0000; // lhz r4, 0 (r31) + data[i + 20] = 0xA01F0000; // lhz r0, 0 (r31) data[i + 97] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 116] = 0xA07F0014; // lhz r3, 20 (r31) data[i + 127] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 131] = 0xA01F0010; // lhz r0, 16 (r31) data[i + 133] = 0x801C0000; // lwz r0, 0 (r28) @@ -1622,7 +1657,10 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) break; case 7: data[i + 8] = branchAndLink(VIConfigureHook1, VIConfigure + 8); + data[i + 10] = 0xA0BB0000; // lhz r5, 0 (r27) + data[i + 20] = 0xA01B0000; // lhz r0, 0 (r27) data[i + 101] = 0x5408003C; // clrrwi r8, r0, 1 + data[i + 112] = 0xA07B0014; // lhz r3, 20 (r27) data[i + 123] = 0xA0FB0010; // lhz r7, 16 (r27) data[i + 127] = 0xA0FB0010; // lhz r7, 16 (r27) data[i + 129] = 0x28090001; // cmplwi r9, 1 @@ -1638,7 +1676,10 @@ void Patch_VideoMode(u32 *data, u32 length, int dataType) break; case 8: data[i + 9] = branchAndLink(VIConfigureHook1, VIConfigure + 9); + data[i + 10] = 0xA0930000; // lhz r4, 0 (r19) + data[i + 20] = 0xA0130000; // lhz r0, 0 (r19) data[i + 97] = 0x5400003C; // clrrwi r0, r0, 1 + data[i + 116] = 0xA0730014; // lhz r3, 20 (r19) data[i + 127] = 0xA0130010; // lhz r0, 16 (r19) data[i + 131] = 0xA0130010; // lhz r0, 16 (r19) data[i + 133] = 0x801D0000; // lwz r0, 0 (r29) diff --git a/cube/swiss/source/patches/vi/VIConfigure1080i50.s b/cube/swiss/source/patches/vi/VIConfigure1080i50.s index 3661d4f3..b0c13ceb 100644 --- a/cube/swiss/source/patches/vi/VIConfigure1080i50.s +++ b/cube/swiss/source/patches/vi/VIConfigure1080i50.s @@ -35,9 +35,9 @@ VIConfigure1080i50: neg %r4, %r4 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) + sth %r6, 20 (%r3) stb %r7, 24 (%r3) - stw %r0, 0 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure1080i50_length VIConfigure1080i50_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure1080i60.s b/cube/swiss/source/patches/vi/VIConfigure1080i60.s index 993ce793..5d83e40f 100644 --- a/cube/swiss/source/patches/vi/VIConfigure1080i60.s +++ b/cube/swiss/source/patches/vi/VIConfigure1080i60.s @@ -35,9 +35,9 @@ VIConfigure1080i60: neg %r4, %r4 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) + sth %r6, 20 (%r3) stb %r7, 24 (%r3) - stw %r0, 0 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure1080i60_length VIConfigure1080i60_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure240p.s b/cube/swiss/source/patches/vi/VIConfigure240p.s index 4d9f811f..ed8562d6 100644 --- a/cube/swiss/source/patches/vi/VIConfigure240p.s +++ b/cube/swiss/source/patches/vi/VIConfigure240p.s @@ -37,9 +37,9 @@ VIConfigure240p: srawi %r4, %r4, 1 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) + sth %r6, 20 (%r3) stb %r7, 24 (%r3) - stw %r0, 0 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure240p_length VIConfigure240p_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure288p.s b/cube/swiss/source/patches/vi/VIConfigure288p.s index de4d86d0..3afd1347 100644 --- a/cube/swiss/source/patches/vi/VIConfigure288p.s +++ b/cube/swiss/source/patches/vi/VIConfigure288p.s @@ -36,9 +36,9 @@ VIConfigure288p: neg %r4, %r4 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) + sth %r6, 20 (%r3) stb %r7, 24 (%r3) - stw %r0, 0 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure288p_length VIConfigure288p_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure480i.s b/cube/swiss/source/patches/vi/VIConfigure480i.s index 984a4e2c..83402404 100644 --- a/cube/swiss/source/patches/vi/VIConfigure480i.s +++ b/cube/swiss/source/patches/vi/VIConfigure480i.s @@ -36,8 +36,8 @@ VIConfigure480i: srawi %r4, %r4, 1 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) - stw %r0, 0 (%r3) + sth %r6, 20 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure480i_length VIConfigure480i_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure480p.s b/cube/swiss/source/patches/vi/VIConfigure480p.s index d69a3e29..8f712098 100644 --- a/cube/swiss/source/patches/vi/VIConfigure480p.s +++ b/cube/swiss/source/patches/vi/VIConfigure480p.s @@ -36,8 +36,8 @@ VIConfigure480p: srawi %r4, %r4, 1 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) - stw %r0, 0 (%r3) + sth %r6, 20 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure480p_length VIConfigure480p_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure576i.s b/cube/swiss/source/patches/vi/VIConfigure576i.s index abf4eb88..c1104e65 100644 --- a/cube/swiss/source/patches/vi/VIConfigure576i.s +++ b/cube/swiss/source/patches/vi/VIConfigure576i.s @@ -35,8 +35,8 @@ VIConfigure576i: neg %r4, %r4 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) - stw %r0, 0 (%r3) + sth %r6, 20 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure576i_length VIConfigure576i_length: diff --git a/cube/swiss/source/patches/vi/VIConfigure576p.s b/cube/swiss/source/patches/vi/VIConfigure576p.s index 90855acc..8ed38fe5 100644 --- a/cube/swiss/source/patches/vi/VIConfigure576p.s +++ b/cube/swiss/source/patches/vi/VIConfigure576p.s @@ -34,8 +34,8 @@ VIConfigure576p: neg %r4, %r4 sth %r4, 12 (%r3) sth %r5, 16 (%r3) - stw %r6, 20 (%r3) - stw %r0, 0 (%r3) + sth %r6, 20 (%r3) + sth %r0, 0 (%r3) .globl VIConfigure576p_length VIConfigure576p_length: diff --git a/cube/swiss/source/patches/vi/VIConfigureHook2.s b/cube/swiss/source/patches/vi/VIConfigureHook2.s index 44b20670..96973ff2 100644 --- a/cube/swiss/source/patches/vi/VIConfigureHook2.s +++ b/cube/swiss/source/patches/vi/VIConfigureHook2.s @@ -9,20 +9,13 @@ VIConfigureHook2: mtmsr %r4 lis %r3, VAR_AREA lwz %r3, VAR_RMODE (%r3) - lwz %r4, 0 (%r3) - lwz %r6, 20 (%r3) - clrlwi %r5, %r4, 30 - clrrwi. %r4, %r4, 2 - beq 1f - cmpwi %r5, 2 - beq 2f -1: cmpwi %r5, 1 - bnelr - cmpwi %r6, 1 - bnelr -2: li %r6, 1 - stw %r6, 20 (%r3) - stw %r4, 0 (%r3) + lwz %r0, 0 (%r3) + lwz %r4, 20 (%r3) + inslwi %r0, %r0, 14, 16 + clrlwi %r4, %r4, 16 + clrlwi %r0, %r0, 16 + stw %r4, 20 (%r3) + stw %r0, 0 (%r3) blr .globl VIConfigureHook2_length