- fixed search after load savestate and reset game;
- fixed grayed 'OK' button in GBAslot dialog;
This commit is contained in:
mtabachenko 2009-06-14 16:44:00 +00:00
parent 728db76bde
commit 3ed0604e12
5 changed files with 53 additions and 44 deletions

View File

@ -543,6 +543,7 @@ void NDS_DeInit(void) {
#ifdef EXPERIMENTAL_WIFI
WIFI_SoftAP_Shutdown(&wifiMac);
#endif
cheatsSearchClose();
}
BOOL NDS_SetROM(u8 * rom, u32 mask)
@ -828,6 +829,7 @@ int NDS_LoadROM( const char *filename,
#endif
cheatsSearchClose();
MMU_unsetRom();
NDS_SetROM(data, mask);
NDS_Reset();
@ -868,7 +870,7 @@ void NDS_FreeROM(void)
}
bool _HACK_DONT_STOPMOVIE = false;
void NDS_Reset(BOOL resetBySavestate)
void NDS_Reset()
{
unsigned int i;
u32 src;
@ -1054,8 +1056,6 @@ void NDS_Reset(BOOL resetBySavestate)
gfx3d_reset();
gpu3D->NDS_3D_Reset();
SPU_Reset();
if (!resetBySavestate)
cheatsSearchClose();
#ifdef EXPERIMENTAL_WIFI
WIFI_Init(&wifiMac);

View File

@ -290,7 +290,7 @@ int NDS_LoadROM(const char *filename,
const char *cflash_disk_image_file);
#endif
void NDS_FreeROM(void);
void NDS_Reset(BOOL resetBySaveState = FALSE);
void NDS_Reset();
int NDS_ImportSave(const char *filename);
bool NDS_ExportSave(const char *filename);

View File

@ -792,10 +792,6 @@ void cheatsSearchInit(u8 type, u8 size, u8 sign)
void cheatsSearchClose()
{
#ifdef _MSC_VER
void CheatsSearchReset();
CheatsSearchReset();
#endif
if (searchStatMem) delete [] searchStatMem;
searchStatMem = NULL;

View File

@ -39,6 +39,7 @@ char tmp_gbagame_filename[MAX_PATH];
u8 tmp_CFlashUsePath;
u8 tmp_CFlashUseRomPath;
HWND OKbutton = NULL;
bool _OKbutton = false;
BOOL CALLBACK GbaSlotNone(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
@ -46,7 +47,7 @@ BOOL CALLBACK GbaSlotNone(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
case WM_INITDIALOG:
{
EnableWindow(OKbutton, TRUE);
_OKbutton = TRUE;
return TRUE;
}
}
@ -68,14 +69,13 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
CheckDlgButton(dialog, IDC_PATHDESMUME, BST_CHECKED);
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
EnableWindow(OKbutton, TRUE);
_OKbutton = TRUE;
}
else
{
EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE);
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE);
if (strlen(tmp_cflash_path))
EnableWindow(OKbutton, TRUE);
if (strlen(tmp_cflash_path)) _OKbutton = TRUE;
}
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE);
@ -86,8 +86,7 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
if (strlen(tmp_cflash_filename))
EnableWindow(OKbutton, TRUE);
if (strlen(tmp_cflash_filename)) _OKbutton = TRUE;
CheckDlgButton(dialog, IDC_RFILE, BST_CHECKED);
}
return TRUE;
@ -160,6 +159,8 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
}
case IDC_RFILE:
{
if (HIWORD(wparam) == BN_CLICKED)
{
tmp_CFlashUsePath = FALSE;
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), TRUE);
@ -171,10 +172,13 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
if (!strlen(tmp_cflash_filename))
EnableWindow(OKbutton, FALSE);
}
break;
}
case IDC_RFOLDER:
{
if (HIWORD(wparam) == BN_CLICKED)
{
tmp_CFlashUsePath = TRUE;
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
@ -195,6 +199,7 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
}
EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), TRUE);
}
break;
}
@ -232,7 +237,7 @@ BOOL CALLBACK GbaSlotRumblePak(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
{
case WM_INITDIALOG:
{
EnableWindow(OKbutton, TRUE);
_OKbutton = TRUE;
return TRUE;
}
}
@ -246,8 +251,7 @@ BOOL CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
case WM_INITDIALOG:
{
SetWindowText(GetDlgItem(dialog, IDC_PATHGAME), tmp_gbagame_filename);
if (!strlen(tmp_gbagame_filename))
EnableWindow(OKbutton, FALSE);
if (strlen(tmp_gbagame_filename) > 0) _OKbutton = true;
return TRUE;
}
case WM_COMMAND:
@ -326,10 +330,13 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
addonList[temp_type].info((char *)tmp_info);
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
_OKbutton = false;
wndConfig=CreateDialog(hAppInst, MAKEINTRESOURCE(GBAslot_IDDs[temp_type]),
dialog, (DLGPROC)GBAslot_Procs[temp_type]);
if (temp_type == 0)
if ( (temp_type == 0) || (_OKbutton) )
EnableWindow(OKbutton, TRUE);
else
EnableWindow(OKbutton, FALSE);
return TRUE;
}
@ -365,9 +372,14 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
if (temp_type != last_type)
{
if (wndConfig) DestroyWindow(wndConfig);
_OKbutton = false;
wndConfig=CreateDialog(hAppInst,
MAKEINTRESOURCE(GBAslot_IDDs[temp_type]), dialog,
(DLGPROC)GBAslot_Procs[temp_type]);
if ( (temp_type == 0) || (_OKbutton) )
EnableWindow(OKbutton, TRUE);
else
EnableWindow(OKbutton, FALSE);
u8 tmp_info[512];
addonList[temp_type].info((char *)tmp_info);
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
@ -391,6 +403,7 @@ void GBAslotDialog(HWND hwnd)
strcpy(tmp_gbagame_filename, GBAgameName);
tmp_CFlashUseRomPath = CFlashUseRomPath;
tmp_CFlashUsePath = CFlashUsePath;
_OKbutton = false;
u32 res=DialogBox(hAppInst, MAKEINTRESOURCE(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
if (res)
{

View File

@ -2419,8 +2419,8 @@ LRESULT OpenFile()
{
if (romloaded)
{
CheatsSearchReset();
NDS_UnPause(); //Restart emulation if no new rom chosen
}
return 0;
}