diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 047a4f42e..9e3b75650 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -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 : diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index b9b291172..33b2bb078 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -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: diff --git a/desmume/src/windows/DeSmuME_2010.vcxproj b/desmume/src/windows/DeSmuME_2010.vcxproj index 1ebf88efb..8b8b32f63 100644 --- a/desmume/src/windows/DeSmuME_2010.vcxproj +++ b/desmume/src/windows/DeSmuME_2010.vcxproj @@ -419,6 +419,7 @@ + diff --git a/desmume/src/windows/gbaslot_config.cpp b/desmume/src/windows/gbaslot_config.cpp index 30dfdb725..f73830577 100644 --- a/desmume/src/windows/gbaslot_config.cpp +++ b/desmume/src/windows/gbaslot_config.cpp @@ -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; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 7487a2234..81ba24429 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -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"