Psikyo big-endian patches from lantus

This commit is contained in:
Barry Harris 2012-01-26 14:25:53 +00:00
parent 507175c654
commit 4f93c2c5a0
2 changed files with 77 additions and 0 deletions

View File

@ -241,6 +241,17 @@ static struct BurnDIPInfo HotgmckDIPList[]=
STDDIPINFO(Hotgmck)
#ifndef LSB_FIRST
static void le_to_be(unsigned char * p, int size)
{
unsigned char c;
for(int i=0; i<size; i+=4, p+=4) {
c = *(p+0); *(p+0) = *(p+3); *(p+3) = c;
c = *(p+1); *(p+1) = *(p+2); *(p+2) = c;
}
}
#endif
static void set_pcm_bank()
{
if (mahjong) {
@ -320,7 +331,9 @@ void __fastcall ps4_write_long(UINT32 address, UINT32 data)
UINT16 __fastcall ps4_read_word(UINT32 address)
{
address &= 0xc7fffffe;
#ifdef LSB_FIRST
address ^= 2;
#endif
if (address >= 0x03000000 && address <= 0x030037ff) {
return *((UINT16 *)(DrvSprRAM + (address & 0x3ffe)));
@ -357,12 +370,16 @@ UINT8 __fastcall ps4_read_byte(UINT32 address)
if (address >= 0x03000000 && address <= 0x030037ff) {
#ifdef LSB_FIRST
address ^= 3;
#endif
return DrvSprRAM[address & 0x3fff];
}
if ((address & 0xffffe000) == 0x03004000) {
#ifdef LSB_FIRST
address ^= 3;
#endif
return DrvPalRAM[address & 0x1fff];
}
@ -396,7 +413,9 @@ UINT8 __fastcall ps4_read_byte(UINT32 address)
void __fastcall ps4_write_word(UINT32 address, UINT16 data)
{
address &= 0xc7fffffe;
#ifdef LSB_FIRST
address ^= 2;
#endif
if (address >= 0x03000000 && address <= 0x030037ff) {
*((UINT16 *)(DrvSprRAM + (address & 0x3ffe))) = data;
@ -427,17 +446,29 @@ void __fastcall ps4_write_byte(UINT32 address, UINT8 data)
// bprintf (0, _T("%8.8x, wb\n"), address);
if (address >= 0x03000000 && address <= 0x030037ff) {
#ifdef LSB_FIRST
DrvSprRAM[(address ^ 3) & 0x3fff] = data;
#else
DrvSprRAM[(address) & 0x3fff] = data;
#endif
return;
}
if ((address & 0xffffe000) == 0x03004000) {
#ifdef LSB_FIRST
DrvPalRAM[(address ^ 3) & 0x1fff] = data;
#else
DrvPalRAM[(address) & 0x1fff] = data;
#endif
return;
}
if (address >= 0x03003fe4 && address <= 0x03003fef) {
#ifdef LSB_FIRST
DrvVidRegs[(address ^ 3) - 0x03003fe4] = data;
#else
DrvVidRegs[(address) - 0x03003fe4] = data;
#endif
return;
}
@ -516,12 +547,20 @@ UINT32 __fastcall ps4hack_read_long(UINT32 a)
UINT16 __fastcall ps4hack_read_word(UINT32 a)
{
#ifdef LSB_FIRST
return *((UINT16 *)(DrvSh2RAM + ((a & 0xffffe) ^ 2)));
#else
return *((UINT16 *)(DrvSh2RAM + ((a & 0xffffe))));
#endif
}
UINT8 __fastcall ps4hack_read_byte(UINT32 a)
{
#ifdef LSB_FIRST
return DrvSh2RAM[(a & 0xfffff) ^ 3];
#else
return DrvSh2RAM[(a & 0xfffff)];
#endif
}
static INT32 MemIndex(INT32 gfx_len)
@ -652,6 +691,9 @@ static INT32 DrvInit(INT32 (*LoadCallback)(), INT32 gfx_len)
}
BurnSwapEndian();
#ifndef LSB_FIRST
le_to_be(DrvSh2ROM,0x0300000);
#endif
BurnSwap32(DrvGfxROM, gfx_len);
if (mahjong) {

View File

@ -266,6 +266,17 @@ STDDIPINFO(Tgm2)
//-------------------------------------------------------------------------------------
#ifndef LSB_FIRST
static void le_to_be(unsigned char * p, int size)
{
unsigned char c;
for(int i=0; i<size; i+=4, p+=4) {
c = *(p+0); *(p+0) = *(p+3); *(p+3) = c;
c = *(p+1); *(p+1) = *(p+2); *(p+2) = c;
}
}
#endif
static void graphics_bank()
{
INT32 bank = (*((UINT32*)(DrvVidRegs + 0x10)) & 0x1ff) * 0x20000;
@ -292,7 +303,9 @@ void __fastcall psx_write_long(UINT32 , UINT32)
void __fastcall ps3v1_write_word(UINT32 address, UINT16 data)
{
address &= 0xc7ffffff;
#ifdef LSB_FIRST
address ^= 2;
#endif
if ((address & 0xfffffe00) == 0x3050000) {
*((UINT16 *)(DrvZoomRAM + (address & 0x1fe))) = data;
@ -305,13 +318,17 @@ void __fastcall ps3v1_write_byte(UINT32 address, UINT8 data)
address &= 0xc7ffffff;
if ((address & 0xfffffe00) == 0x3050000) {
#ifdef LSB_FIRST
address ^= 3;
#endif
DrvZoomRAM[address & 0x1ff] = data;
return;
}
if ((address & 0xffffffe0) == 0x305ffe0) {
#ifdef LSB_FIRST
address ^= 3;
#endif
DrvVidRegs[address & 0x1f] = data;
DrvZoomRAM[address & 0xffff] = data;
@ -376,7 +393,9 @@ UINT8 __fastcall ps3v1_read_byte(UINT32 address)
void __fastcall ps5_write_word(UINT32 address, UINT16 data)
{
address &= 0xc7ffffff;
#ifdef LSB_FIRST
address ^= 2;
#endif
if ((address & 0xfffffe00) == 0x4050000) {
*((UINT16 *)(DrvZoomRAM + (address & 0x1fe))) = data;
@ -389,13 +408,17 @@ void __fastcall ps5_write_byte(UINT32 address, UINT8 data)
address &= 0xc7ffffff;
if ((address & 0xfffffe00) == 0x4050000) {
#ifdef LSB_FIRST
address ^= 3;
#endif
DrvZoomRAM[address & 0x1ff] = data;
return;
}
if ((address & 0xffffffe0) == 0x405ffe0) {
#ifdef LSB_FIRST
address ^= 3;
#endif
DrvVidRegs[address & 0x1f] = data;
DrvZoomRAM[address & 0xffff] = data;
@ -483,12 +506,20 @@ UINT32 __fastcall hack_read_long(UINT32 a)
UINT16 __fastcall hack_read_word(UINT32 a)
{
#ifdef LSB_FIRST
return *((UINT16 *)(DrvSh2RAM + ((a & 0xfffff) ^ 2)));
#else
return *((UINT16 *)(DrvSh2RAM + ((a & 0xfffff))));
#endif
}
UINT8 __fastcall hack_read_byte(UINT32 a)
{
#ifdef LSB_FIRST
return DrvSh2RAM[(a & 0xfffff) ^ 3];
#else
return DrvSh2RAM[(a & 0xfffff)];
#endif
}
//-------------------------------------------------------------------------------------
@ -622,6 +653,10 @@ static INT32 DrvInit(INT32 (*LoadCallback)(), INT32 type, INT32 gfx_max, INT32 g
}
BurnSwap32(DrvSh2ROM, 0x100000);
#ifndef LSB_FIRST
le_to_be(DrvSh2ROM,0x200000);
#endif
BurnSwapEndian(0x200000);
DrvGfxDecode(gfx_max - gfx_min);
graphics_min_max[0] = gfx_min;