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>
|
/// <summary>
|
||||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Update()
|
public override void Update(PreviousType previousType)
|
||||||
{
|
{
|
||||||
switch (Global.Config.RamWatchDefinePrevious)
|
switch (previousType)
|
||||||
{
|
{
|
||||||
case PreviousType.Original:
|
case PreviousType.Original:
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using BizHawk.Common.StringExtensions;
|
using BizHawk.Common.StringExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
@ -164,9 +163,9 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Update()
|
public override void Update(PreviousType previousType)
|
||||||
{
|
{
|
||||||
switch (Global.Config.RamWatchDefinePrevious)
|
switch (previousType)
|
||||||
{
|
{
|
||||||
case PreviousType.Original:
|
case PreviousType.Original:
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ignore that stuff
|
/// Ignore that stuff
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Update()
|
public override void Update(PreviousType previousType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the Watch (read it from <see cref="MemoryDomain"/>
|
/// Updates the Watch (read it from <see cref="MemoryDomain"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Update();
|
public abstract void Update(PreviousType previousType);
|
||||||
|
|
||||||
protected byte GetByte()
|
protected byte GetByte()
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace BizHawk.Client.Common
|
||||||
/// <see cref="Watch"/> domain will also be refreshed
|
/// <see cref="Watch"/> domain will also be refreshed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="core">New domains</param>
|
/// <param name="core">New domains</param>
|
||||||
public void RefreshDomains(IMemoryDomains core)
|
public void RefreshDomains(IMemoryDomains core, PreviousType previousType)
|
||||||
{
|
{
|
||||||
_memoryDomains = core;
|
_memoryDomains = core;
|
||||||
Parallel.ForEach(_watchList, watch =>
|
Parallel.ForEach(_watchList, watch =>
|
||||||
|
@ -246,7 +246,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
watch.Domain = core[watch.Domain.Name];
|
watch.Domain = core[watch.Domain.Name];
|
||||||
watch.ResetPrevious();
|
watch.ResetPrevious();
|
||||||
watch.Update();
|
watch.Update(previousType);
|
||||||
watch.ClearChangeCount();
|
watch.ClearChangeCount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -254,11 +254,11 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates all <see cref="Watch"/> in the current collection
|
/// Updates all <see cref="Watch"/> in the current collection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateValues()
|
public void UpdateValues(PreviousType previousType)
|
||||||
{
|
{
|
||||||
Parallel.ForEach(_watchList, watch =>
|
Parallel.ForEach(_watchList, watch =>
|
||||||
{
|
{
|
||||||
watch.Update();
|
watch.Update(previousType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,9 +146,9 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Update()
|
public override void Update(PreviousType previousType)
|
||||||
{
|
{
|
||||||
switch (Global.Config.RamWatchDefinePrevious)
|
switch (previousType)
|
||||||
{
|
{
|
||||||
case PreviousType.Original:
|
case PreviousType.Original:
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
&& _watches.All(w => w.Domain == null || MemoryDomains.Select(m => m.Name).Contains(w.Domain.Name))
|
&& _watches.All(w => w.Domain == null || MemoryDomains.Select(m => m.Name).Contains(w.Domain.Name))
|
||||||
&& (Config.RecentWatches.AutoLoad || (IsHandleCreated || !IsDisposed)))
|
&& (Config.RecentWatches.AutoLoad || (IsHandleCreated || !IsDisposed)))
|
||||||
{
|
{
|
||||||
_watches.RefreshDomains(MemoryDomains);
|
_watches.RefreshDomains(MemoryDomains, Config.RamWatchDefinePrevious);
|
||||||
_watches.Reload();
|
_watches.Reload();
|
||||||
GeneralUpdate();
|
GeneralUpdate();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
@ -241,7 +241,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (_watches.Any())
|
if (_watches.Any())
|
||||||
{
|
{
|
||||||
_watches.UpdateValues();
|
_watches.UpdateValues(Config.RamWatchDefinePrevious);
|
||||||
DisplayOnScreenWatches();
|
DisplayOnScreenWatches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GlobalWin.OSD.ClearRamWatches();
|
GlobalWin.OSD.ClearRamWatches();
|
||||||
if (_watches.Any())
|
if (_watches.Any())
|
||||||
{
|
{
|
||||||
_watches.UpdateValues();
|
_watches.UpdateValues(Config.RamWatchDefinePrevious);
|
||||||
DisplayOnScreenWatches();
|
DisplayOnScreenWatches();
|
||||||
|
|
||||||
if (!IsHandleCreated || IsDisposed)
|
if (!IsHandleCreated || IsDisposed)
|
||||||
|
|
Loading…
Reference in New Issue