From 70a9b535f5b0599dd32077bb6edf4febd4ad27e4 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 30 Nov 2014 17:51:16 +0000 Subject: [PATCH] check HasSavestates() on some save and loadstate calls that can be accessed via lua (and other stuff) --- BizHawk.Client.EmuHawk/MainForm.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index c4fc2a6829..5450c1192e 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2492,6 +2492,11 @@ namespace BizHawk.Client.EmuHawk 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 bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords; @@ -2525,7 +2530,7 @@ namespace BizHawk.Client.EmuHawk public void LoadQuickSave(string quickSlotName, bool fromLua = false) { - if (Global.Emulator.IsNull()) + if (!Global.Emulator.HasSavestates()) { return; } @@ -2542,6 +2547,11 @@ namespace BizHawk.Client.EmuHawk public void SaveState(string path, string userFriendlyStateName, bool fromLua) { + if (!Global.Emulator.HasSavestates()) + { + return; + } + try { SavestateManager.SaveStateFile(path, userFriendlyStateName); @@ -3362,7 +3372,7 @@ namespace BizHawk.Client.EmuHawk // TODO: should backup logic be stuffed in into Client.Common.SaveStateManager? public void SaveQuickSave(string quickSlotName) { - if (Global.Emulator.IsNull()) + if (!Global.Emulator.HasSavestates()) { return; }