This commit is contained in:
alyosha-tas 2020-05-25 22:34:18 -04:00
commit 3a2aae61aa
7 changed files with 8 additions and 14 deletions

View File

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

View File

@ -133,8 +133,6 @@ namespace BizHawk.Client.Common
if (cheat != (Cheat)null) if (cheat != (Cheat)null)
{ {
cheat.PokeValue(val); cheat.PokeValue(val);
PokeByte(val);
return true;
} }
} }

View File

@ -158,8 +158,6 @@ namespace BizHawk.Client.Common
if (cheat != (Cheat)null) if (cheat != (Cheat)null)
{ {
cheat.PokeValue((int)val); cheat.PokeValue((int)val);
PokeDWord(val);
return true;
} }
} }

View File

@ -141,8 +141,6 @@ namespace BizHawk.Client.Common
if (cheat != (Cheat)null) if (cheat != (Cheat)null)
{ {
cheat.PokeValue(val); cheat.PokeValue(val);
PokeWord(val);
return true;
} }
} }

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
private void LoadCheats(string filename, string archive = null) 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>(); Tools.Load<Cheats>();
} }

View File

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

View File

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