win32: dont crash when dragdropping a savestate while no rom is loaded. its tacky. and fix a couple of warnings

This commit is contained in:
zeromus 2010-08-30 03:34:42 +00:00
parent d617c0141b
commit e1901a2f08
2 changed files with 10 additions and 7 deletions

View File

@ -1407,7 +1407,7 @@ INT_PTR CALLBACK CheatsExportProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpa
lvi.iItem = INT_MAX; lvi.iItem = INT_MAX;
SendMessage(exportListView, WM_SETREDRAW, (WPARAM)FALSE,0); SendMessage(exportListView, WM_SETREDRAW, (WPARAM)FALSE,0);
for (int i = 0; i < cheatsExport->getCheatsNum(); i++) for (u32 i = 0; i < cheatsExport->getCheatsNum(); i++)
{ {
CHEATS_LIST *tmp = (CHEATS_LIST*)cheatsExport->getCheats(); CHEATS_LIST *tmp = (CHEATS_LIST*)cheatsExport->getCheats();
lvi.pszText= tmp[i].description; lvi.pszText= tmp[i].description;
@ -1428,7 +1428,7 @@ INT_PTR CALLBACK CheatsExportProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpa
if (count > 0) if (count > 0)
{ {
u32 prev = ListView_GetNextItem(exportListView, -1, LVIS_SELECTED); u32 prev = ListView_GetNextItem(exportListView, -1, LVIS_SELECTED);
for (int i = 0; i < count; i++) for (u32 i = 0; i < count; i++)
{ {
CHEATS_LIST *tmp = (CHEATS_LIST*)cheatsExport->getCheats(); CHEATS_LIST *tmp = (CHEATS_LIST*)cheatsExport->getCheats();
cheats->add_AR_Direct(tmp[prev]); cheats->add_AR_Direct(tmp[prev]);

View File

@ -4379,6 +4379,8 @@ DOKEYDOWN:
//Check if Savestate file //Check if Savestate file
//------------------------------------------------------- //-------------------------------------------------------
else if (!(fileDropped.find(".ds") == string::npos)) else if (!(fileDropped.find(".ds") == string::npos))
{
if(romloaded)
{ {
size_t extIndex = fileDropped.find(".ds"); size_t extIndex = fileDropped.find(".ds");
if (extIndex <= fileDropped.length()-4) //Check to see it is both at the end (file extension) and there is on more character if (extIndex <= fileDropped.length()-4) //Check to see it is both at the end (file extension) and there is on more character
@ -4390,6 +4392,7 @@ DOKEYDOWN:
} }
} }
} }
}
//------------------------------------------------------- //-------------------------------------------------------
//Check if Lua script file //Check if Lua script file