Support new Backup command required for Pokemon HG/SS to work without triggering an anti-piracy protection.

This commit is contained in:
normmatt234 2009-09-15 12:14:17 +00:00
parent ab61e64ac2
commit 96db719b0c
3 changed files with 11 additions and 7 deletions

View File

@ -2245,7 +2245,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
MMU.AUX_SPI_CMD = val & 0xFF; MMU.AUX_SPI_CMD = val & 0xFF;
//T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val)); //T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val)); T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM9));
return; return;
case REG_DISPA_BG0CNT : case REG_DISPA_BG0CNT :
@ -3184,7 +3184,7 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
MMU.AUX_SPI_CMD = val & 0xFF; MMU.AUX_SPI_CMD = val & 0xFF;
//T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val)); //T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val)); T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM7));
return; return;
case REG_SPICNT : case REG_SPICNT :

View File

@ -376,7 +376,7 @@ void BackupDevice::reset_command()
com = 0; com = 0;
} }
u8 BackupDevice::data_command(u8 val) u8 BackupDevice::data_command(u8 val, int cpu)
{ {
if(com == BM_CMD_READLOW || com == BM_CMD_WRITELOW) if(com == BM_CMD_READLOW || com == BM_CMD_WRITELOW)
{ {
@ -441,6 +441,10 @@ u8 BackupDevice::data_command(u8 val)
{ {
case 0: break; //?? case 0: break; //??
case 8:
val = 0xAA;
break;
case BM_CMD_WRITEDISABLE: case BM_CMD_WRITEDISABLE:
write_enable = FALSE; write_enable = FALSE;
break; break;
@ -479,7 +483,7 @@ u8 BackupDevice::data_command(u8 val)
break; break;
default: default:
printf("COMMAND: Unhandled Backup Memory command: %02X\n", val); printf("COMMAND%c: Unhandled Backup Memory command: %02X FROM %08X\n",(cpu==ARMCPU_ARM9)?'9':'7',val, NDS_ARM9.instruct_adr);
break; break;
} }
} }
@ -493,9 +497,9 @@ void BackupDevice::ensure(u32 addr)
if(size<addr) if(size<addr)
{ {
data.resize(addr); data.resize(addr);
for(u32 i=size;i<addr;i++)
data[i] = kUninitializedSaveDataValue;
} }
for(u32 i=size;i<addr;i++)
data[i] = kUninitializedSaveDataValue;
} }

View File

@ -83,7 +83,7 @@ public:
//commands from mmu //commands from mmu
void reset_command(); void reset_command();
u8 data_command(u8); u8 data_command(u8,int);
//this info was saved before the last reset (used for savestate compatibility) //this info was saved before the last reset (used for savestate compatibility)
struct SavedInfo struct SavedInfo