ToolManager - remove CloseIfDisposed, it was only being called when a tool is specifically told to restart by client code, seems like a vestigial hack workaround to cleanup improperly closed things if they are called upon. Add in the Ram Watch hack to UpdateValues<T>. All of this fixes Ram Watch autoload when the on screen display option is checked

This commit is contained in:
adelikat 2015-01-02 15:27:54 +00:00
parent 38c1ffa1e9
commit aea17282cc
1 changed files with 5 additions and 12 deletions

View File

@ -338,11 +338,14 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public void UpdateValues<T>() where T : IToolForm
{
CloseIfDisposed<T>();
var tool = _tools.FirstOrDefault(x => x is T);
if (tool != null)
{
tool.UpdateValues();
if (!tool.IsDisposed ||
(tool is RamWatch && Global.Config.DisplayRamWatch)) // Ram Watch hack, on screen display should run even if Ram Watch is closed
{
tool.UpdateValues();
}
}
}
@ -385,7 +388,6 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public void Restart<T>() where T : IToolForm
{
CloseIfDisposed<T>();
var tool = _tools.FirstOrDefault(x => x is T);
if (tool != null)
{
@ -475,15 +477,6 @@ namespace BizHawk.Client.EmuHawk
return tool;
}
private void CloseIfDisposed<T>() where T : IToolForm
{
var existingTool = _tools.FirstOrDefault(x => x is T);
if (existingTool != null && existingTool.IsDisposed)
{
Close<T>();
}
}
public void UpdateToolsBefore(bool fromLua = false)
{
if (Has<LuaConsole>())