win32: fix the most egregious cheats bugs for large cheat values

This commit is contained in:
zeromus 2009-12-08 07:50:58 +00:00
parent d248ef5cfd
commit 0b6c04c04b
2 changed files with 9 additions and 5 deletions

View File

@ -744,13 +744,17 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename)
loadrom(path.path);
}
else if ( !strcasecmp(path.extension().c_str(), "nds")) {
type = ROM_NDS;
loadrom(path.path); //n.b. this does nothing if the file can't be found (i.e. if it was an extracted tempfile)...
//...but since the data was extracted to gameInfo then it is ok
type = ROM_NDS;
}
//ds.gba in archives, it's already been loaded into memory at this point
else if (path.isdsgba(std::string(logicalFilename))) {
type = ROM_DSGBA;
} else {
//well, try to load it as an nds rom anyway
type = ROM_NDS;
loadrom(path.path);
}
if(type == ROM_DSGBA)

View File

@ -195,7 +195,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
memset(editBuf, 0, sizeof(editBuf));
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 10);
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 10);
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 11);
CheckDlgButton(dialog, IDC_CHECK1, BST_CHECKED);
CheckDlgButton(dialog, searchSizeIDDs[searchAddSize], BST_CHECKED);
@ -217,7 +217,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
{
oldEditProc = saveOldEditProc;
searchAddAddress = tmp_addr;
searchAddValue = atol(editBuf[1]);
searchAddValue = strtoul(editBuf[1],NULL,10);
EndDialog(dialog, TRUE);
}
@ -258,14 +258,14 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
{
if (HIWORD(wparam) == EN_UPDATE)
{
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 10);
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 11);
if ( (strlen(editBuf[0]) < 6) || (!strlen(editBuf[1])) )
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
u32 val = atol(editBuf[1]);
u32 val = strtoul(editBuf[1],NULL,10);
if (val > searchRange[searchAddSize][1])
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);