-Fixed a memory leak in Rom Info dialog

-Rom Info and Reset menu options are now only enabled after a ROM has been loaded
This commit is contained in:
cyberwarriorx 2006-12-08 06:40:02 +00:00
parent dce78ebfaa
commit fe2e82c8a6
2 changed files with 16 additions and 1 deletions

View File

@ -57,6 +57,8 @@ LRESULT Ginfo_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
EndPaint(hwnd, &ps);
free(header);
return 0;
}

View File

@ -72,6 +72,7 @@ u32 glock = 0;
BOOL click = FALSE;
BOOL finished = FALSE;
BOOL romloaded = FALSE;
HMENU menu;
HANDLE runthread=INVALID_HANDLE_VALUE;
@ -313,12 +314,17 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
{
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
EnableMenuItem(menu, IDM_RESET, MF_ENABLED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED);
romloaded = TRUE;
NDS_UnPause();
}
else
{
EnableMenuItem(menu, IDM_EXEC, MF_ENABLED);
EnableMenuItem(menu, IDM_PAUSE, MF_GRAYED);
EnableMenuItem(menu, IDM_RESET, MF_GRAYED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_GRAYED);
}
CheckMenuItem(menu, IDC_SAVETYPE1, MF_BYCOMMAND | MF_CHECKED);
@ -417,6 +423,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
EnableMenuItem(menu, IDM_RESET, MF_ENABLED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED);
romloaded = TRUE;
NDS_UnPause();
}
}
@ -596,7 +605,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if(!GetOpenFileName(&ofn))
{
NDS_UnPause(); //Restart emulation if no new rom chosen
if (romloaded)
NDS_UnPause(); //Restart emulation if no new rom chosen
return 0;
}
@ -606,6 +616,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
EnableMenuItem(menu, IDM_RESET, MF_ENABLED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED);
romloaded = TRUE;
NDS_UnPause();
}
}