Skip to content

Commit

Permalink
-added patch to Swingerz Golf NTSC-U to allow forcing other video modes
Browse files Browse the repository at this point in the history
-extended getTiming patch to fix a few more games when forcing other video modes (such as Crazy Taxi NTSC-U)
-clearing out more cache of controller inputs to allow controllers with bigger messages to work properly
  • Loading branch information
FIX94 committed Jun 18, 2017
1 parent 5f3cda5 commit ed9e909
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common/include/NintendontVersion.h
Expand Up @@ -2,7 +2,7 @@
#define __NINTENDONT_VERSION_H__

#define NIN_MAJOR_VERSION 4
#define NIN_MINOR_VERSION 444
#define NIN_MINOR_VERSION 445

#define NIN_VERSION ((NIN_MAJOR_VERSION << 16) | NIN_MINOR_VERSION)

Expand Down
38 changes: 31 additions & 7 deletions kernel/Patch.c
Expand Up @@ -1859,14 +1859,20 @@ void DoPatches( char *Buffer, u32 Length, u32 DiscOffset )
}
if( (PatchCount & FPATCH_getTiming) == 0 )
{
if( BufAt0 == 0x386500BE && BufAt4 == 0x4E800020 && read32((u32)Buffer+i+8) == 0x386500E4 &&
read32((u32)Buffer+i+12) == 0x4E800020 && read32((u32)Buffer+i+16) == 0x38600000 &&
read32((u32)Buffer+i+20) == 0x4E800020 )
if( BufAt0 == 0x386500BE && BufAt4 == 0x4E800020 &&
read32((u32)Buffer+i+8) == 0x386500E4 && read32((u32)Buffer+i+0xC) == 0x4E800020 )
{
printpatchfound("getTiming", NULL, (u32)Buffer + i + 16);
write32( (u32)Buffer + i + 16, 0x7CA32B78 ); //mr r5, r3
PatchCount |= FPATCH_getTiming;
i += 20;
u32 PatchOffset = 0x10;
while ((read32((u32)Buffer+i+PatchOffset) != 0x38600000) && (PatchOffset < 0x30)) // MaxSearch=0x20
PatchOffset += 4;
if(read32((u32)Buffer+i+PatchOffset) == 0x38600000 &&
read32((u32)Buffer+i+PatchOffset+4) == 0x4E800020)
{
printpatchfound("getTiming", NULL, (u32)Buffer+i+PatchOffset);
write32( (u32)Buffer+i+PatchOffset, 0x7CA32B78 ); //mr r5, r3
PatchCount |= FPATCH_getTiming;
i += PatchOffset+4;
}
continue;
}
}
Expand Down Expand Up @@ -3272,6 +3278,14 @@ void DoPatches( char *Buffer, u32 Length, u32 DiscOffset )
//OSReport
memcpy((void*)0x235A4, OSReportDM, sizeof(OSReportDM));
sync_after_write((void*)0x235A4, sizeof(OSReportDM));
//failed expermiments, someday I'll figure it out...
//write32(0xF4B4,0x38600000);
write32(0x1F6434,0x38600000);
write32(0x1F6454,0x60000000);
write32(0x1F6464,0x60000000);
write32(0x1F646C,0x38800000);
write32(0x2583E8,0x38600000);
write32(0x2583EC,0x4E800020);
dbgprintf("Patch:Patched Street Racing Syndicate NTSC-U\r\n");
}*/
if(useipl == 1)
Expand Down Expand Up @@ -3481,6 +3495,16 @@ void DoPatches( char *Buffer, u32 Length, u32 DiscOffset )
dbgprintf("Patch:Patched Super Smash Bros Melee v1.02\r\n");
}
}
else if( TITLE_ID == 0x475747 ) // Swingerz Golf
{
//while getTiming supports all video modes
//the NTSC-U game code itself does not, so patch it
if(read32(0x1E148) == 0x3C60801F)
{
PatchB(0x1E128, 0x1E148);
dbgprintf("Patch:Patched Swingerz Golf NTSC-U\r\n");
}
}
}
PatchStaticTimers();

Expand Down
Binary file modified loader/loader.dol
Binary file not shown.
3 changes: 3 additions & 0 deletions loader/source/ppc/PADReadGC.c
Expand Up @@ -224,6 +224,9 @@ u32 _start(u32 calledByGame)
{
HID_Packet = (u8*)0x930050F0; // reset back to default offset
memInvalidate = (u32)HID_Packet; // prepare memory
asm volatile("dcbi 0,%0" : : "b"(memInvalidate) : "memory");
//invalidate cache block for controllers using more than 0x10 bytes
memInvalidate = (u32)HID_Packet+0x10; // prepare memory
asm volatile("dcbi 0,%0; sync" : : "b"(memInvalidate) : "memory");
HIDMemPrep = memInvalidate;
}
Expand Down

0 comments on commit ed9e909

Please sign in to comment.