22#include < pcsx2/vtlb.h>
33#include " GS/Renderers/Common/GSDevice.h"
44
5- // Reactive Aspect Ratio Patch
6- // This one won't be visible in UI
5+ // Reactive Aspect Ratio Patch
6+ // This one won't be visible in UI
77void PTR2AspectRatioSet (AspectRatioType ar)
88{
99 char buf[4 ] = {};
1010 switch (ar)
1111 {
12- // adapted from Parotaku's widescreen patch
12+ // adapted from Parotaku's widescreen patch
1313 case AspectRatioType::R4_3 :
1414 // patch=1,EE,0016066c,word,3c013f40
1515 vtlb_memSafeWriteBytes (0x0016066c , &buf, 4 );
@@ -43,9 +43,9 @@ void PTR2AspectRatioSet(AspectRatioType ar)
4343 char buf[4 ] = {0x40 , 0x3F , 0x01 , 0x3C };
4444 vtlb_memSafeWriteBytes (0x0016066c , &buf, 4 );
4545
46- // replace the "3f40" (0.75 for 16:9) with our new multiplier
47- float heightReal = height * 1.071 ; // to get 448 to 480
48- heightReal = heightReal * 1.25 ; // this number has no meaning its eyeballed
46+ // replace the "3f40" (0.75 for 16:9) with our new multiplier
47+ float heightReal = height * 1.071 ; // to get 448 to 480
48+ heightReal = heightReal * 1.25 ; // this number has no meaning its eyeballed
4949 float multiplier = heightReal / float (width);
5050 char buf2[4 ] = {};
5151 memcpy (buf2, &multiplier, 4 );
@@ -68,9 +68,15 @@ void PTR2AspectRatioSet()
6868 PTR2AspectRatioSet (ar);
6969}
7070
71- // Patches unused func PackIntDecode to just infinitely call MTCWait(1)
72- // this is so we can do stuff asynchronously by jumping to PackIntDecode
73- // i.e loading INT assets ourselves without the loading screen stuttering/pausing
71+ // Patches unused func PackIntDecode to just infinitely call MTCWait(1)
72+ // this is so we can do stuff asynchronously* by jumping to PackIntDecode
73+ // i.e loading INT assets ourselves without the loading screen stuttering/pausing
74+
75+ // *I don't think this is technically async, as we are copying the original game logic and just
76+ // sleeping** after XX milliseconds, to call MTCWait() and give the game time to render out the
77+ // loading screen, either way the end goal of stopping stuttering is achieved
78+
79+ // **In our case we don't sleep, we end the hook, which lets the game start running PackIntDecode again
7480
7581void createAsyncFunc ()
7682{
@@ -82,7 +88,7 @@ void createAsyncFunc()
8288 0x01 , 0x00 , 0x04 , 0x24 , // addiu a0,zero,0x1 (li a0, 0x1 |
8389 0x00 , 0x00 , 0x00 , 0x00 , // nop |
8490 0x00 , 0x00 , 0xA4 , 0x8F , // lw a0, (sp) |
85- 0xFA , 0xFF , 0x80 , 0x10 , // beqz, a0, 0x00104E98 -------------
91+ 0x00 , 0x00 , 0x00 , 0x00 , // nop ------------- (Gets patched to a beqz, a0, 0x00104E98 by INT_Loader hook in PTR2Hooks.cpp)
8692 0x00 , 0x00 , 0x00 , 0x00 , // nop
8793 0x10 , 0x00 , 0xA4 , 0xDF , // ld a0, 0x10(sp)
8894 0x0C , 0x03 , 0x00 , 0x10 , // beq zero zero 0x00105aec
@@ -91,7 +97,7 @@ void createAsyncFunc()
9197
9298 vtlb_memSafeWriteBytes (0x00104e90 , &buf, 48 );
9399
94- // patch jal PackIntDecodeWait to jal PackIntDecode
100+ // patch jal PackIntDecodeWait to jal PackIntDecode
95101 char buf2[4 ] = { 0xA4 , 0x13 , 0x04 , 0x0C };
96102 vtlb_memSafeWriteBytes (0x00105ad8 , &buf2, 4 );
97103}
0 commit comments