From 812c37bf4a4e3866722e2f8f9e1c476425bfd894 Mon Sep 17 00:00:00 2001 From: "e.bovendeur" Date: Mon, 12 Oct 2009 05:28:11 +0000 Subject: [PATCH] Fix for games which need a disc in the drive to play (like MP3 and De Blob). --- source/usbloader/apploader.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index d9626f47..7381a6b3 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -230,8 +230,31 @@ void Anti_002_fix(void *Address, int Size) { } } +void PretendThereIsADiscInTheDrive(void *buffer, u32 len) + +{ + const u8 oldcode[] = { 0x54, 0x60, 0xF7, 0xFF, 0x40, 0x82, 0x00, 0x0C, 0x54, 0x60, 0x07, 0xFF, 0x41, 0x82, 0x00, 0x0C }; + const u8 newcode[] = { 0x54, 0x60, 0xF7, 0xFF, 0x40, 0x82, 0x00, 0x0C, 0x54, 0x60, 0x07, 0xFF, 0x48, 0x00, 0x00, 0x0C }; + + int n; + + /* Patch cover register */ + + for(n=0;n<(len-sizeof(oldcode));n+=4) + { + if (memcmp(buffer+n, (void *) oldcode, sizeof(oldcode)) == 0) + { + memcpy(buffer+n, (void *) newcode, sizeof(newcode)); + } + } + +} + void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch) { - GXRModeObj** table = NULL; + + PretendThereIsADiscInTheDrive(dst, len); + + GXRModeObj** table = NULL; if (videoSelected == 5) // patch {