Patches:
*Added a new method of video mode forcing (i.e. Luigi's Mansion EUR works in NTSC video mode) git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@13 be6c1b03-d731-4111-a574-e37d80d43941
This commit is contained in:
parent
0eca7bf37c
commit
ef7ac95153
71
Patches.c
71
Patches.c
@ -76,6 +76,43 @@ u32 __GXSetVAT_patch[31] = {
|
||||
0x4082ffa0, 0x38000000, 0x980904f2, 0x4e800020
|
||||
};
|
||||
|
||||
u8 GXMObjects[][0x3C] =
|
||||
{
|
||||
{ // GXPal528IntDf
|
||||
0x00, 0x00, 0x00, 0x04, 0x02, 0x80, 0x02, 0x10, 0x02, 0x10, 0x00, 0x28, 0x00, 0x17, 0x02, 0x80,
|
||||
0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x08, 0x08, 0x0A, 0x0C, 0x0A, 0x08, 0x08, 0x00, 0x00, 0x00,
|
||||
},
|
||||
|
||||
{ // GXEurgb60Hz480IntDf
|
||||
0x00, 0x00, 0x00, 0x14, 0x02, 0x80, 0x01, 0xE0, 0x01, 0xE0, 0x00, 0x28, 0x00, 0x00, 0x02, 0x80,
|
||||
0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x08, 0x08, 0x0A, 0x0C, 0x0A, 0x08, 0x08, 0x00, 0x00, 0x00,
|
||||
},
|
||||
|
||||
{ // GXMpal480IntDf
|
||||
0x00, 0x00, 0x00, 0x08, 0x02, 0x80, 0x01, 0xE0, 0x01, 0xE0, 0x00, 0x28, 0x00, 0x00, 0x02, 0x80,
|
||||
0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x08, 0x08, 0x0A, 0x0C, 0x0A, 0x08, 0x08, 0x00, 0x00, 0x00,
|
||||
},
|
||||
|
||||
{ // GXNtsc480IntDf
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x01, 0xE0, 0x01, 0xE0, 0x00, 0x28, 0x00, 0x00, 0x02, 0x80,
|
||||
0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x08, 0x08, 0x0A, 0x0C, 0x0A, 0x08, 0x08, 0x00, 0x00, 0x00,
|
||||
},
|
||||
|
||||
{ // GXNtsc480Int
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x01, 0xE0, 0x01, 0xE0, 0x00, 0x28, 0x00, 0x00, 0x02, 0x80,
|
||||
0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||
0x06, 0x06, 0x00, 0x00, 0x15, 0x16, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
},
|
||||
};
|
||||
|
||||
FuncPattern FPatterns[] =
|
||||
{
|
||||
@ -753,6 +790,40 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset )
|
||||
}
|
||||
}
|
||||
|
||||
if( ConfigGetVideMode() & DML_VID_FORCE )
|
||||
{
|
||||
k=0;
|
||||
for( i=0; i < size; i+=4 )
|
||||
{
|
||||
for( j=0; j <= GXNtsc480Int; ++j )
|
||||
{
|
||||
if( memcmp( ptr+i, GXMObjects[j], 0x3C ) == 0 )
|
||||
{
|
||||
dbgprintf("Patch:Found GX pattern %u at %08X\n", j, ptr+i );
|
||||
switch( ConfigGetVideMode() & 15 )
|
||||
{
|
||||
case DML_VID_FORCE_PAL50:
|
||||
{
|
||||
memcpy( ptr+i, GXMObjects[GXPal528IntDf], 0x3C );
|
||||
} break;
|
||||
case DML_VID_FORCE_PAL60:
|
||||
{
|
||||
memcpy( ptr+i, GXMObjects[GXEurgb60Hz480IntDf], 0x3C );
|
||||
} break;
|
||||
case DML_VID_FORCE_NTSC:
|
||||
{
|
||||
memcpy( ptr+i, GXMObjects[GXNtsc480IntDf], 0x3C );
|
||||
} break;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
if( k > 4 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( i=0; i < size; i+=4 )
|
||||
{
|
||||
if( read32( (u32)ptr + i ) != 0x4E800020 )
|
||||
|
24
Patches.h
24
Patches.h
@ -9,6 +9,7 @@
|
||||
#include "vsprintf.h"
|
||||
#include "HW.h"
|
||||
#include "dol.h"
|
||||
#include "Config.h"
|
||||
|
||||
|
||||
typedef struct PatchInfo
|
||||
@ -44,6 +45,29 @@ typedef struct PatchCache
|
||||
|
||||
} PatchCache;
|
||||
|
||||
typedef struct _gx_rmodeobj {
|
||||
u32 viTVMode;
|
||||
u16 fbWidth;
|
||||
u16 efbHeight;
|
||||
u16 xfbHeight;
|
||||
u16 viXOrigin;
|
||||
u16 viYOrigin;
|
||||
u16 viWidth;
|
||||
u16 viHeight;
|
||||
u32 xfbMode;
|
||||
u8 field_rendering;
|
||||
u8 aa;
|
||||
u8 sample_pattern[12][2];
|
||||
u8 vfilter[7];
|
||||
} GXRModeObj;
|
||||
|
||||
#define GXPal528IntDf 0
|
||||
#define GXEurgb60Hz480IntDf 1
|
||||
#define GXMpal480IntDf 2
|
||||
#define GXNtsc480IntDf 3
|
||||
#define GXNtsc480Int 4
|
||||
|
||||
|
||||
void PatchGCIPL( void );
|
||||
void DoPatches( char *ptr, u32 size, u32 SectionOffset );
|
||||
void DoCardPatches( char *ptr, u32 size, u32 SectionOffset );
|
||||
|
13
dip.c
13
dip.c
@ -176,6 +176,19 @@ u32 DIUpdateRegisters( void )
|
||||
if( DOLMaxOff < dol->addressText[i] + dol->sizeText[i] )
|
||||
DOLMaxOff = dol->addressText[i] + dol->sizeText[i];
|
||||
}
|
||||
|
||||
for( i=0; i < 11; ++i )
|
||||
{
|
||||
if( dol->addressData[i] == 0 )
|
||||
continue;
|
||||
|
||||
if( DOLMinOff > dol->addressData[i])
|
||||
DOLMinOff = dol->addressData[i];
|
||||
|
||||
if( DOLMaxOff < dol->addressData[i] + dol->sizeData[i] )
|
||||
DOLMaxOff = dol->addressData[i] + dol->sizeData[i];
|
||||
}
|
||||
|
||||
DOLMinOff -= 0x80000000;
|
||||
DOLMaxOff -= 0x80000000;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user