diff --git a/desmume/ChangeLog b/desmume/ChangeLog index 7209fbe52..c49bfbc09 100644 --- a/desmume/ChangeLog +++ b/desmume/ChangeLog @@ -1,4 +1,4 @@ -0.9.5 -> 0.9.6 (r3075-r3200-r3xxx) +0.9.5 -> 0.9.6 (r3075-r3209-r3xxx) General/Core: bug: emulate keypad interrupt @@ -9,9 +9,11 @@ General/Core: bug: fix lid savestate desync bug: fix texcache memory GB explosion when games use tons of tiny 3d sprites bug: fix huge rerecording movie file handle leak + bug: fix EXXXXXXX cheat codes + bug: add 8MBit flash emulation + bug: fix firmware booted-from-card flag enh: support devkitpro argv enh: add gbaslot-rom commandline - bug: fix EXXXXXXX cheat codes Graphics: bug: fix a mistakenly rendered OBJ window @@ -27,6 +29,7 @@ Windows: enh: add fancy ctrl+printscreen with emulator info on it enh: add "lockdown" window mode to keep window safe from fast stylus action enh: add alt+enter fullscreen command + enh: add card eject command Linux/OSX: bug: fix building for nosse2 systems diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 4c0fd6f5b..e383c68d2 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -1357,7 +1357,11 @@ u32 MMU_readFromGC() // As DeSmuME boots directly from the game, the chip // ID in main mem is zero and this value needs to be // zero too. - val = 0x00000000; + + //staff of kings verifies this (it also uses the arm7 IRQ 20) + if(nds.cardEjected) + val = 0xFFFFFFFF; + else val = 0x00000000; } break; diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 4b0a01eec..ce017bf37 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -93,8 +93,6 @@ int NDS_Init( void) { MMU_Init(); nds.VCount = 0; - nds.sleeping = FALSE; - if (Screen_Init(GFXCORE_DUMMY) != 0) return -1; @@ -867,6 +865,15 @@ int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char } void NDS_Sleep() { nds.sleeping = TRUE; } +void NDS_ToggleCardEject() +{ + if(!nds.cardEjected) + { + //staff of kings will test this (it also uses the arm9 0xB8 poll) + NDS_makeInt(1, 20); + } + nds.cardEjected ^= TRUE; +} class FrameSkipper @@ -1901,6 +1908,9 @@ void NDS_Reset() if (!header) return ; + nds.sleeping = FALSE; + nds.cardEjected = FALSE; + nds_timer = 0; nds_arm9_timer = 0; nds_arm7_timer = 0; diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 6698d93fa..297dae8ae 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -180,6 +180,7 @@ struct NDSSystem u32 FW_ARM7BootCodeSize; BOOL sleeping; + BOOL cardEjected; //this is not essential NDS runtime state. //it was perhaps a mistake to put it here. @@ -384,6 +385,7 @@ int NDS_WriteBMP(const char *filename); int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings); void NDS_Sleep(); +void NDS_ToggleCardEject(); void NDS_SkipNextFrame(); #define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame(); diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index f3aa50c65..ada13eb56 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -172,6 +172,7 @@ SFORMAT SF_NDS[]={ { "_ENH", 4, 1, &nds.ensataHandshake}, { "_ENI", 4, 1, &nds.ensataIpcSyncCounter}, { "_SLP", 4, 1, &nds.sleeping}, + { "_CEJ", 4, 1, &nds.cardEjected}, { 0 } }; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 7a368f14c..3d4006550 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -3586,6 +3586,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM DesEnableMenuItem(mainMenu, IDM_QUICK_PRINTSCREEN, romloaded); DesEnableMenuItem(mainMenu, IDM_FILE_RECORDAVI, romloaded); DesEnableMenuItem(mainMenu, IDM_FILE_RECORDWAV, romloaded); + DesEnableMenuItem(mainMenu, IDM_EJECTCARD, romloaded && movieMode == MOVIEMODE_INACTIVE); DesEnableMenuItem(mainMenu, IDM_RESET, romloaded && movieMode != MOVIEMODE_PLAY); DesEnableMenuItem(mainMenu, IDM_CLOSEROM, romloaded); DesEnableMenuItem(mainMenu, IDM_SHUT_UP, romloaded); @@ -3614,8 +3615,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM //Updated Checked menu items - //Pause + //emulation menu MainWindow->checkMenu(IDM_PAUSE, ((paused))); + MainWindow->checkMenu(IDM_EJECTCARD, nds.cardEjected); + // LCDs layout MainWindow->checkMenu(ID_LCDS_VERTICAL, ((video.layout==0))); MainWindow->checkMenu(ID_LCDS_HORIZONTAL, ((video.layout==1))); @@ -4938,6 +4941,10 @@ DOKEYDOWN: case IDC_SAVETYPE7: backup_setManualBackupType(6); return 0; case IDC_SAVETYPE8: backup_setManualBackupType(7); return 0; + case IDM_EJECTCARD: + NDS_ToggleCardEject(); + return 0; + case IDM_RESET: ResetGame(); return 0; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 5f9ef3579..a58ab7ce0 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -701,6 +701,7 @@ #define IDM_VIEW3D 40065 #define IDM_LOCKDOWN 40066 #define IDC_SAVETYPE8 40067 +#define IDM_EJECTCARD 40068 #define IDC_LABEL_UP 50000 #define IDC_LABEL_RIGHT 50001 #define IDC_LABEL_LEFT 50002 @@ -796,7 +797,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40012 +#define _APS_NEXT_COMMAND_VALUE 40014 #define _APS_NEXT_CONTROL_VALUE 1020 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index ba3cf4432..6af8c86ba 100644 Binary files a/desmume/src/windows/resources.rc and b/desmume/src/windows/resources.rc differ