-updated to version 2.9-

*Changed patch code to prevent false hits (DVDLowReadDiskID)
*Added C_MTXLightPerspective patching (Fixes heat effects when using wide screen hack in Zelda:WW)




git-svn-id: svn://localhost/Users/andi/Downloads/code/DML@38 be6c1b03-d731-4111-a574-e37d80d43941
This commit is contained in:
crediar@rypp.net 2013-04-05 16:41:58 +00:00
parent ff41710172
commit 1074846e1a
2 changed files with 49 additions and 32 deletions

View File

@ -144,6 +144,7 @@ FuncPattern FPatterns[] =
{ 0xCC, 3, 3, 1, 0, 3, (u8*)NULL, 0xdead000C, "C_MTXPerspective", 0, 0 }, { 0xCC, 3, 3, 1, 0, 3, (u8*)NULL, 0xdead000C, "C_MTXPerspective", 0, 0 },
{ 0xC8, 3, 3, 1, 0, 3, (u8*)NULL, 0xdead000D, "C_MTXLightPerspective", 0, 0 },
{ 0x94, 18, 10, 2, 0, 2, (u8*)__dvdLowReadAudioNULL, sizeof(__dvdLowReadAudioNULL), "DVDLowReadAudio", 0, 0 }, { 0x94, 18, 10, 2, 0, 2, (u8*)__dvdLowReadAudioNULL, sizeof(__dvdLowReadAudioNULL), "DVDLowReadAudio", 0, 0 },
{ 0x88, 18, 8, 2, 0, 2, (u8*)__dvdLowAudioStatusNULL, sizeof(__dvdLowAudioStatusNULL), "DVDLowAudioStatus", 0, 0 }, { 0x88, 18, 8, 2, 0, 2, (u8*)__dvdLowAudioStatusNULL, sizeof(__dvdLowAudioStatusNULL), "DVDLowAudioStatus", 0, 0 },
@ -597,10 +598,6 @@ void DoCardPatches( char *ptr, u32 size, u32 SectionOffset )
return; return;
}
void InitPatches( void )
{
} }
void DoPatches( char *ptr, u32 size, u32 SectionOffset ) void DoPatches( char *ptr, u32 size, u32 SectionOffset )
{ {
@ -610,6 +607,7 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset )
FBOffset = 0; FBOffset = 0;
FBEnable = 0; FBEnable = 0;
CardLowestOff = 0;
dbgprintf("DoPatches( 0x%p, %d, 0x%X)\n", ptr, size, SectionOffset ); dbgprintf("DoPatches( 0x%p, %d, 0x%X)\n", ptr, size, SectionOffset );
@ -942,7 +940,7 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset )
if( (PatchCount & 512) == 0 ) //DVDLowReadDiskID if( (PatchCount & 512) == 0 ) //DVDLowReadDiskID
{ {
if( (read32( (u32)ptr + i ) & 0xFFFF ) == 0xA800 && (read32( (u32)ptr + i + 4 ) & 0xFFFF ) == 0x40 ) if( (read32( (u32)ptr + i ) & 0xFCFFFFFF ) == 0x3C00A800 && (read32( (u32)ptr + i + 4 ) & 0xFCFFFFFF ) == 0x38000040 )
{ {
u32 Offset = (u32)ptr + i; u32 Offset = (u32)ptr + i;
@ -1099,21 +1097,40 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset )
write32( 0x12FC, 0 ); write32( 0x12FC, 0 );
} break; } break;
case 0xdead000C: // Widescreen hack by Extrems // Widescreen hack by Extrems
case 0xdead000C: // C_MTXPerspective
{ {
if( !ConfigGetConfig(DML_CFG_FORCE_WIDE) ) if( !ConfigGetConfig(DML_CFG_FORCE_WIDE) )
break; break;
dbgprintf("Patch:[MTXPerspectiveSig] 0x%08X \n", (u32)FOffset);
*(volatile float *)0x00000050 = 0.5625f; *(volatile float *)0x00000050 = 0.5625f;
memcpy((void*)(FOffset+ 28),(void*)(FOffset+ 36),44); memcpy((void*)(FOffset+ 28),(void*)(FOffset+ 36),44);
memcpy((void*)(FOffset+188),(void*)(FOffset+192),16); memcpy((void*)(FOffset+188),(void*)(FOffset+192),16);
*(unsigned int*)(FOffset+52) = 0x48000001 | ((*(unsigned int*)(FOffset+52) & 0x3FFFFFC) + 8); *(unsigned int*)(FOffset+52) = 0x48000001 | ((*(unsigned int*)(FOffset+52) & 0x3FFFFFC) + 8);
*(unsigned int*)(FOffset+72) = 0x3C600000 | (0x80000050 >> 16); // lis 3, 0x8180 *(unsigned int*)(FOffset+72) = 0x3C600000 | (0x80000050 >> 16); // lis 3, 0x8180
*(unsigned int*)(FOffset+76) = 0xC0230000 | (0x80000050 & 0xFFFF); // lfs 1, -0x1C (3) *(unsigned int*)(FOffset+76) = 0xC0230000 | (0x80000050 & 0xFFFF); // lfs 1, -0x1C (3)
*(unsigned int*)(FOffset+80) = 0xEC240072; // fmuls 1, 4, 1 *(unsigned int*)(FOffset+80) = 0xEC240072; // fmuls 1, 4, 1
} break;
case 0xdead000D: // C_MTXLightPerspective
{
if( !ConfigGetConfig(DML_CFG_FORCE_WIDE) )
break;
*(volatile float *)0x00000050 = 0.5625f;
*(u32*)(FOffset+36) = *(u32*)(FOffset+32);
memcpy((void*)(FOffset+ 28),(void*)(FOffset+ 36),60);
memcpy((void*)(FOffset+184),(void*)(FOffset+188),16);
*(u32*)(FOffset+68) += 8;
*(u32*)(FOffset+88) = 0x3C600000 | (0x80000050 >> 16); // lis 3, 0x8180
*(u32*)(FOffset+92) = 0xC0230000 | (0x80000050 & 0xFFFF); // lfs 1, -0x90 (3)
*(u32*)(FOffset+96) = 0xEC240072; // fmuls 1, 4, 1
} break; } break;
default: default:
{ {

View File

@ -15,7 +15,7 @@
#define PADHOOK 1 #define PADHOOK 1
#define CONFIG_VERSION 0x00000002 #define CONFIG_VERSION 0x00000002
#define DML_VERSION 0x00020008 #define DML_VERSION 0x00020009
#define DI_SUCCESS 1 #define DI_SUCCESS 1
#define DI_ERROR 2 #define DI_ERROR 2