Add support for loading .srl files

Fix a few bugs in spi handling.
Update vs2010 project file.
This commit is contained in:
normmatt234 2010-05-07 09:57:41 +00:00
parent d6cc212f0f
commit 1ff0161d4e
5 changed files with 22 additions and 11 deletions

View File

@ -1429,7 +1429,7 @@ u32 MMU_readFromGC()
// --- Ninja SD commands end ---------------------------------
default:
INFO("READ CARD command: %02X%02X%02X%02X%02X%02X%02X%02X\t",
INFO("READ CARD command: %02X%02X%02X%02X% 02X%02X%02X%02X\t",
card.command[0], card.command[1], card.command[2], card.command[3],
card.command[4], card.command[5], card.command[6], card.command[7]);
INFO("FROM: %08X\n", (PROCNUM ? NDS_ARM7:NDS_ARM9).instruct_adr);
@ -2398,6 +2398,7 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
case REG_AUXSPIDATA:
if(val!=0) MMU.AUX_SPI_CMD = val & 0xFF;
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM9));
MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag
return;
case REG_WRAMCNT:
@ -2741,6 +2742,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
//T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM9));
MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag
return;
case REG_DISPA_BG0CNT :
@ -3691,6 +3693,7 @@ void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
case REG_AUXSPIDATA:
if(val!=0) MMU.AUX_SPI_CMD = val & 0xFF;
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM7));
MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag
return;
}
MMU.MMU_MEM[ARMCPU_ARM7][adr>>20][adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20]]=val;
@ -3774,6 +3777,7 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 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,ARMCPU_ARM7));
MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag
return;
case REG_SPICNT :

View File

@ -458,6 +458,7 @@ u8 BackupDevice::data_command(u8 val, int cpu)
ensure(addr+1);
if(com == BM_CMD_READLOW)
{
//printf("READ ADR: %08X\n",addr);
val = data[addr];
//flushPending = true; //is this a good idea? it may slow stuff down, but it is helpful for debugging
lazyFlushPending = true; //lets do this instead
@ -465,9 +466,13 @@ u8 BackupDevice::data_command(u8 val, int cpu)
}
else
{
data[addr] = val;
flushPending = true;
//printf("writ: %08X\n",addr);
if(write_enable)
{
//printf("WRITE ADR: %08X\n",addr);
data[addr] = val;
flushPending = true;
//printf("writ: %08X\n",addr);
}
}
addr++;
@ -477,8 +482,8 @@ u8 BackupDevice::data_command(u8 val, int cpu)
else if(com == BM_CMD_READSTATUS)
{
//handle request to read status
//LOG("Backup Memory Read Status: %02X\n", mc->write_enable << 1);
return (write_enable << 1);
LOG("Backup Memory Read Status: %02X\n", mc->write_enable << 1);
return (write_enable << 1) | (3<<2);
}
else
{
@ -488,15 +493,16 @@ u8 BackupDevice::data_command(u8 val, int cpu)
case 0: break; //??
case 8:
printf("COMMAND%c: Unverified Backup Memory command: %02X FROM %08X\n",(cpu==ARMCPU_ARM9)?'9':'7',val, (cpu==ARMCPU_ARM9)?NDS_ARM9.instruct_adr:NDS_ARM7.instruct_adr);
val = 0xAA;
break;
case BM_CMD_WRITEDISABLE:
write_enable = FALSE;
break;
case BM_CMD_READSTATUS:
com = BM_CMD_READSTATUS;
com = (write_enable << 1) | (3<<2);
break;
case BM_CMD_WRITEENABLE:

View File

@ -419,6 +419,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\addons.cpp" />
<ClCompile Include="..\addons\piano.cpp" />
<ClCompile Include="..\aggdraw.cpp" />
<ClCompile Include="..\arm_instructions.cpp" />
<ClCompile Include="..\armcpu.cpp" />

View File

@ -256,7 +256,7 @@ INT_PTR CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara
// TODO: add another gba file formats and archs (??wtf??)
const char* fileFilter = "GameBoy Advance ROM (*.gba)\0*.gba\0"
"NDS ROM (for nitroFS roms) (*.nds)\0*.nds\0"
"NDS ROM (for nitroFS roms) (*.nds,*.srl)\0*.nds;*.srl\0"
"Any file (*.*)\0*.*\0";
ofn.lpstrFilter = fileFilter;

View File

@ -3304,8 +3304,8 @@ LRESULT OpenFile()
ofn.hwndOwner = hwnd;
ofn.lpstrFilter =
"All Usable Files (*.nds, *.ds.gba, *.zip, *.7z, *.rar, *.bz2)\0*.nds;*.ds.gba;*.zip;*.7z;*.rar;*.bz2\0"
"NDS ROM file (*.nds)\0*.nds\0"
"All Usable Files (*.nds, *.ds.gba, *.srl, *.zip, *.7z, *.rar, *.bz2)\0*.nds;*.ds.gba;*.srl;*.zip;*.7z;*.rar;*.bz2\0"
"NDS ROM file (*.nds,*.srl)\0*.nds;*.srl\0"
"NDS/GBA ROM File (*.ds.gba)\0*.ds.gba\0"
"Zipped NDS ROM file (*.zip)\0*.zip\0"
"7Zipped NDS ROM file (*.7z)\0*.7z\0"