CheatList - pass in the DisableCheatsOnLoad config value

This commit is contained in:
adelikat 2020-05-25 19:41:42 -05:00
parent 6da864f4f7
commit 0d12d5a819
4 changed files with 8 additions and 8 deletions

View File

@ -72,10 +72,10 @@ namespace BizHawk.Client.Common
/// <summary>
/// Looks for a .cht file that matches the ROM loaded based on the default filename for a given ROM
/// </summary>
public bool AttemptToLoadCheatFile(IMemoryDomains domains)
public bool AttemptToLoadCheatFile(IMemoryDomains domains, bool disable)
{
var file = new FileInfo(_defaultFileName);
return file.Exists && Load(domains, file.FullName, false);
return file.Exists && Load(domains, file.FullName, disable, false);
}
public void NewList(string defaultFileName, bool autosave = false)
@ -321,7 +321,7 @@ namespace BizHawk.Client.Common
}
}
public bool Load(IMemoryDomains domains, string path, bool append)
public bool Load(IMemoryDomains domains, string path, bool disable, bool append)
{
var file = new FileInfo(path);
if (file.Exists == false)
@ -405,7 +405,7 @@ namespace BizHawk.Client.Common
bigEndian,
name);
Add(new Cheat(watch, value, compare, !Global.Config.DisableCheatsOnLoad && enabled, comparisonType));
Add(new Cheat(watch, value, compare, !disable && enabled, comparisonType));
}
}
catch

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
private void LoadCheats(string filename, string archive = null)
{
CheatList.Load(Emulator.AsMemoryDomains(), filename, false);
CheatList.Load(Emulator.AsMemoryDomains(), filename, Config.DisableCheatsOnLoad, false);
Tools.Load<Cheats>();
}

View File

@ -3751,7 +3751,7 @@ namespace BizHawk.Client.EmuHawk
if (Config.LoadCheatFileByGame && Emulator.HasMemoryDomains())
{
CheatList.SetDefaultFileName(Tools.GenerateDefaultCheatFilename());
if (CheatList.AttemptToLoadCheatFile(Emulator.AsMemoryDomains()))
if (CheatList.AttemptToLoadCheatFile(Emulator.AsMemoryDomains(), Config.DisableCheatsOnLoad))
{
AddOnScreenMessage("Cheats file loaded");
}

View File

@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
var askResult = !Global.CheatList.Changes || AskSaveChanges();
if (askResult)
{
var loadResult = Global.CheatList.Load(Core, path, append: false);
var loadResult = Global.CheatList.Load(Core, path, Config.DisableCheatsOnLoad, append: false);
if (!loadResult)
{
Config.RecentCheats.HandleLoadError(path);
@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
if (result)
{
Global.CheatList.Load(Core, file.FullName, append);
Global.CheatList.Load(Core, file.FullName, Config.DisableCheatsOnLoad, append);
GeneralUpdate();
UpdateMessageLabel();
Config.RecentCheats.Add(Global.CheatList.CurrentFileName);