diff --git a/BizHawk.Client.Common/7z/LibraryManager.cs b/BizHawk.Client.Common/7z/LibraryManager.cs
index ac0aedd2ee..6f2f375862 100644
--- a/BizHawk.Client.Common/7z/LibraryManager.cs
+++ b/BizHawk.Client.Common/7z/LibraryManager.cs
@@ -89,7 +89,7 @@ namespace SevenZip
// private static string _LibraryVersion;
private static bool? _modifyCapabale;
- private static readonly PlatformLinkedLibSingleton.PlatformLinkedLibManager libLoader = PlatformLinkedLibSingleton.LinkedLibManager;
+ private static readonly OSTailoredCode.ILinkedLibManager libLoader = OSTailoredCode.LinkedLibManager;
private static void InitUserInFormat(object user, InArchiveFormat format)
{
diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
index 97a06e1c3b..f8710bbc42 100644
--- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
+++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
@@ -113,8 +113,8 @@
-
- PlatformLinkedLibSingleton.cs
+
+ OSTailoredCode.cs
svnrev.cs
@@ -2283,4 +2283,4 @@
-
\ No newline at end of file
+
diff --git a/BizHawk.Client.EmuHawk/Input/Input.cs b/BizHawk.Client.EmuHawk/Input/Input.cs
index 2f84152d7f..a890029682 100644
--- a/BizHawk.Client.EmuHawk/Input/Input.cs
+++ b/BizHawk.Client.EmuHawk/Input/Input.cs
@@ -123,7 +123,7 @@ namespace BizHawk.Client.EmuHawk
public static void Initialize()
{
- if (PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
KeyInput.Initialize();
IPCKeyInput.Initialize();
@@ -140,7 +140,7 @@ namespace BizHawk.Client.EmuHawk
public static void Cleanup()
{
- if (PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
KeyInput.Cleanup();
GamePad.Cleanup();
@@ -331,10 +331,10 @@ namespace BizHawk.Client.EmuHawk
{
while (true)
{
- var keyEvents = PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows
+ var keyEvents = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? KeyInput.Update().Concat(IPCKeyInput.Update())
: OTK_Keyboard.Update();
- if (PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
GamePad.UpdateAll();
GamePad360.UpdateAll();
diff --git a/BizHawk.Client.EmuHawk/Program.cs b/BizHawk.Client.EmuHawk/Program.cs
index 6993c8f3f8..c46f0c961c 100644
--- a/BizHawk.Client.EmuHawk/Program.cs
+++ b/BizHawk.Client.EmuHawk/Program.cs
@@ -22,9 +22,9 @@ namespace BizHawk.Client.EmuHawk
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- if (EXE_PROJECT.PlatformLinkedLibSingleton.CurrentOS == EXE_PROJECT.PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
{
- var libLoader = EXE_PROJECT.PlatformLinkedLibSingleton.LinkedLibManager;
+ var libLoader = EXE_PROJECT.OSTailoredCode.LinkedLibManager;
//http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
@@ -141,7 +141,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.GLManager = GLManager.Instance;
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
- if (EXE_PROJECT.PlatformLinkedLibSingleton.CurrentOS != EXE_PROJECT.PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (EXE_PROJECT.OSTailoredCode.CurrentOS != EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
REDO_DISPMETHOD:
@@ -189,7 +189,7 @@ REDO_DISPMETHOD:
goto REDO_DISPMETHOD;
}
- if (EXE_PROJECT.PlatformLinkedLibSingleton.CurrentOS == EXE_PROJECT.PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
{
//WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff.
//The relevant initialization happened just before in "create IGL context".
diff --git a/BizHawk.Client.EmuHawk/ScreenSaver.cs b/BizHawk.Client.EmuHawk/ScreenSaver.cs
index d09ea9b8a9..64a90807f2 100644
--- a/BizHawk.Client.EmuHawk/ScreenSaver.cs
+++ b/BizHawk.Client.EmuHawk/ScreenSaver.cs
@@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
//TODO implement
}
}
- private static PlatformSpecificScreenBlankInterface screenBlankInterface = PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows
+ private static PlatformSpecificScreenBlankInterface screenBlankInterface = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? (PlatformSpecificScreenBlankInterface) new WinScreenBlankInterface()
: (PlatformSpecificScreenBlankInterface) new MiscUnixScreenBlankInterface();
diff --git a/BizHawk.Client.EmuHawk/Sound/Sound.cs b/BizHawk.Client.EmuHawk/Sound/Sound.cs
index cd6891bd9d..6461747c50 100644
--- a/BizHawk.Client.EmuHawk/Sound/Sound.cs
+++ b/BizHawk.Client.EmuHawk/Sound/Sound.cs
@@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
{
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL)
_outputDevice = new OpenALSoundOutput(this);
- if (PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows)
+ if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound)
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle);
diff --git a/BizHawk.Client.EmuHawk/Throttle.cs b/BizHawk.Client.EmuHawk/Throttle.cs
index d703bce4ac..20aed07964 100644
--- a/BizHawk.Client.EmuHawk/Throttle.cs
+++ b/BizHawk.Client.EmuHawk/Throttle.cs
@@ -160,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
return timeBeginPeriod(ms);
}
}
- static PlatformSpecificSysTimer sysTimer = PlatformLinkedLibSingleton.CurrentOS != PlatformLinkedLibSingleton.DistinctOS.Windows ? (PlatformSpecificSysTimer) new UnixMonoSysTimer() : (PlatformSpecificSysTimer) new WinSysTimer();
+ static PlatformSpecificSysTimer sysTimer = OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows ? (PlatformSpecificSysTimer) new UnixMonoSysTimer() : (PlatformSpecificSysTimer) new WinSysTimer();
static uint TimeBeginPeriod(uint ms)
{
return sysTimer.TimeBeginPeriod(ms);
diff --git a/BizHawk.Client.EmuHawk/config/InputWidget.cs b/BizHawk.Client.EmuHawk/config/InputWidget.cs
index b6ffe91457..7026051674 100644
--- a/BizHawk.Client.EmuHawk/config/InputWidget.cs
+++ b/BizHawk.Client.EmuHawk/config/InputWidget.cs
@@ -71,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
protected override void OnMouseClick(MouseEventArgs e)
{
- if (PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows) HideCaret(Handle);
+ if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) HideCaret(Handle);
base.OnMouseClick(e);
}
@@ -264,7 +264,7 @@ namespace BizHawk.Client.EmuHawk
protected override void OnGotFocus(EventArgs e)
{
- if (PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows) HideCaret(Handle);
+ if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) HideCaret(Handle);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
index 92f954e0c2..01e632f799 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
@@ -186,7 +186,7 @@ namespace BizHawk.Client.EmuHawk
}
var currentScripts = LuaImp?.ScriptList; // Temp fix for now
- LuaImp = PlatformLinkedLibSingleton.CurrentOS == PlatformLinkedLibSingleton.DistinctOS.Windows
+ LuaImp = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? (PlatformEmuLuaLibrary) new EmuLuaLibrary(Emulator.ServiceProvider)
: (PlatformEmuLuaLibrary) new NotReallyLuaLibrary();
if (currentScripts != null)
diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs
index 5d381b2184..fee0f9b269 100644
--- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs
+++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs
@@ -740,7 +740,7 @@ namespace BizHawk.Client.EmuHawk
return false;
}
- if (t == typeof(LuaConsole) && PlatformLinkedLibSingleton.CurrentOS != PlatformLinkedLibSingleton.DistinctOS.Windows) return false;
+ if (t == typeof(LuaConsole) && OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows) return false;
var tool = Assembly
.GetExecutingAssembly()
diff --git a/BizHawk.Common/BizHawk.Common.csproj b/BizHawk.Common/BizHawk.Common.csproj
index 33f8d29023..57821a4430 100644
--- a/BizHawk.Common/BizHawk.Common.csproj
+++ b/BizHawk.Common/BizHawk.Common.csproj
@@ -85,7 +85,7 @@
-
+
diff --git a/BizHawk.Common/BizInvoke/DynamicLibraryImportResolver.cs b/BizHawk.Common/BizInvoke/DynamicLibraryImportResolver.cs
index 9bc02c487b..e71a78fbef 100644
--- a/BizHawk.Common/BizInvoke/DynamicLibraryImportResolver.cs
+++ b/BizHawk.Common/BizInvoke/DynamicLibraryImportResolver.cs
@@ -8,12 +8,12 @@ namespace BizHawk.Common.BizInvoke
public class DynamicLibraryImportResolver : IImportResolver, IDisposable
{
private IntPtr _p;
- private readonly PlatformLinkedLibSingleton.PlatformLinkedLibManager libLoader = PlatformLinkedLibSingleton.LinkedLibManager;
+ private readonly OSTailoredCode.ILinkedLibManager libLoader = OSTailoredCode.LinkedLibManager;
public DynamicLibraryImportResolver(string dllName)
{
_p = libLoader.LoadPlatformSpecific(dllName);
- if (_p == IntPtr.Zero) throw new InvalidOperationException($"null pointer returned by {nameof(PlatformLinkedLibSingleton.PlatformLinkedLibManager.LoadPlatformSpecific)}");
+ if (_p == IntPtr.Zero) throw new InvalidOperationException($"null pointer returned by {nameof(libLoader.LoadPlatformSpecific)}");
}
public IntPtr Resolve(string entryPoint)
diff --git a/BizHawk.Common/PlatformLinkedLibSingleton.cs b/BizHawk.Common/OSTailoredCode.cs
similarity index 82%
rename from BizHawk.Common/PlatformLinkedLibSingleton.cs
rename to BizHawk.Common/OSTailoredCode.cs
index afc8b46054..fa7c882556 100644
--- a/BizHawk.Common/PlatformLinkedLibSingleton.cs
+++ b/BizHawk.Common/OSTailoredCode.cs
@@ -10,28 +10,28 @@ namespace EXE_PROJECT
namespace BizHawk.Common
#endif
{
- public sealed class PlatformLinkedLibSingleton
+ public sealed class OSTailoredCode
{
/// macOS doesn't use PlatformID.MacOSX
public static readonly DistinctOS CurrentOS = Environment.OSVersion.Platform == PlatformID.Unix
? currentIsMacOS() ? DistinctOS.macOS : DistinctOS.Linux
: DistinctOS.Windows;
- private static readonly Lazy lazy = new Lazy(() =>
+ private static readonly Lazy lazy = new Lazy(() =>
{
switch (CurrentOS)
{
case DistinctOS.Linux:
case DistinctOS.macOS:
- return new UnixMonoLinkedLibManager();
+ return new UnixMonoLLManager();
case DistinctOS.Windows:
- return new Win32LinkedLibManager();
+ return new WindowsLLManager();
default:
throw new ArgumentOutOfRangeException();
}
});
- public static PlatformLinkedLibManager LinkedLibManager => lazy.Value;
+ public static ILinkedLibManager LinkedLibManager => lazy.Value;
private static bool currentIsMacOS()
{
@@ -49,19 +49,19 @@ namespace BizHawk.Common
return proc.StandardOutput.ReadLine() == "Darwin";
}
- private PlatformLinkedLibSingleton() {}
+ private OSTailoredCode() {}
- public interface PlatformLinkedLibManager
+ public interface ILinkedLibManager
{
IntPtr LoadPlatformSpecific(string dllToLoad);
IntPtr GetProcAddr(IntPtr hModule, string procName);
int FreePlatformSpecific(IntPtr hModule);
}
- private class UnixMonoLinkedLibManager : PlatformLinkedLibManager
+ /// This class is copied from a tutorial, so don't git blame and then email me expecting insight.
+ private class UnixMonoLLManager : ILinkedLibManager
{
- // This class is copied from a tutorial, so don't git blame and then email me expecting insight.
- const int RTLD_NOW = 2;
+ private const int RTLD_NOW = 2;
[DllImport("libdl.so.2")]
private static extern IntPtr dlopen(string fileName, int flags);
[DllImport("libdl.so.2")]
@@ -88,10 +88,10 @@ namespace BizHawk.Common
}
}
- private class Win32LinkedLibManager : PlatformLinkedLibManager
+ private class WindowsLLManager : ILinkedLibManager
{
[DllImport("kernel32.dll")]
- private static extern UInt32 GetLastError();
+ private static extern uint GetLastError();
// was annotated `[DllImport("kernel32.dll", BestFitMapping = false, ThrowOnUnmappableChar = true)]` in SevenZip.NativeMethods
// param dllToLoad was annotated `[MarshalAs(UnmanagedType.LPStr)]` in SevenZip.NativeMethods
[DllImport("kernel32.dll")]
@@ -121,9 +121,9 @@ namespace BizHawk.Common
public enum DistinctOS : byte
{
- Linux = 0,
- macOS = 1,
- Windows = 2
+ Linux,
+ macOS,
+ Windows
}
}
}
\ No newline at end of file
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs
index c499855ae5..3547d5459c 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs
@@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
bool event_frameend = false;
bool event_breakpoint = false;
- private static readonly PlatformLinkedLibSingleton.PlatformLinkedLibManager libLoader = PlatformLinkedLibSingleton.LinkedLibManager;
+ private static readonly OSTailoredCode.ILinkedLibManager libLoader = OSTailoredCode.LinkedLibManager;
public enum m64p_error
{