Warn when freezing >200 addresses at once (resolves #1155)
This commit is contained in:
parent
e23a2df7e0
commit
be13c08959
|
@ -24,13 +24,16 @@ namespace BizHawk.Client.Common
|
||||||
private const string TypeColumn = "DisplayTypeColumn";
|
private const string TypeColumn = "DisplayTypeColumn";
|
||||||
private const string ComparisonType = "ComparisonTypeColumn";
|
private const string ComparisonType = "ComparisonTypeColumn";
|
||||||
|
|
||||||
|
private readonly IDialogParent _dialogParent;
|
||||||
|
|
||||||
private readonly ICheatConfig _config;
|
private readonly ICheatConfig _config;
|
||||||
private List<Cheat> _cheatList = new List<Cheat>();
|
private List<Cheat> _cheatList = new List<Cheat>();
|
||||||
private string _defaultFileName = "";
|
private string _defaultFileName = "";
|
||||||
private bool _changes;
|
private bool _changes;
|
||||||
|
|
||||||
public CheatCollection(ICheatConfig config)
|
public CheatCollection(IDialogParent dialogParent, ICheatConfig config)
|
||||||
{
|
{
|
||||||
|
_dialogParent = dialogParent;
|
||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +134,11 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void AddRange(IEnumerable<Cheat> cheats)
|
public void AddRange(IEnumerable<Cheat> cheats)
|
||||||
{
|
{
|
||||||
_cheatList.AddRange(
|
var toAdd = cheats.Where(c => !_cheatList.Contains(c)).ToList();
|
||||||
cheats.Where(c => !_cheatList.Contains(c)));
|
if (toAdd.Count is 0) return;
|
||||||
|
const int WARN_WHEN_ADDING_MORE_THAN = 200;
|
||||||
|
if (toAdd.Count > WARN_WHEN_ADDING_MORE_THAN && !_dialogParent.ModalMessageBox2($"Adding {toAdd.Count} freezes/cheats at once is probably a bad idea. Do it anyway?")) return;
|
||||||
|
_cheatList.AddRange(toAdd);
|
||||||
Changes = true;
|
Changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
Sound.StartSound();
|
Sound.StartSound();
|
||||||
InputManager.SyncControls(Emulator, MovieSession, Config);
|
InputManager.SyncControls(Emulator, MovieSession, Config);
|
||||||
CheatList = new CheatCollection(Config.Cheats);
|
CheatList = new CheatCollection(this, Config.Cheats);
|
||||||
CheatList.Changed += Tools.UpdateCheatRelatedTools;
|
CheatList.Changed += Tools.UpdateCheatRelatedTools;
|
||||||
RewireSound();
|
RewireSound();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue