move UserBag from Global to GlobalWin

This commit is contained in:
adelikat 2020-05-31 15:01:28 -05:00
parent 8888bd130a
commit c20e4964c6
4 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common;
// ReSharper disable StyleCop.SA1401
namespace BizHawk.Client.Common
@ -11,6 +10,5 @@ namespace BizHawk.Client.Common
public static FirmwareManager FirmwareManager { get; set; }
public static IMovieSession MovieSession { get; set; }
public static InputManager InputManager { get; } = new InputManager();
public static Dictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();
}
}

View File

@ -13,15 +13,15 @@ namespace BizHawk.Client.EmuHawk
var t = value.GetType();
if (!t.IsPrimitive && t != typeof(string)) throw new InvalidOperationException("Invalid type for userdata");
}
Global.UserBag[name] = value;
GlobalWin.UserBag[name] = value;
}
public object Get(string key) => Global.UserBag.TryGetValue(key, out var value) ? value : null;
public object Get(string key) => GlobalWin.UserBag.TryGetValue(key, out var value) ? value : null;
public void Clear() => Global.UserBag.Clear();
public void Clear() => GlobalWin.UserBag.Clear();
public bool Remove(string key) => Global.UserBag.Remove(key);
public bool Remove(string key) => GlobalWin.UserBag.Remove(key);
public bool ContainsKey(string key) => Global.UserBag.ContainsKey(key);
public bool ContainsKey(string key) => GlobalWin.UserBag.ContainsKey(key);
}
}

View File

@ -1,6 +1,7 @@
using BizHawk.Bizware.BizwareGL;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using System.Collections.Generic;
// ReSharper disable StyleCop.SA1401
namespace BizHawk.Client.EmuHawk
@ -38,5 +39,7 @@ namespace BizHawk.Client.EmuHawk
/// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind).
/// </summary>
public static bool DisableSecondaryThrottling { get; set; }
public static Dictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();
}
}

View File

@ -3981,7 +3981,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
if (new SavestateFile(Emulator, MovieSession, Global.UserBag).Load(path))
if (new SavestateFile(Emulator, MovieSession, GlobalWin.UserBag).Load(path))
{
GlobalWin.OSD.ClearGuiText();
ClientApi.OnStateLoaded(this, userFriendlyStateName);
@ -4058,7 +4058,7 @@ namespace BizHawk.Client.EmuHawk
try
{
new SavestateFile(Emulator, MovieSession, Global.UserBag).Create(path, Config.Savestates);
new SavestateFile(Emulator, MovieSession, GlobalWin.UserBag).Create(path, Config.Savestates);
ClientApi.OnStateSaved(this, userFriendlyStateName);