diff --git a/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs b/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs index 3b241823ff..5a3c5b2fdd 100644 --- a/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs +++ b/src/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs @@ -66,20 +66,20 @@ namespace BizHawk.Client.EmuHawk ShaderChainFrugalizers[i] = new RenderTargetFrugalizer(GL); } - using (var xml = EmuHawk.ReflectionCache.Asm.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.courier16px.fnt")) + using (var xml = EmuHawk.ReflectionCache.EmbeddedResourceStream("Resources.courier16px.fnt")) { - using var tex = EmuHawk.ReflectionCache.Asm.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.courier16px_0.png"); + using var tex = EmuHawk.ReflectionCache.EmbeddedResourceStream("Resources.courier16px_0.png"); TheOneFont = new StringRenderer(GL, xml, tex); } using (var gens = - EmuHawk.ReflectionCache.Asm.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.gens.ttf")) + EmuHawk.ReflectionCache.EmbeddedResourceStream("Resources.gens.ttf")) { LoadCustomFont(gens); } using (var fceux = - EmuHawk.ReflectionCache.Asm.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.fceux.ttf")) + EmuHawk.ReflectionCache.EmbeddedResourceStream("Resources.fceux.ttf")) { LoadCustomFont(fceux); } diff --git a/src/BizHawk.Client.EmuHawk/Properties/Resources.cs b/src/BizHawk.Client.EmuHawk/Properties/Resources.cs index 1debd5beaf..8ebece95e2 100644 --- a/src/BizHawk.Client.EmuHawk/Properties/Resources.cs +++ b/src/BizHawk.Client.EmuHawk/Properties/Resources.cs @@ -7,14 +7,14 @@ namespace BizHawk.Client.EmuHawk.Properties internal static class Resources { /// Dir separator is '.'. Path is relative to <NS>. - private static Bitmap ReadEmbeddedBitmapAt(string embedPath) => new Bitmap(EmuHawk.ReflectionCache.Asm.GetManifestResourceStream($"BizHawk.Client.EmuHawk.{embedPath}")); + private static Bitmap ReadEmbeddedBitmapAt(string embedPath) => new Bitmap(EmuHawk.ReflectionCache.EmbeddedResourceStream(embedPath)); /// Dir separator is '.'. Filename is relative to <NS>/images and omits .png extension. /// For other file extensions or paths use . private static Bitmap ReadEmbeddedBitmap(string filename) => ReadEmbeddedBitmapAt($"images.{filename}.png"); /// Dir separator is '.'. Filename is relative to <NS>/images and omits .ico extension. - private static Icon ReadEmbeddedIcon(string filename) => new Icon(EmuHawk.ReflectionCache.Asm.GetManifestResourceStream($"BizHawk.Client.EmuHawk.images.{filename}.ico")); + private static Icon ReadEmbeddedIcon(string filename) => new Icon(EmuHawk.ReflectionCache.EmbeddedResourceStream($"images.{filename}.ico")); internal static readonly Lazy A78Joystick = new Lazy(() => ReadEmbeddedBitmap("ControllerImages.A78Joystick")); internal static readonly Lazy AppleIIKeyboard = new Lazy(() => ReadEmbeddedBitmap("ControllerImages.AppleIIKeyboard")); @@ -53,7 +53,7 @@ namespace BizHawk.Client.EmuHawk.Properties internal static readonly Bitmap BackMore = ReadEmbeddedBitmap("BackMore"); internal static readonly Icon BasicBot = ReadEmbeddedIcon("basicbot"); internal static readonly Bitmap Blank = ReadEmbeddedBitmap("Blank"); - internal static readonly Cursor BlankCursor = new Cursor(EmuHawk.ReflectionCache.Asm.GetManifestResourceStream("BizHawk.Client.EmuHawk.images.BlankCursor.cur")); + internal static readonly Cursor BlankCursor = new Cursor(EmuHawk.ReflectionCache.EmbeddedResourceStream("images.BlankCursor.cur")); internal static readonly Bitmap BlueDown = ReadEmbeddedBitmap("BlueDown"); internal static readonly Bitmap BlueUp = ReadEmbeddedBitmap("BlueUp"); internal static readonly Bitmap Both = ReadEmbeddedBitmap("Both"); diff --git a/src/BizHawk.Client.EmuHawk/ReflectionCache.cs b/src/BizHawk.Client.EmuHawk/ReflectionCache.cs index 0d6e32059b..c34d5f73a6 100644 --- a/src/BizHawk.Client.EmuHawk/ReflectionCache.cs +++ b/src/BizHawk.Client.EmuHawk/ReflectionCache.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Reflection; @@ -13,5 +14,7 @@ namespace BizHawk.Client.EmuHawk public static readonly Assembly Asm = typeof(ReflectionCache).Assembly; public static Type[] Types => _types.Value; + + public static Stream EmbeddedResourceStream(string embedPath) => Asm.GetManifestResourceStream($"BizHawk.Client.EmuHawk.{embedPath}"); } } diff --git a/src/BizHawk.Emulation.Cores/Properties/Resources.cs b/src/BizHawk.Emulation.Cores/Properties/Resources.cs index e836350cf9..960fd56ba5 100644 --- a/src/BizHawk.Emulation.Cores/Properties/Resources.cs +++ b/src/BizHawk.Emulation.Cores/Properties/Resources.cs @@ -5,7 +5,7 @@ using BizHawk.Common.IOExtensions; namespace BizHawk.Emulation.Cores.Properties { internal static class Resources { /// Dir separator is '.'. Path is relative to <NS>. - private static byte[] ReadEmbeddedByteArray(string embedPath) => Emulation.Cores.ReflectionCache.Asm.GetManifestResourceStream($"BizHawk.Emulation.Cores.Resources.{embedPath}").ReadAllBytes(); + private static byte[] ReadEmbeddedByteArray(string embedPath) => Emulation.Cores.ReflectionCache.EmbeddedResourceStream($"Resources.{embedPath}").ReadAllBytes(); internal static readonly Lazy CPC_AMSDOS_0_5_ROM = new Lazy(() => ReadEmbeddedByteArray("CPC_AMSDOS_0.5.ROM.gz")); internal static readonly Lazy CPC_BASIC_1_0_ROM = new Lazy(() => ReadEmbeddedByteArray("CPC_BASIC_1.0.ROM.gz")); diff --git a/src/BizHawk.Emulation.Cores/ReflectionCache.cs b/src/BizHawk.Emulation.Cores/ReflectionCache.cs index 15f8c93486..1528cbec50 100644 --- a/src/BizHawk.Emulation.Cores/ReflectionCache.cs +++ b/src/BizHawk.Emulation.Cores/ReflectionCache.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Reflection; namespace BizHawk.Emulation.Cores @@ -10,5 +11,7 @@ namespace BizHawk.Emulation.Cores public static readonly Assembly Asm = typeof(ReflectionCache).Assembly; public static Type[] Types => _types.Value; + + public static Stream EmbeddedResourceStream(string embedPath) => Asm.GetManifestResourceStream($"BizHawk.Emulation.Cores.{embedPath}"); } }