add card eject emulation

This commit is contained in:
zeromus 2009-12-21 20:33:22 +00:00
parent db8774bdbf
commit b57aabc994
8 changed files with 35 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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 }
};

View File

@ -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;

View File

@ -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

Binary file not shown.