Watch classes - required PreviousType on Update(), not pretty, but better than relying on a hidden Global setting, and cleaner than forcing the type to be set on construction and maintaining it's state on config changes
This commit is contained in:
parent
3962049847
commit
593474b739
|
@ -137,9 +137,9 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public override void Update()
|
||||
public override void Update(PreviousType previousType)
|
||||
{
|
||||
switch (Global.Config.RamWatchDefinePrevious)
|
||||
switch (previousType)
|
||||
{
|
||||
case PreviousType.Original:
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -164,9 +163,9 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public override void Update()
|
||||
public override void Update(PreviousType previousType)
|
||||
{
|
||||
switch (Global.Config.RamWatchDefinePrevious)
|
||||
switch (previousType)
|
||||
{
|
||||
case PreviousType.Original:
|
||||
return;
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Ignore that stuff
|
||||
/// </summary>
|
||||
public override void Update()
|
||||
public override void Update(PreviousType previousType)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Updates the Watch (read it from <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public abstract void Update();
|
||||
public abstract void Update(PreviousType previousType);
|
||||
|
||||
protected byte GetByte()
|
||||
{
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace BizHawk.Client.Common
|
|||
/// <see cref="Watch"/> domain will also be refreshed
|
||||
/// </summary>
|
||||
/// <param name="core">New domains</param>
|
||||
public void RefreshDomains(IMemoryDomains core)
|
||||
public void RefreshDomains(IMemoryDomains core, PreviousType previousType)
|
||||
{
|
||||
_memoryDomains = core;
|
||||
Parallel.ForEach(_watchList, watch =>
|
||||
|
@ -246,7 +246,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
watch.Domain = core[watch.Domain.Name];
|
||||
watch.ResetPrevious();
|
||||
watch.Update();
|
||||
watch.Update(previousType);
|
||||
watch.ClearChangeCount();
|
||||
});
|
||||
}
|
||||
|
@ -254,11 +254,11 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Updates all <see cref="Watch"/> in the current collection
|
||||
/// </summary>
|
||||
public void UpdateValues()
|
||||
public void UpdateValues(PreviousType previousType)
|
||||
{
|
||||
Parallel.ForEach(_watchList, watch =>
|
||||
{
|
||||
watch.Update();
|
||||
watch.Update(previousType);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -146,9 +146,9 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public override void Update()
|
||||
public override void Update(PreviousType previousType)
|
||||
{
|
||||
switch (Global.Config.RamWatchDefinePrevious)
|
||||
switch (previousType)
|
||||
{
|
||||
case PreviousType.Original:
|
||||
return;
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
&& _watches.All(w => w.Domain == null || MemoryDomains.Select(m => m.Name).Contains(w.Domain.Name))
|
||||
&& (Config.RecentWatches.AutoLoad || (IsHandleCreated || !IsDisposed)))
|
||||
{
|
||||
_watches.RefreshDomains(MemoryDomains);
|
||||
_watches.RefreshDomains(MemoryDomains, Config.RamWatchDefinePrevious);
|
||||
_watches.Reload();
|
||||
GeneralUpdate();
|
||||
UpdateStatusBar();
|
||||
|
@ -241,7 +241,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (_watches.Any())
|
||||
{
|
||||
_watches.UpdateValues();
|
||||
_watches.UpdateValues(Config.RamWatchDefinePrevious);
|
||||
DisplayOnScreenWatches();
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.OSD.ClearRamWatches();
|
||||
if (_watches.Any())
|
||||
{
|
||||
_watches.UpdateValues();
|
||||
_watches.UpdateValues(Config.RamWatchDefinePrevious);
|
||||
DisplayOnScreenWatches();
|
||||
|
||||
if (!IsHandleCreated || IsDisposed)
|
||||
|
|
Loading…
Reference in New Issue