move Global.Config to GlobalWin.Config
This commit is contained in:
parent
5ab7f1a18e
commit
664c829a30
|
@ -5,7 +5,6 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public static class Global
|
||||
{
|
||||
public static Config Config { get; set; }
|
||||
public static GameInfo Game { get; set; }
|
||||
public static FirmwareManager FirmwareManager { get; set; }
|
||||
public static IMovieSession MovieSession { get; set; }
|
||||
|
|
|
@ -736,7 +736,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (result)
|
||||
{
|
||||
// save to config and return it
|
||||
Global.Config.AviCodecToken = ret.Serialize();
|
||||
GlobalWin.Config.AviCodecToken = ret.Serialize();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -967,10 +967,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="Exception">no default codec token in config</exception>
|
||||
public void SetDefaultVideoCodecToken()
|
||||
{
|
||||
CodecToken ct = CodecToken.DeSerialize(Global.Config.AviCodecToken);
|
||||
CodecToken ct = CodecToken.DeSerialize(GlobalWin.Config.AviCodecToken);
|
||||
if (ct == null)
|
||||
{
|
||||
throw new Exception($"No default {nameof(Global.Config.AviCodecToken)} in config!");
|
||||
throw new Exception($"No default {nameof(GlobalWin.Config.AviCodecToken)} in config!");
|
||||
}
|
||||
|
||||
_currVideoCodecToken = ct;
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
foreach (var fp in fps)
|
||||
{
|
||||
if (fp.ToString() == Global.Config.FFmpegFormat)
|
||||
if (fp.ToString() == GlobalWin.Config.FFmpegFormat)
|
||||
{
|
||||
if (fp.Custom)
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Custom = custom;
|
||||
|
||||
Commandline = Custom
|
||||
? Global.Config.FFmpegCustomCommand
|
||||
? GlobalWin.Config.FFmpegCustomCommand
|
||||
: commandline;
|
||||
|
||||
DeduceFormat(Commandline);
|
||||
|
@ -155,7 +155,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
FFmpegWriterForm dlg = new FFmpegWriterForm();
|
||||
dlg.listBox1.Items.AddRange(FormatPreset.GetPresets());
|
||||
|
||||
int i = dlg.listBox1.FindStringExact(Global.Config.FFmpegFormat);
|
||||
int i = dlg.listBox1.FindStringExact(GlobalWin.Config.FFmpegFormat);
|
||||
if (i != ListBox.NoMatches)
|
||||
{
|
||||
dlg.listBox1.SelectedIndex = i;
|
||||
|
@ -171,11 +171,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
else
|
||||
{
|
||||
ret = (FormatPreset)dlg.listBox1.SelectedItem;
|
||||
Global.Config.FFmpegFormat = ret.ToString();
|
||||
GlobalWin.Config.FFmpegFormat = ret.ToString();
|
||||
if (ret.Custom)
|
||||
{
|
||||
ret.Commandline =
|
||||
Global.Config.FFmpegCustomCommand =
|
||||
GlobalWin.Config.FFmpegCustomCommand =
|
||||
dlg.textBox1.Text;
|
||||
|
||||
ret.DeduceFormat(ret.Commandline);
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return new GifToken(0, 0)
|
||||
{
|
||||
Frameskip = Global.Config.GifWriterFrameskip,
|
||||
FrameDelay = Global.Config.GifWriterDelay
|
||||
Frameskip = GlobalWin.Config.GifWriterFrameskip,
|
||||
FrameDelay = GlobalWin.Config.GifWriterDelay
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,16 +15,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
using var dlg = new GifWriterForm
|
||||
{
|
||||
numericUpDown1 = { Value = Global.Config.GifWriterFrameskip },
|
||||
numericUpDown2 = { Value = Global.Config.GifWriterDelay }
|
||||
numericUpDown1 = { Value = GlobalWin.Config.GifWriterFrameskip },
|
||||
numericUpDown2 = { Value = GlobalWin.Config.GifWriterDelay }
|
||||
};
|
||||
dlg.NumericUpDown2_ValueChanged(null, null);
|
||||
|
||||
var result = dlg.ShowDialog(parent);
|
||||
if (result.IsOk())
|
||||
{
|
||||
Global.Config.GifWriterFrameskip = (int)dlg.numericUpDown1.Value;
|
||||
Global.Config.GifWriterDelay = (int)dlg.numericUpDown2.Value;
|
||||
GlobalWin.Config.GifWriterFrameskip = (int)dlg.numericUpDown1.Value;
|
||||
GlobalWin.Config.GifWriterDelay = (int)dlg.numericUpDown2.Value;
|
||||
|
||||
return GifWriter.GifToken.LoadFromConfig();
|
||||
}
|
||||
|
|
|
@ -535,15 +535,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
var ret = new CodecToken();
|
||||
|
||||
// load from config and sanitize
|
||||
int t = Math.Min(Math.Max(Global.Config.JmdThreads, 1), 6);
|
||||
int t = Math.Min(Math.Max(GlobalWin.Config.JmdThreads, 1), 6);
|
||||
|
||||
int c = Math.Min(Math.Max(Global.Config.JmdCompression, Deflater.NO_COMPRESSION), Deflater.BEST_COMPRESSION);
|
||||
int c = Math.Min(Math.Max(GlobalWin.Config.JmdCompression, Deflater.NO_COMPRESSION), Deflater.BEST_COMPRESSION);
|
||||
|
||||
if (!JmdForm.DoCompressionDlg(ref t, ref c, 1, 6, Deflater.NO_COMPRESSION, Deflater.BEST_COMPRESSION, hwnd))
|
||||
return null;
|
||||
|
||||
Global.Config.JmdThreads = ret.NumThreads = t;
|
||||
Global.Config.JmdCompression = ret.CompressionLevel = c;
|
||||
GlobalWin.Config.JmdThreads = ret.NumThreads = t;
|
||||
GlobalWin.Config.JmdCompression = ret.CompressionLevel = c;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -784,9 +784,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
CodecToken ct = new CodecToken();
|
||||
|
||||
// load from config and sanitize
|
||||
int t = Math.Min(Math.Max(Global.Config.JmdThreads, 1), 6);
|
||||
int t = Math.Min(Math.Max(GlobalWin.Config.JmdThreads, 1), 6);
|
||||
|
||||
int c = Math.Min(Math.Max(Global.Config.JmdCompression, Deflater.NO_COMPRESSION), Deflater.BEST_COMPRESSION);
|
||||
int c = Math.Min(Math.Max(GlobalWin.Config.JmdCompression, Deflater.NO_COMPRESSION), Deflater.BEST_COMPRESSION);
|
||||
|
||||
ct.CompressionLevel = c;
|
||||
ct.NumThreads = t;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var ofd = new OpenFileDialog
|
||||
{
|
||||
FileName = $"{Global.Game.FilesystemSafeName()}.syncless.txt",
|
||||
InitialDirectory = Global.Config.PathEntries.AvAbsolutePath()
|
||||
InitialDirectory = GlobalWin.Config.PathEntries.AvAbsolutePath()
|
||||
};
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.Cancel)
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// Load a savestate specified by its name
|
||||
/// </summary>
|
||||
/// <param name="name">Savestate friendly name</param>
|
||||
public static void LoadState(string name) => GlobalWin.MainForm.LoadState(Path.Combine(Global.Config.PathEntries.SaveStateAbsolutePath(Global.Game.System), $"{name}.State"), name, suppressOSD: false);
|
||||
public static void LoadState(string name) => GlobalWin.MainForm.LoadState(Path.Combine(GlobalWin.Config.PathEntries.SaveStateAbsolutePath(Global.Game.System), $"{name}.State"), name, suppressOSD: false);
|
||||
|
||||
/// <summary>
|
||||
/// Raised before a quickload is done (just after pressing shortcut button)
|
||||
|
@ -202,7 +202,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// Save a state with specified name
|
||||
/// </summary>
|
||||
/// <param name="name">Savestate friendly name</param>
|
||||
public static void SaveState(string name) => GlobalWin.MainForm.SaveState(Path.Combine(Global.Config.PathEntries.SaveStateAbsolutePath(Global.Game.System), $"{name}.State"), name, fromLua: false);
|
||||
public static void SaveState(string name) => GlobalWin.MainForm.SaveState(Path.Combine(GlobalWin.Config.PathEntries.SaveStateAbsolutePath(Global.Game.System), $"{name}.State"), name, fromLua: false);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements
|
||||
|
@ -319,7 +319,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static void CloseRom() => GlobalWin.MainForm.CloseRom();
|
||||
|
||||
public static void DisplayMessages(bool value) => Global.Config.DisplayMessages = value;
|
||||
public static void DisplayMessages(bool value) => GlobalWin.Config.DisplayMessages = value;
|
||||
|
||||
public static void EnableRewind(bool enabled) => GlobalWin.MainForm.EnableRewind(enabled);
|
||||
|
||||
|
@ -327,7 +327,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (numFrames > 0)
|
||||
{
|
||||
Global.Config.FrameSkip = numFrames;
|
||||
GlobalWin.Config.FrameSkip = numFrames;
|
||||
GlobalWin.MainForm.FrameSkipMessage();
|
||||
}
|
||||
else
|
||||
|
@ -336,16 +336,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public static int GetTargetScanlineIntensity() => Global.Config.TargetScanlineFilterIntensity;
|
||||
public static int GetTargetScanlineIntensity() => GlobalWin.Config.TargetScanlineFilterIntensity;
|
||||
|
||||
public static int GetWindowSize() => Global.Config.TargetZoomFactors[Emulator.SystemId];
|
||||
public static int GetWindowSize() => GlobalWin.Config.TargetZoomFactors[Emulator.SystemId];
|
||||
|
||||
public static void SetSoundOn(bool enable)
|
||||
{
|
||||
if (enable != Global.Config.SoundEnabled) GlobalWin.MainForm.ToggleSound();
|
||||
if (enable != GlobalWin.Config.SoundEnabled) GlobalWin.MainForm.ToggleSound();
|
||||
}
|
||||
|
||||
public static bool GetSoundOn() => Global.Config.SoundEnabled;
|
||||
public static bool GetSoundOn() => GlobalWin.Config.SoundEnabled;
|
||||
|
||||
public static bool IsPaused() => GlobalWin.MainForm.EmulatorPaused;
|
||||
|
||||
|
@ -373,9 +373,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static void ScreenshotToClipboard() => GlobalWin.MainForm.TakeScreenshotToClipboard();
|
||||
|
||||
public static void SetTargetScanlineIntensity(int val) => Global.Config.TargetScanlineFilterIntensity = val;
|
||||
public static void SetTargetScanlineIntensity(int val) => GlobalWin.Config.TargetScanlineFilterIntensity = val;
|
||||
|
||||
public static void SetScreenshotOSD(bool value) => Global.Config.ScreenshotCaptureOsd = value;
|
||||
public static void SetScreenshotOSD(bool value) => GlobalWin.Config.ScreenshotCaptureOsd = value;
|
||||
|
||||
public static int ScreenWidth() => GlobalWin.MainForm.PresentationPanel.NativeSize.Width;
|
||||
|
||||
|
@ -383,7 +383,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10)
|
||||
{
|
||||
Global.Config.TargetZoomFactors[Emulator.SystemId] = size;
|
||||
GlobalWin.Config.TargetZoomFactors[Emulator.SystemId] = size;
|
||||
GlobalWin.MainForm.FrameBufferResized();
|
||||
GlobalWin.OSD.AddMessage($"Window size set to {size}x");
|
||||
}
|
||||
|
|
|
@ -46,13 +46,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private readonly Action<string> LogCallback;
|
||||
|
||||
/// <summary>Using this property to get a reference to <see cref="Global.Config">Global.Config</see> is a terrible, horrible, no good, very bad idea. That's why it's not in the <see cref="IEmu">interface</see>.</summary>
|
||||
/// <summary>Using this property to get a reference to <see cref="GlobalWin.Config">GlobalWin.Config</see> is a terrible, horrible, no good, very bad idea. That's why it's not in the <see cref="IEmu">interface</see>.</summary>
|
||||
public Config ForbiddenConfigReference
|
||||
{
|
||||
get
|
||||
{
|
||||
ForbiddenConfigReferenceUsed = true;
|
||||
return Global.Config;
|
||||
return GlobalWin.Config;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public Action YieldCallback { get; set; }
|
||||
|
||||
public void DisplayVsync(bool enabled) => Global.Config.VSync = enabled;
|
||||
public void DisplayVsync(bool enabled) => GlobalWin.Config.VSync = enabled;
|
||||
|
||||
public void FrameAdvance() => FrameAdvanceCallback();
|
||||
|
||||
|
@ -173,9 +173,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
else LogCallback($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
|
||||
}
|
||||
|
||||
public void LimitFramerate(bool enabled) => Global.Config.ClockThrottle = enabled;
|
||||
public void LimitFramerate(bool enabled) => GlobalWin.Config.ClockThrottle = enabled;
|
||||
|
||||
public void MinimizeFrameskip(bool enabled) => Global.Config.AutoMinimizeSkipping = enabled;
|
||||
public void MinimizeFrameskip(bool enabled) => GlobalWin.Config.AutoMinimizeSkipping = enabled;
|
||||
|
||||
public void Yield() => YieldCallback();
|
||||
|
||||
|
|
|
@ -188,11 +188,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void RefreshUserShader()
|
||||
{
|
||||
ShaderChain_user?.Dispose();
|
||||
if (File.Exists(Global.Config.DispUserFilterPath))
|
||||
if (File.Exists(GlobalWin.Config.DispUserFilterPath))
|
||||
{
|
||||
var fi = new FileInfo(Global.Config.DispUserFilterPath);
|
||||
var fi = new FileInfo(GlobalWin.Config.DispUserFilterPath);
|
||||
using var stream = fi.OpenRead();
|
||||
ShaderChain_user = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.GetDirectoryName(Global.Config.DispUserFilterPath));
|
||||
ShaderChain_user = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.GetDirectoryName(GlobalWin.Config.DispUserFilterPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,10 +217,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
// apply user's crop selections as a negative padding (believe it or not, this largely works)
|
||||
// is there an issue with the aspect ratio? I don't know--but if there is, there would be with the padding too
|
||||
padding.Left -= Global.Config.DispCropLeft;
|
||||
padding.Right -= Global.Config.DispCropRight;
|
||||
padding.Top -= Global.Config.DispCropTop;
|
||||
padding.Bottom -= Global.Config.DispCropBottom;
|
||||
padding.Left -= GlobalWin.Config.DispCropLeft;
|
||||
padding.Right -= GlobalWin.Config.DispCropRight;
|
||||
padding.Top -= GlobalWin.Config.DispCropTop;
|
||||
padding.Bottom -= GlobalWin.Config.DispCropBottom;
|
||||
|
||||
return padding;
|
||||
}
|
||||
|
@ -230,18 +230,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
// select user special FX shader chain
|
||||
var selectedChainProperties = new Dictionary<string, object>();
|
||||
Filters.RetroShaderChain selectedChain = null;
|
||||
if (Global.Config.TargetDisplayFilter == 1 && ShaderChain_hq2x != null && ShaderChain_hq2x.Available)
|
||||
if (GlobalWin.Config.TargetDisplayFilter == 1 && ShaderChain_hq2x != null && ShaderChain_hq2x.Available)
|
||||
{
|
||||
selectedChain = ShaderChain_hq2x;
|
||||
}
|
||||
|
||||
if (Global.Config.TargetDisplayFilter == 2 && ShaderChain_scanlines != null && ShaderChain_scanlines.Available)
|
||||
if (GlobalWin.Config.TargetDisplayFilter == 2 && ShaderChain_scanlines != null && ShaderChain_scanlines.Available)
|
||||
{
|
||||
selectedChain = ShaderChain_scanlines;
|
||||
selectedChainProperties["uIntensity"] = 1.0f - Global.Config.TargetScanlineFilterIntensity / 256.0f;
|
||||
selectedChainProperties["uIntensity"] = 1.0f - GlobalWin.Config.TargetScanlineFilterIntensity / 256.0f;
|
||||
}
|
||||
|
||||
if (Global.Config.TargetDisplayFilter == 3 && ShaderChain_user != null && ShaderChain_user.Available)
|
||||
if (GlobalWin.Config.TargetDisplayFilter == 3 && ShaderChain_user != null && ShaderChain_user.Available)
|
||||
{
|
||||
selectedChain = ShaderChain_user;
|
||||
}
|
||||
|
@ -306,9 +306,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
AppendLuaLayer(chain, "emu");
|
||||
|
||||
if(includeUserFilters)
|
||||
if (Global.Config.DispPrescale != 1)
|
||||
if (GlobalWin.Config.DispPrescale != 1)
|
||||
{
|
||||
var fPrescale = new Filters.PrescaleFilter() { Scale = Global.Config.DispPrescale };
|
||||
var fPrescale = new Filters.PrescaleFilter() { Scale = GlobalWin.Config.DispPrescale };
|
||||
chain.AddFilter(fPrescale, "user_prescale");
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
AppendRetroShaderChain(chain, "retroShader", selectedChain, selectedChainProperties);
|
||||
|
||||
// AutoPrescale makes no sense for a None final filter
|
||||
if (Global.Config.DispAutoPrescale && Global.Config.DispFinalFilter != (int)Filters.FinalPresentation.eFilterOption.None)
|
||||
if (GlobalWin.Config.DispAutoPrescale && GlobalWin.Config.DispFinalFilter != (int)Filters.FinalPresentation.eFilterOption.None)
|
||||
{
|
||||
var apf = new Filters.AutoPrescaleFilter();
|
||||
chain.AddFilter(apf, "auto_prescale");
|
||||
|
@ -325,12 +325,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
//choose final filter
|
||||
var finalFilter = Filters.FinalPresentation.eFilterOption.None;
|
||||
if (Global.Config.DispFinalFilter == 1)
|
||||
if (GlobalWin.Config.DispFinalFilter == 1)
|
||||
{
|
||||
finalFilter = Filters.FinalPresentation.eFilterOption.Bilinear;
|
||||
}
|
||||
|
||||
if (Global.Config.DispFinalFilter == 2)
|
||||
if (GlobalWin.Config.DispFinalFilter == 2)
|
||||
{
|
||||
finalFilter = Filters.FinalPresentation.eFilterOption.Bicubic;
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public void UpdateSource(IVideoProvider videoProvider)
|
||||
{
|
||||
bool displayNothing = Global.Config.DispSpeedupFeatures == 0;
|
||||
bool displayNothing = GlobalWin.Config.DispSpeedupFeatures == 0;
|
||||
var job = new JobInfo
|
||||
{
|
||||
VideoProvider = videoProvider,
|
||||
|
@ -472,7 +472,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public BitmapBuffer RenderVideoProvider(IVideoProvider videoProvider)
|
||||
{
|
||||
// TODO - we might need to gather more Global.Config.DispXXX properties here, so they can be overridden
|
||||
// TODO - we might need to gather more GlobalWin.Config.DispXXX properties here, so they can be overridden
|
||||
var targetSize = new Size(videoProvider.BufferWidth, videoProvider.BufferHeight);
|
||||
var padding = CalculateCompleteContentPadding(true,true);
|
||||
targetSize.Width += padding.Horizontal;
|
||||
|
@ -551,12 +551,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public Size CalculateClientSize(IVideoProvider videoProvider, int zoom)
|
||||
{
|
||||
bool arActive = Global.Config.DispFixAspectRatio;
|
||||
bool arSystem = Global.Config.DispManagerAR == EDispManagerAR.System;
|
||||
bool arCustom = Global.Config.DispManagerAR == EDispManagerAR.Custom;
|
||||
bool arCustomRatio = Global.Config.DispManagerAR == EDispManagerAR.CustomRatio;
|
||||
bool arActive = GlobalWin.Config.DispFixAspectRatio;
|
||||
bool arSystem = GlobalWin.Config.DispManagerAR == EDispManagerAR.System;
|
||||
bool arCustom = GlobalWin.Config.DispManagerAR == EDispManagerAR.Custom;
|
||||
bool arCustomRatio = GlobalWin.Config.DispManagerAR == EDispManagerAR.CustomRatio;
|
||||
bool arCorrect = arSystem || arCustom || arCustomRatio;
|
||||
bool arInteger = Global.Config.DispFixScaleInteger;
|
||||
bool arInteger = GlobalWin.Config.DispFixScaleInteger;
|
||||
|
||||
int bufferWidth = videoProvider.BufferWidth;
|
||||
int bufferHeight = videoProvider.BufferHeight;
|
||||
|
@ -565,13 +565,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (arCustom)
|
||||
{
|
||||
virtualWidth = Global.Config.DispCustomUserARWidth;
|
||||
virtualHeight = Global.Config.DispCustomUserARHeight;
|
||||
virtualWidth = GlobalWin.Config.DispCustomUserARWidth;
|
||||
virtualHeight = GlobalWin.Config.DispCustomUserARHeight;
|
||||
}
|
||||
|
||||
if (arCustomRatio)
|
||||
{
|
||||
FixRatio(Global.Config.DispCustomUserArx, Global.Config.DispCustomUserAry, videoProvider.BufferWidth, videoProvider.BufferHeight, out virtualWidth, out virtualHeight);
|
||||
FixRatio(GlobalWin.Config.DispCustomUserArx, GlobalWin.Config.DispCustomUserAry, videoProvider.BufferWidth, videoProvider.BufferHeight, out virtualWidth, out virtualHeight);
|
||||
}
|
||||
|
||||
//TODO: it is bad that this is happening outside the filter chain
|
||||
|
@ -782,22 +782,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
presenterTextureHeight = vh = sz.Height;
|
||||
}
|
||||
|
||||
if (Global.Config.DispFixAspectRatio)
|
||||
if (GlobalWin.Config.DispFixAspectRatio)
|
||||
{
|
||||
if (Global.Config.DispManagerAR == EDispManagerAR.System)
|
||||
if (GlobalWin.Config.DispManagerAR == EDispManagerAR.System)
|
||||
{
|
||||
//Already set
|
||||
}
|
||||
if (Global.Config.DispManagerAR == EDispManagerAR.Custom)
|
||||
if (GlobalWin.Config.DispManagerAR == EDispManagerAR.Custom)
|
||||
{
|
||||
//not clear what any of these other options mean for "screen controlled" systems
|
||||
vw = Global.Config.DispCustomUserARWidth;
|
||||
vh = Global.Config.DispCustomUserARHeight;
|
||||
vw = GlobalWin.Config.DispCustomUserARWidth;
|
||||
vh = GlobalWin.Config.DispCustomUserARHeight;
|
||||
}
|
||||
if (Global.Config.DispManagerAR == EDispManagerAR.CustomRatio)
|
||||
if (GlobalWin.Config.DispManagerAR == EDispManagerAR.CustomRatio)
|
||||
{
|
||||
//not clear what any of these other options mean for "screen controlled" systems
|
||||
FixRatio(Global.Config.DispCustomUserArx, Global.Config.DispCustomUserAry, videoProvider.BufferWidth, videoProvider.BufferHeight, out vw, out vh);
|
||||
FixRatio(GlobalWin.Config.DispCustomUserArx, GlobalWin.Config.DispCustomUserAry, videoProvider.BufferWidth, videoProvider.BufferHeight, out vw, out vh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -853,10 +853,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
fPresent.BackgroundColor = videoProvider.BackgroundColor;
|
||||
fPresent.GuiRenderer = Renderer;
|
||||
fPresent.Flip = isGlTextureId;
|
||||
fPresent.Config_FixAspectRatio = Global.Config.DispFixAspectRatio;
|
||||
fPresent.Config_FixScaleInteger = Global.Config.DispFixScaleInteger;
|
||||
fPresent.Config_FixAspectRatio = GlobalWin.Config.DispFixAspectRatio;
|
||||
fPresent.Config_FixScaleInteger = GlobalWin.Config.DispFixScaleInteger;
|
||||
fPresent.Padding = ClientExtraPadding;
|
||||
fPresent.AutoPrescale = Global.Config.DispAutoPrescale;
|
||||
fPresent.AutoPrescale = GlobalWin.Config.DispAutoPrescale;
|
||||
|
||||
fPresent.GL = GL;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (!job.Offscreen)
|
||||
{
|
||||
//apply the vsync setting (should probably try to avoid repeating this)
|
||||
var vsync = Global.Config.VSyncThrottle || Global.Config.VSync;
|
||||
var vsync = GlobalWin.Config.VSyncThrottle || GlobalWin.Config.VSync;
|
||||
|
||||
//ok, now this is a bit undesirable.
|
||||
//maybe the user wants vsync, but not vsync throttle.
|
||||
|
@ -918,7 +918,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
vsync = false;
|
||||
|
||||
//for now, it's assumed that the presentation panel is the main window, but that may not always be true
|
||||
if (vsync && Global.Config.DispAlternateVsync && Global.Config.VSyncThrottle)
|
||||
if (vsync && GlobalWin.Config.DispAlternateVsync && GlobalWin.Config.VSyncThrottle)
|
||||
{
|
||||
dx9 = GL as IGL_SlimDX9;
|
||||
if (dx9 != null)
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
MessageFont = blitter.GetFontType(nameof(MessageFont));
|
||||
}
|
||||
|
||||
public Color FixedMessagesColor => Color.FromArgb(Global.Config.MessagesColor);
|
||||
public Color FixedAlertMessageColor => Color.FromArgb(Global.Config.AlertMessageColor);
|
||||
public Color FixedMessagesColor => Color.FromArgb(GlobalWin.Config.MessagesColor);
|
||||
public Color FixedAlertMessageColor => Color.FromArgb(GlobalWin.Config.AlertMessageColor);
|
||||
|
||||
private PointF GetCoordinates(IBlitter g, MessagePosition position, string message)
|
||||
{
|
||||
|
@ -135,14 +135,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void DrawMessage(IBlitter g, UIMessage message, int yOffset)
|
||||
{
|
||||
var point = GetCoordinates(g, Global.Config.Messages, message.Message);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.Messages, message.Message);
|
||||
var y = point.Y + yOffset; // TODO: clean me up
|
||||
g.DrawString(message.Message, MessageFont, FixedMessagesColor, point.X, y);
|
||||
}
|
||||
|
||||
public void DrawMessages(IBlitter g)
|
||||
{
|
||||
if (!Global.Config.DisplayMessages)
|
||||
if (!GlobalWin.Config.DisplayMessages)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -151,13 +151,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (_messages.Any())
|
||||
{
|
||||
if (Global.Config.StackOSDMessages)
|
||||
if (GlobalWin.Config.StackOSDMessages)
|
||||
{
|
||||
int line = 1;
|
||||
for (int i = _messages.Count - 1; i >= 0; i--, line++)
|
||||
{
|
||||
int yOffset = (line - 1) * 18;
|
||||
if (!Global.Config.Messages.Anchor.IsTop())
|
||||
if (!GlobalWin.Config.Messages.Anchor.IsTop())
|
||||
{
|
||||
yOffset = 0 - yOffset;
|
||||
}
|
||||
|
@ -258,11 +258,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public void DrawScreenInfo(IBlitter g)
|
||||
{
|
||||
if (Global.Config.DisplayFrameCounter && !Global.Game.IsNullInstance())
|
||||
if (GlobalWin.Config.DisplayFrameCounter && !Global.Game.IsNullInstance())
|
||||
{
|
||||
string message = MakeFrameCounter();
|
||||
var point = GetCoordinates(g, Global.Config.FrameCounter, message);
|
||||
DrawOsdMessage(g, message, Color.FromArgb(Global.Config.MessagesColor), point.X, point.Y);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.FrameCounter, message);
|
||||
DrawOsdMessage(g, message, Color.FromArgb(GlobalWin.Config.MessagesColor), point.X, point.Y);
|
||||
|
||||
if (GlobalWin.MainForm.IsLagFrame)
|
||||
{
|
||||
|
@ -270,27 +270,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayInput && !Global.Game.IsNullInstance())
|
||||
if (GlobalWin.Config.DisplayInput && !Global.Game.IsNullInstance())
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsPlaying()
|
||||
|| (Global.MovieSession.Movie.IsFinished() && GlobalWin.Emulator.Frame == Global.MovieSession.Movie.InputLogLength)) // Account for the last frame of the movie, the movie state is immediately "Finished" here but we still want to show the input
|
||||
{
|
||||
var input = InputStrMovie();
|
||||
var point = GetCoordinates(g, Global.Config.InputDisplay, input);
|
||||
Color c = Color.FromArgb(Global.Config.MovieInput);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.InputDisplay, input);
|
||||
Color c = Color.FromArgb(GlobalWin.Config.MovieInput);
|
||||
g.DrawString(input, MessageFont, c, point.X, point.Y);
|
||||
}
|
||||
|
||||
else // TODO: message config -- allow setting of "previous", "mixed", and "auto"
|
||||
{
|
||||
var previousColor = Color.Orange;
|
||||
Color immediateColor = Color.FromArgb(Global.Config.MessagesColor);
|
||||
Color immediateColor = Color.FromArgb(GlobalWin.Config.MessagesColor);
|
||||
var autoColor = Color.Pink;
|
||||
var changedColor = Color.PeachPuff;
|
||||
|
||||
//we need some kind of string for calculating position when right-anchoring, of something like that
|
||||
var bgStr = InputStrOrAll();
|
||||
var point = GetCoordinates(g, Global.Config.InputDisplay, bgStr);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.InputDisplay, bgStr);
|
||||
|
||||
// now, we're going to render these repeatedly, with higher-priority things overriding
|
||||
|
||||
|
@ -322,27 +322,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (Global.MovieSession.MultiTrack.IsActive)
|
||||
{
|
||||
var point = GetCoordinates(g, Global.Config.MultitrackRecorder, Global.MovieSession.MultiTrack.Status);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.MultitrackRecorder, Global.MovieSession.MultiTrack.Status);
|
||||
DrawOsdMessage(g, Global.MovieSession.MultiTrack.Status, FixedMessagesColor, point.X, point.Y);
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayFps && Fps != null)
|
||||
if (GlobalWin.Config.DisplayFps && Fps != null)
|
||||
{
|
||||
var point = GetCoordinates(g, Global.Config.Fps, Fps);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.Fps, Fps);
|
||||
DrawOsdMessage(g, Fps, FixedMessagesColor, point.X, point.Y);
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayLagCounter && GlobalWin.Emulator.CanPollInput())
|
||||
if (GlobalWin.Config.DisplayLagCounter && GlobalWin.Emulator.CanPollInput())
|
||||
{
|
||||
var counter = GlobalWin.Emulator.AsInputPollable().LagCount.ToString();
|
||||
var point = GetCoordinates(g, Global.Config.LagCounter, counter);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.LagCounter, counter);
|
||||
DrawOsdMessage(g, counter, FixedAlertMessageColor, point.X, point.Y);
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayRerecordCount)
|
||||
if (GlobalWin.Config.DisplayRerecordCount)
|
||||
{
|
||||
string rerecordCount = MakeRerecordCount();
|
||||
var point = GetCoordinates(g, Global.Config.ReRecordCounter, rerecordCount);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.ReRecordCounter, rerecordCount);
|
||||
DrawOsdMessage(g, rerecordCount, FixedMessagesColor, point.X, point.Y);
|
||||
}
|
||||
|
||||
|
@ -364,11 +364,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var message = sb.ToString();
|
||||
var point = GetCoordinates(g, Global.Config.Autohold, message);
|
||||
var point = GetCoordinates(g, GlobalWin.Config.Autohold, message);
|
||||
g.DrawString(message, MessageFont, Color.White, point.X, point.Y);
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive() && Global.Config.DisplaySubtitles)
|
||||
if (Global.MovieSession.Movie.IsActive() && GlobalWin.Config.DisplaySubtitles)
|
||||
{
|
||||
var subList = Global.MovieSession.Movie.Subtitles.GetSubtitles(GlobalWin.Emulator.Frame);
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
return emulator switch
|
||||
{
|
||||
Snes9x _ => PromptToSwitchCore("Snes9x", "bsnes", () => Global.Config.PreferredCores["SNES"] = Cores.CoreNames.Bsnes),
|
||||
QuickNES _ => PromptToSwitchCore("QuickNes", "NesHawk", () => Global.Config.PreferredCores["NES"] = Cores.CoreNames.NesHawk),
|
||||
Snes9x _ => PromptToSwitchCore("Snes9x", "bsnes", () => GlobalWin.Config.PreferredCores["SNES"] = Cores.CoreNames.Bsnes),
|
||||
QuickNES _ => PromptToSwitchCore("QuickNes", "NesHawk", () => GlobalWin.Config.PreferredCores["NES"] = Cores.CoreNames.NesHawk),
|
||||
_ => true
|
||||
};
|
||||
}
|
||||
|
|
|
@ -41,5 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static bool DisableSecondaryThrottling { get; set; }
|
||||
|
||||
public static Dictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();
|
||||
|
||||
public static Config Config { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private readonly Thread UpdateThread;
|
||||
|
||||
public readonly HostInputAdapter Adapter = Global.Config.HostInputMethod switch
|
||||
public readonly HostInputAdapter Adapter = GlobalWin.Config.HostInputMethod switch
|
||||
{
|
||||
EHostInputMethod.OpenTK => new OpenTKInputAdapter(),
|
||||
EHostInputMethod.DirectInput => new DirectInputAdapter(),
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static Key Handle(Key key)
|
||||
{
|
||||
if (!Global.Config.HandleAlternateKeyboardLayouts) return key;
|
||||
if (!GlobalWin.Config.HandleAlternateKeyboardLayouts) return key;
|
||||
ScanCode inputScanCode = SlimDXScanCodeMap[(int)key];
|
||||
Keys virtualKey = (Keys)BizHawk.Common.Win32Imports.MapVirtualKey((uint)inputScanCode, MAPVK_VSC_TO_VK_EX);
|
||||
ScanCode standardScanCode = GetStandardScanCode(virtualKey);
|
||||
|
|
|
@ -875,8 +875,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private Config Config
|
||||
{
|
||||
get => Global.Config;
|
||||
set => Global.Config = value;
|
||||
get => GlobalWin.Config;
|
||||
set => GlobalWin.Config = value;
|
||||
}
|
||||
|
||||
private ToolManager Tools => GlobalWin.Tools;
|
||||
|
|
|
@ -108,24 +108,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
try
|
||||
{
|
||||
Global.Config = ConfigService.Load<Config>(Config.DefaultIniPath);
|
||||
GlobalWin.Config = ConfigService.Load<Config>(Config.DefaultIniPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
new ExceptionBox(e).ShowDialog();
|
||||
new ExceptionBox("Since your config file is corrupted or from a different BizHawk version, we're going to recreate it. Back it up before proceeding if you want to investigate further.").ShowDialog();
|
||||
File.Delete(Config.DefaultIniPath);
|
||||
Global.Config = ConfigService.Load<Config>(Config.DefaultIniPath);
|
||||
GlobalWin.Config = ConfigService.Load<Config>(Config.DefaultIniPath);
|
||||
}
|
||||
|
||||
Global.Config.ResolveDefaults();
|
||||
GlobalWin.Config.ResolveDefaults();
|
||||
|
||||
StringLogUtil.DefaultToDisk = Global.Config.Movies.MoviesOnDisk;
|
||||
StringLogUtil.DefaultToDisk = GlobalWin.Config.Movies.MoviesOnDisk;
|
||||
|
||||
// super hacky! this needs to be done first. still not worth the trouble to make this system fully proper
|
||||
if (Array.Exists(args, arg => arg.StartsWith("--gdi", StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
Global.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
GlobalWin.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
}
|
||||
|
||||
// create IGL context. we do this whether or not the user has selected OpenGL, so that we can run opengl-based emulator cores
|
||||
|
@ -137,11 +137,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
|
||||
REDO_DISPMETHOD:
|
||||
if (Global.Config.DispMethod == EDispMethod.GdiPlus)
|
||||
if (GlobalWin.Config.DispMethod == EDispMethod.GdiPlus)
|
||||
{
|
||||
GlobalWin.GL = new IGL_GdiPlus();
|
||||
}
|
||||
else if (Global.Config.DispMethod == EDispMethod.SlimDX9)
|
||||
else if (GlobalWin.Config.DispMethod == EDispMethod.SlimDX9)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
new ExceptionBox(new Exception("Initialization of Direct3d 9 Display Method failed; falling back to GDI+", ex)).ShowDialog();
|
||||
|
||||
// fallback
|
||||
Global.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
GlobalWin.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
goto REDO_DISPMETHOD;
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (GlobalWin.IGL_GL.Version < 200)
|
||||
{
|
||||
// fallback
|
||||
Global.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
GlobalWin.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
goto REDO_DISPMETHOD;
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
new ExceptionBox(new Exception("Initialization of Display Method failed; falling back to GDI+", ex)).ShowDialog();
|
||||
|
||||
//fallback
|
||||
Global.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
GlobalWin.Config.DispMethod = EDispMethod.GdiPlus;
|
||||
goto REDO_DISPMETHOD;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
try
|
||||
{
|
||||
if (Global.Config.SingleInstanceMode)
|
||||
if (GlobalWin.Config.SingleInstanceMode)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// later, we look for NLua or KopiLua assembly names and redirect them to files located in the output/DLL/nlua directory
|
||||
if (new AssemblyName(requested).Name == "NLua")
|
||||
{
|
||||
//this method referencing Global.Config makes assemblies get loaded, which isnt smart from the assembly resolver.
|
||||
//this method referencing GlobalWin.Config makes assemblies get loaded, which isnt smart from the assembly resolver.
|
||||
//so.. we're going to resort to something really bad.
|
||||
//avert your eyes.
|
||||
var configPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void StartSound()
|
||||
{
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(Global.Config.SoundBufferSizeMs);
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(GlobalWin.Config.SoundBufferSizeMs);
|
||||
|
||||
// 35 to 65 milliseconds depending on how big the buffer is. This is a trade-off
|
||||
// between more frequent but less severe glitches (i.e. catching underruns before
|
||||
|
@ -68,7 +68,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// severe glitches. At least on my Windows 8 machines, the distance between the
|
||||
// play and write cursors can be up to 30 milliseconds, so that would be the
|
||||
// absolute minimum we could use here.
|
||||
int minBufferFullnessMs = Math.Min(35 + ((Global.Config.SoundBufferSizeMs - 60) / 2), 65);
|
||||
int minBufferFullnessMs = Math.Min(35 + ((GlobalWin.Config.SoundBufferSizeMs - 60) / 2), 65);
|
||||
MaxSamplesDeficit = BufferSizeSamples - Sound.MillisecondsToSamples(minBufferFullnessMs);
|
||||
|
||||
var format = new WaveFormat
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void StartSound()
|
||||
{
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(Global.Config.SoundBufferSizeMs);
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(GlobalWin.Config.SoundBufferSizeMs);
|
||||
MaxSamplesDeficit = BufferSizeSamples;
|
||||
|
||||
_lastWriteTime = 0;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public OpenALSoundOutput(Sound sound)
|
||||
{
|
||||
_sound = sound;
|
||||
string deviceName = GetDeviceNames().FirstOrDefault(n => n == Global.Config.SoundDevice);
|
||||
string deviceName = GetDeviceNames().FirstOrDefault(n => n == GlobalWin.Config.SoundDevice);
|
||||
_context = new AudioContext(deviceName, Sound.SampleRate);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void StartSound()
|
||||
{
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(Global.Config.SoundBufferSizeMs);
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(GlobalWin.Config.SoundBufferSizeMs);
|
||||
MaxSamplesDeficit = BufferSizeSamples;
|
||||
|
||||
_sourceID = AL.GenSource();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_device = new XAudio2();
|
||||
int? deviceIndex = Enumerable.Range(0, _device.DeviceCount)
|
||||
.Select(n => (int?)n)
|
||||
.FirstOrDefault(n => _device.GetDeviceDetails(n.Value).DisplayName == Global.Config.SoundDevice);
|
||||
.FirstOrDefault(n => _device.GetDeviceDetails(n.Value).DisplayName == GlobalWin.Config.SoundDevice);
|
||||
_masteringVoice = deviceIndex == null ?
|
||||
new MasteringVoice(_device, Sound.ChannelCount, Sound.SampleRate) :
|
||||
new MasteringVoice(_device, Sound.ChannelCount, Sound.SampleRate, deviceIndex.Value);
|
||||
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void StartSound()
|
||||
{
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(Global.Config.SoundBufferSizeMs);
|
||||
BufferSizeSamples = Sound.MillisecondsToSamples(GlobalWin.Config.SoundBufferSizeMs);
|
||||
MaxSamplesDeficit = BufferSizeSamples;
|
||||
|
||||
var format = new WaveFormat
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public Sound(IntPtr mainWindowHandle)
|
||||
{
|
||||
if (Global.Config.SoundOutputMethod != ESoundOutputMethod.Dummy)
|
||||
if (GlobalWin.Config.SoundOutputMethod != ESoundOutputMethod.Dummy)
|
||||
{
|
||||
if (OSTailoredCode.IsUnixHost)
|
||||
{
|
||||
|
@ -31,11 +31,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Global.Config.SoundOutputMethod == ESoundOutputMethod.OpenAL)
|
||||
if (GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.OpenAL)
|
||||
_outputDevice = new OpenALSoundOutput(this);
|
||||
if (Global.Config.SoundOutputMethod == ESoundOutputMethod.DirectSound)
|
||||
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle, Global.Config.SoundDevice);
|
||||
if (Global.Config.SoundOutputMethod == ESoundOutputMethod.XAudio2)
|
||||
if (GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.DirectSound)
|
||||
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle, GlobalWin.Config.SoundDevice);
|
||||
if (GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.XAudio2)
|
||||
_outputDevice = new XAudio2SoundOutput(this);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void StartSound()
|
||||
{
|
||||
if (_disposed) return;
|
||||
if (!Global.Config.SoundEnabled) return;
|
||||
if (!GlobalWin.Config.SoundEnabled) return;
|
||||
if (IsStarted) return;
|
||||
|
||||
_outputDevice.StartSound();
|
||||
|
@ -138,7 +138,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void UpdateSound(float atten)
|
||||
{
|
||||
if (!Global.Config.SoundEnabled || !IsStarted || _bufferedProvider == null || _disposed)
|
||||
if (!GlobalWin.Config.SoundEnabled || !IsStarted || _bufferedProvider == null || _disposed)
|
||||
{
|
||||
_bufferedProvider?.DiscardSamples();
|
||||
return;
|
||||
|
@ -163,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (_bufferedProvider == _outputProvider)
|
||||
{
|
||||
if (Global.Config.SoundThrottle)
|
||||
if (GlobalWin.Config.SoundThrottle)
|
||||
{
|
||||
_outputProvider.BaseSoundProvider.GetSamplesSync(out samples, out sampleCount);
|
||||
sampleOffset = 0;
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
else throw new InvalidOperationException();
|
||||
#endif
|
||||
|
||||
int skipRate = (forceFrameSkip < 0) ? Global.Config.FrameSkip : forceFrameSkip;
|
||||
int skipRate = (forceFrameSkip < 0) ? GlobalWin.Config.FrameSkip : forceFrameSkip;
|
||||
int ffSkipRate = (forceFrameSkip < 0) ? 3 : forceFrameSkip;
|
||||
|
||||
if (lastSkipRate != skipRate)
|
||||
|
@ -80,7 +80,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//don't ever skip frames when continuous frame advancing. it's meant for precision work.
|
||||
//but we DO need to throttle
|
||||
if (Global.Config.ClockThrottle)
|
||||
if (GlobalWin.Config.ClockThrottle)
|
||||
extraThrottle = true;
|
||||
}
|
||||
else
|
||||
|
@ -108,12 +108,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (framesToSkip < 1)
|
||||
framesToSkip += ffSkipRate;
|
||||
}
|
||||
else if ((extraThrottle || signal_paused || Global.Config.ClockThrottle || signal_overrideSecondaryThrottle) && allowSleep)
|
||||
else if ((extraThrottle || signal_paused || GlobalWin.Config.ClockThrottle || signal_overrideSecondaryThrottle) && allowSleep)
|
||||
{
|
||||
SpeedThrottle(signal_paused);
|
||||
}
|
||||
|
||||
if (Global.Config.AutoMinimizeSkipping && Global.Config.FrameSkip != 0)
|
||||
if (GlobalWin.Config.AutoMinimizeSkipping && GlobalWin.Config.FrameSkip != 0)
|
||||
{
|
||||
if (!signal_continuousFrameAdvancing)
|
||||
{
|
||||
|
|
|
@ -16,26 +16,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private static bool AutoCheckEnabled
|
||||
{
|
||||
get => Global.Config.UpdateAutoCheckEnabled;
|
||||
set => Global.Config.UpdateAutoCheckEnabled = value;
|
||||
get => GlobalWin.Config.UpdateAutoCheckEnabled;
|
||||
set => GlobalWin.Config.UpdateAutoCheckEnabled = value;
|
||||
}
|
||||
|
||||
private static DateTime? LastCheckTimeUTC
|
||||
{
|
||||
get => Global.Config.UpdateLastCheckTimeUtc;
|
||||
set => Global.Config.UpdateLastCheckTimeUtc = value;
|
||||
get => GlobalWin.Config.UpdateLastCheckTimeUtc;
|
||||
set => GlobalWin.Config.UpdateLastCheckTimeUtc = value;
|
||||
}
|
||||
|
||||
private static string LatestVersion
|
||||
{
|
||||
get => Global.Config.UpdateLatestVersion;
|
||||
set => Global.Config.UpdateLatestVersion = value;
|
||||
get => GlobalWin.Config.UpdateLatestVersion;
|
||||
set => GlobalWin.Config.UpdateLatestVersion = value;
|
||||
}
|
||||
|
||||
private static string IgnoreVersion
|
||||
{
|
||||
get => Global.Config.UpdateIgnoreVersion;
|
||||
set => Global.Config.UpdateIgnoreVersion = value;
|
||||
get => GlobalWin.Config.UpdateIgnoreVersion;
|
||||
set => GlobalWin.Config.UpdateIgnoreVersion = value;
|
||||
}
|
||||
|
||||
public static void BeginCheck(bool skipCheck = false)
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
PopulatePlatforms();
|
||||
|
||||
var selectedSystemId = Global.Config.PreferredPlatformsForExtensions[FileExtension];
|
||||
var selectedSystemId = GlobalWin.Config.PreferredPlatformsForExtensions[FileExtension];
|
||||
if (!string.IsNullOrEmpty(selectedSystemId))
|
||||
{
|
||||
var selectedSystem = _availableSystems.FirstOrDefault(s => s.SystemId == selectedSystemId);
|
||||
|
|
|
@ -471,7 +471,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
Global.Config.FirmwareUserSpecifications[fr.ConfigKey] = filePath;
|
||||
GlobalWin.Config.FirmwareUserSpecifications[fr.ConfigKey] = filePath;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -490,7 +490,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
|
||||
{
|
||||
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
|
||||
Global.Config.FirmwareUserSpecifications.Remove(fr.ConfigKey);
|
||||
GlobalWin.Config.FirmwareUserSpecifications.Remove(fr.ConfigKey);
|
||||
}
|
||||
|
||||
DoScan();
|
||||
|
@ -584,7 +584,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
using var pathConfig = new PathConfig(_mainForm, Global.Config);
|
||||
using var pathConfig = new PathConfig(_mainForm, GlobalWin.Config);
|
||||
pathConfig.ShowDialog(this);
|
||||
RefreshBasePath();
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void SaveFile()
|
||||
{
|
||||
string path = Global.Config.PathEntries.ScreenshotAbsolutePathFor(GlobalWin.Emulator.SystemId);
|
||||
string path = GlobalWin.Config.PathEntries.ScreenshotAbsolutePathFor(GlobalWin.Emulator.SystemId);
|
||||
|
||||
var di = new DirectoryInfo(path);
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
InitialDirectory = Global.Config.PathEntries.ScreenshotAbsolutePathFor("GB"),
|
||||
InitialDirectory = GlobalWin.Config.PathEntries.ScreenshotAbsolutePathFor("GB"),
|
||||
Filter = new FilesystemFilterSet(FilesystemFilter.Palettes).ToString(),
|
||||
RestoreDirectory = true
|
||||
};
|
||||
|
@ -344,7 +344,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
InitialDirectory = Global.Config.PathEntries.PalettesAbsolutePathFor("GB"),
|
||||
InitialDirectory = GlobalWin.Config.PathEntries.PalettesAbsolutePathFor("GB"),
|
||||
FileName = $"{Global.Game.Name}.pal",
|
||||
Filter = new FilesystemFilterSet(FilesystemFilter.Palettes).ToString(),
|
||||
RestoreDirectory = true
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_files = new List<string>(files);
|
||||
_numFrames = numFrames;
|
||||
|
||||
_ldr = new RomLoader(Global.Config);
|
||||
_ldr = new RomLoader(GlobalWin.Config);
|
||||
_ldr.OnLoadError += OnLoadError;
|
||||
_ldr.ChooseArchive = ChooseArchive;
|
||||
_comm = mainForm.CreateCoreComm();
|
||||
|
|
|
@ -25,12 +25,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
static ExternalToolManager()
|
||||
{
|
||||
if(!Directory.Exists(Global.Config.PathEntries["Global", "External Tools"].Path))
|
||||
if(!Directory.Exists(GlobalWin.Config.PathEntries["Global", "External Tools"].Path))
|
||||
{
|
||||
Directory.CreateDirectory(Global.Config.PathEntries["Global", "External Tools"].Path);
|
||||
Directory.CreateDirectory(GlobalWin.Config.PathEntries["Global", "External Tools"].Path);
|
||||
}
|
||||
|
||||
DirectoryMonitor = new FileSystemWatcher(Global.Config.PathEntries["Global", "External Tools"].Path, "*.dll")
|
||||
DirectoryMonitor = new FileSystemWatcher(GlobalWin.Config.PathEntries["Global", "External Tools"].Path, "*.dll")
|
||||
{
|
||||
IncludeSubdirectories = false
|
||||
, NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (numFrames >= 0)
|
||||
{
|
||||
Global.Config.FrameSkip = numFrames;
|
||||
GlobalWin.Config.FrameSkip = numFrames;
|
||||
MainForm.FrameSkipMessage();
|
||||
}
|
||||
else
|
||||
|
@ -155,14 +155,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod("gettargetscanlineintensity", "Gets the current scanline intensity setting, used for the scanline display filter")]
|
||||
public static int GetTargetScanlineIntensity()
|
||||
{
|
||||
return Global.Config.TargetScanlineFilterIntensity;
|
||||
return GlobalWin.Config.TargetScanlineFilterIntensity;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliget = client.getwindowsize( );")]
|
||||
[LuaMethod("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")]
|
||||
public int GetWindowSize()
|
||||
{
|
||||
return Global.Config.TargetZoomFactors[Emulator.SystemId];
|
||||
return GlobalWin.Config.TargetZoomFactors[Emulator.SystemId];
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.SetGameExtraPadding( 5, 10, 15, 20 );")]
|
||||
|
@ -301,14 +301,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod("settargetscanlineintensity", "Sets the current scanline intensity setting, used for the scanline display filter")]
|
||||
public static void SetTargetScanlineIntensity(int val)
|
||||
{
|
||||
Global.Config.TargetScanlineFilterIntensity = val;
|
||||
GlobalWin.Config.TargetScanlineFilterIntensity = val;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.setscreenshotosd( true );")]
|
||||
[LuaMethod("setscreenshotosd", "Sets the screenshot Capture OSD property of the client")]
|
||||
public static void SetScreenshotOSD(bool value)
|
||||
{
|
||||
Global.Config.ScreenshotCaptureOsd = value;
|
||||
GlobalWin.Config.ScreenshotCaptureOsd = value;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliscr = client.screenwidth( );")]
|
||||
|
@ -324,7 +324,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10)
|
||||
{
|
||||
Global.Config.TargetZoomFactors[Emulator.SystemId] = size;
|
||||
GlobalWin.Config.TargetZoomFactors[Emulator.SystemId] = size;
|
||||
MainForm.FrameBufferResized();
|
||||
MainForm.AddOnScreenMessage($"Window size set to {size}x");
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod("getconfig", "gets the current config settings object")]
|
||||
public object GetConfig()
|
||||
{
|
||||
return Global.Config;
|
||||
return GlobalWin.Config;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.togglepause( );")]
|
||||
|
@ -431,7 +431,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod("displaymessages", "sets whether or not on screen messages will display")]
|
||||
public void DisplayMessages(bool value)
|
||||
{
|
||||
Global.Config.DisplayMessages = value;
|
||||
GlobalWin.Config.DisplayMessages = value;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.saveram( );")]
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (movie.InputLogLength >= _emulator.Frame)
|
||||
{
|
||||
movie.SwitchToPlay();
|
||||
Global.Config.Movies.MovieEndAction = MovieEndAction.Record;
|
||||
GlobalWin.Config.Movies.MovieEndAction = MovieEndAction.Record;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
FileName = $"{Global.Game.FilesystemSafeName()}-Nametables",
|
||||
InitialDirectory = Global.Config.PathEntries.ScreenshotAbsolutePathFor("NES"),
|
||||
InitialDirectory = GlobalWin.Config.PathEntries.ScreenshotAbsolutePathFor("NES"),
|
||||
Filter = FilesystemFilterSet.Screenshots.ToString(),
|
||||
RestoreDirectory = true
|
||||
};
|
||||
|
|
|
@ -502,7 +502,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void NonExistentBranchMessage(int slot)
|
||||
{
|
||||
string binding = Global.Config.HotkeyBindings.First(x => x.DisplayName == "Add Branch").Bindings;
|
||||
string binding = GlobalWin.Config.HotkeyBindings.First(x => x.DisplayName == "Add Branch").Bindings;
|
||||
Tastudio.MainForm.AddOnScreenMessage($"Branch {slot} does not exist");
|
||||
Tastudio.MainForm.AddOnScreenMessage($"Use {binding} to add branches");
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_movie.Author = AuthorTextBox.Text;
|
||||
if (MakeDefaultCheckbox.Checked)
|
||||
{
|
||||
Global.Config.DefaultAuthor = AuthorTextBox.Text;
|
||||
GlobalWin.Config.DefaultAuthor = AuthorTextBox.Text;
|
||||
}
|
||||
|
||||
_movie.EmulatorVersion = EmulatorVersionTextBox.Text;
|
||||
|
@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void DefaultAuthorButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
AuthorTextBox.Text = Global.Config.DefaultAuthor;
|
||||
AuthorTextBox.Text = GlobalWin.Config.DefaultAuthor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue