added Close ROM menu command and made Lua scripts stop when opening or closing a ROM

This commit is contained in:
nitsuja 2009-09-05 17:39:22 +00:00
parent b14a3a592b
commit 54f771536e
4 changed files with 27 additions and 4 deletions

View File

@ -48,10 +48,16 @@ struct HudStruct
{
public:
HudStruct()
: fps(0)
, fps3d(0)
, clicked(false)
{}
{
resetTransient();
}
void resetTransient()
{
fps = 0;
fps3d = 0;
clicked = false;
}
HudCoordinates SavestateSlots;
HudCoordinates FpsDisplay;

View File

@ -2693,6 +2693,8 @@ static BOOL OpenCore(const char* filename)
if(!ObtainFile(filename, LogicalName, PhysicalName, "rom", s_nonRomExtensions, ARRAY_SIZE(s_nonRomExtensions)))
return FALSE;
StopAllLuaScripts();
if(LoadROM(filename, LogicalName))
{
romloaded = TRUE;
@ -2791,6 +2793,17 @@ LRESULT OpenFile()
return 0;
}
void CloseRom()
{
StopAllLuaScripts();
// cheatsSearchClose();
NDS_FreeROM();
romloaded = false;
execute = false;
Hud.resetTransient();
NDS_Reset();
}
//TODO - async key state? for real?
int GetModifiers(int key)
{
@ -3014,6 +3027,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
DesEnableMenuItem(mainMenu, IDM_FILE_RECORDAVI, romloaded);
DesEnableMenuItem(mainMenu, IDM_FILE_RECORDWAV, romloaded);
DesEnableMenuItem(mainMenu, IDM_RESET, romloaded);
DesEnableMenuItem(mainMenu, IDM_CLOSEROM, romloaded);
DesEnableMenuItem(mainMenu, IDM_SHUT_UP, romloaded);
DesEnableMenuItem(mainMenu, IDM_CHEATS_LIST, romloaded);
DesEnableMenuItem(mainMenu, IDM_CHEATS_SEARCH, romloaded);
@ -3525,6 +3539,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
case IDM_OPEN:
return OpenFile();
case IDM_CLOSEROM:
return CloseRom(),0;
case IDM_PRINTSCREEN:
HK_PrintScreen(0);
return 0;

View File

@ -120,6 +120,7 @@
#define IDC_PNG 325
#define IDC_BMP 326
#define IDC_FORMATSTATIC 327
#define IDM_CLOSEROM 328
#define IDM_PATHSETTINGS 350
#define IDC_ROMPATHEDIT 351
#define IDC_BROWSEROMS 352

Binary file not shown.