check HasSavestates() on some save and loadstate calls that can be accessed via lua (and other stuff)

This commit is contained in:
adelikat 2014-11-30 17:51:16 +00:00
parent 65249ad0f9
commit 70a9b535f5
1 changed files with 12 additions and 2 deletions

View File

@ -2492,6 +2492,11 @@ namespace BizHawk.Client.EmuHawk
public void LoadState(string path, string userFriendlyStateName, bool fromLua = false) // Move to client.common public void LoadState(string path, string userFriendlyStateName, bool fromLua = false) // Move to client.common
{ {
if (!Global.Emulator.HasSavestates())
{
return;
}
// If from lua, disable counting rerecords // If from lua, disable counting rerecords
bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords; bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords;
@ -2525,7 +2530,7 @@ namespace BizHawk.Client.EmuHawk
public void LoadQuickSave(string quickSlotName, bool fromLua = false) public void LoadQuickSave(string quickSlotName, bool fromLua = false)
{ {
if (Global.Emulator.IsNull()) if (!Global.Emulator.HasSavestates())
{ {
return; return;
} }
@ -2542,6 +2547,11 @@ namespace BizHawk.Client.EmuHawk
public void SaveState(string path, string userFriendlyStateName, bool fromLua) public void SaveState(string path, string userFriendlyStateName, bool fromLua)
{ {
if (!Global.Emulator.HasSavestates())
{
return;
}
try try
{ {
SavestateManager.SaveStateFile(path, userFriendlyStateName); SavestateManager.SaveStateFile(path, userFriendlyStateName);
@ -3362,7 +3372,7 @@ namespace BizHawk.Client.EmuHawk
// TODO: should backup logic be stuffed in into Client.Common.SaveStateManager? // TODO: should backup logic be stuffed in into Client.Common.SaveStateManager?
public void SaveQuickSave(string quickSlotName) public void SaveQuickSave(string quickSlotName)
{ {
if (Global.Emulator.IsNull()) if (!Global.Emulator.HasSavestates())
{ {
return; return;
} }