fix bad new crashiness

This commit is contained in:
zeromus 2009-05-18 05:48:43 +00:00
parent 0baa5914a5
commit 2d9968e2eb
4 changed files with 16 additions and 10 deletions

View File

@ -174,6 +174,7 @@ void mmu_log_debug_ARM7(u32 adr, const char *fmt, ...)
#define DUP16(x) x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x #define DUP16(x) x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x
MMU_struct MMU; MMU_struct MMU;
MMU_struct_new MMU_new;
u8 * MMU_struct::MMU_MEM[2][256] = { u8 * MMU_struct::MMU_MEM[2][256] = {
//arm9 //arm9
@ -1793,7 +1794,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
if (val == 0) if (val == 0)
//mc_reset_com(&MMU.bupmem); // reset backup memory device communication //mc_reset_com(&MMU.bupmem); // reset backup memory device communication
MMU.backupDevice.reset_command(); MMU_new.backupDevice.reset_command();
return; return;
case REG_AUXSPIDATA: case REG_AUXSPIDATA:
@ -1801,7 +1802,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
AUX_SPI_CMD = val & 0xFF; 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.backupDevice.data_command(val)); T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command(val));
return; return;
case REG_DISPA_BG0CNT : case REG_DISPA_BG0CNT :
@ -3086,7 +3087,7 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
if (val == 0) if (val == 0)
//mc_reset_com(&MMU.bupmem); // reset backup memory device communication //mc_reset_com(&MMU.bupmem); // reset backup memory device communication
MMU.backupDevice.reset_command(); MMU_new.backupDevice.reset_command();
return; return;
case REG_AUXSPIDATA: case REG_AUXSPIDATA:
@ -3094,7 +3095,7 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
AUX_SPI_CMD = val & 0xFF; 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.backupDevice.data_command(val)); T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command(val));
return; return;
case REG_SPICNT : case REG_SPICNT :

View File

@ -118,7 +118,6 @@ struct MMU_struct {
memory_chip_t fw; memory_chip_t fw;
memory_chip_t bupmem; memory_chip_t bupmem;
BackupDevice backupDevice;
nds_dscard dscard[2]; nds_dscard dscard[2];
u32 CheckTimers; u32 CheckTimers;
@ -126,7 +125,13 @@ struct MMU_struct {
}; };
struct MMU_struct_new
{
BackupDevice backupDevice;
};
extern MMU_struct MMU; extern MMU_struct MMU;
extern MMU_struct_new MMU_new;
struct armcpu_memory_iface { struct armcpu_memory_iface {

View File

@ -834,7 +834,7 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
//mc_realloc(&MMU.bupmem, bmtype, bmsize); //mc_realloc(&MMU.bupmem, bmtype, bmsize);
//mc_load_file(&MMU.bupmem, buf); //mc_load_file(&MMU.bupmem, buf);
MMU.backupDevice.load_rom(buf); MMU_new.backupDevice.load_rom(buf);
memset(buf, 0, MAX_PATH); memset(buf, 0, MAX_PATH);
strcpy(buf, pathFilenameToROMwithoutExt); strcpy(buf, pathFilenameToROMwithoutExt);
@ -904,7 +904,7 @@ void NDS_Reset(BOOL resetBySavestate)
currFrameCounter=0; currFrameCounter=0;
MMU_clearMem(); MMU_clearMem();
MMU.backupDevice.reset(); MMU_new.backupDevice.reset();
//ARM7 BIOS IRQ HANDLER //ARM7 BIOS IRQ HANDLER
if(CommonSettings.UseExtBIOS == true) if(CommonSettings.UseExtBIOS == true)

View File

@ -258,7 +258,7 @@ static void mmu_savestate(std::ostream* os)
write32le(2,os); write32le(2,os);
//newer savefile system: //newer savefile system:
MMU.backupDevice.save_state(os); MMU_new.backupDevice.save_state(os);
} }
static bool mmu_loadstate(std::istream* is, int size) static bool mmu_loadstate(std::istream* is, int size)
@ -297,14 +297,14 @@ static bool mmu_loadstate(std::istream* is, int size)
u8* temp = new u8[bupmem_size]; u8* temp = new u8[bupmem_size];
is->read((char*)temp,bupmem_size); is->read((char*)temp,bupmem_size);
MMU.backupDevice.load_old_state(addr_size,temp,bupmem_size); MMU_new.backupDevice.load_old_state(addr_size,temp,bupmem_size);
delete[] temp; delete[] temp;
if(is->fail()) return false; if(is->fail()) return false;
} }
else if(version == 2) else if(version == 2)
{ {
//newer savefile system: //newer savefile system:
MMU.backupDevice.load_state(is); MMU_new.backupDevice.load_state(is);
} }
return true; return true;