diff --git a/resources/images/favicon.ico b/resources/images/favicon.ico new file mode 100644 index 00000000..f804586d Binary files /dev/null and b/resources/images/favicon.ico differ diff --git a/resources/images/favicon.png b/resources/images/favicon.png new file mode 100644 index 00000000..44bc7cf0 Binary files /dev/null and b/resources/images/favicon.png differ diff --git a/resources/images/logo.png b/resources/images/logo.png new file mode 100644 index 00000000..daad1737 Binary files /dev/null and b/resources/images/logo.png differ diff --git a/resources/images/logo2.png b/resources/images/logo2.png new file mode 100644 index 00000000..fb0f3652 Binary files /dev/null and b/resources/images/logo2.png differ diff --git a/src/apps/Highbyte.DotNet6502.App.SadConsole/EmulatorConfig.cs b/src/apps/Highbyte.DotNet6502.App.SadConsole/EmulatorConfig.cs index 029ddbca..f7c6c87a 100644 --- a/src/apps/Highbyte.DotNet6502.App.SadConsole/EmulatorConfig.cs +++ b/src/apps/Highbyte.DotNet6502.App.SadConsole/EmulatorConfig.cs @@ -11,8 +11,6 @@ public class EmulatorConfig { public const string ConfigSectionName = "Highbyte.DotNet6502.SadConsoleConfig"; - public string WindowTitle { get; set; } - /// /// Optional. Font used for the UI. If not specified, default SadConsole font is used. /// To use a specific SadConsole Font, include it in your program output directory. @@ -53,7 +51,6 @@ public class EmulatorConfig public EmulatorConfig() { - WindowTitle = "SadConsole + Highbyte.DotNet6502 emulator."; UIFont = null; UIFontSize = Sizes.One; DefaultEmulator = "C64"; diff --git a/src/apps/Highbyte.DotNet6502.App.SadConsole/Highbyte.DotNet6502.App.SadConsole.csproj b/src/apps/Highbyte.DotNet6502.App.SadConsole/Highbyte.DotNet6502.App.SadConsole.csproj index 6d35ed31..b9491551 100644 --- a/src/apps/Highbyte.DotNet6502.App.SadConsole/Highbyte.DotNet6502.App.SadConsole.csproj +++ b/src/apps/Highbyte.DotNet6502.App.SadConsole/Highbyte.DotNet6502.App.SadConsole.csproj @@ -5,8 +5,17 @@ net8.0 enable enable + favicon.ico + + + + + + + + diff --git a/src/apps/Highbyte.DotNet6502.App.SadConsole/SadConsoleHostApp.cs b/src/apps/Highbyte.DotNet6502.App.SadConsole/SadConsoleHostApp.cs index dd7af34b..ed0f92d7 100644 --- a/src/apps/Highbyte.DotNet6502.App.SadConsole/SadConsoleHostApp.cs +++ b/src/apps/Highbyte.DotNet6502.App.SadConsole/SadConsoleHostApp.cs @@ -11,7 +11,6 @@ using SadRogue.Primitives; using Console = SadConsole.Console; - namespace Highbyte.DotNet6502.App.SadConsole; /// @@ -129,7 +128,7 @@ public void Run() .AddFrameRenderEvent(RenderSadConsole) ; - Settings.WindowTitle = _emulatorConfig.WindowTitle; + Settings.WindowTitle = "Highbyte.DotNet6502 emulator + SadConsole (with NAudio)"; Settings.ResizeMode = Settings.WindowResizeOptions.None; // Start SadConsole window diff --git a/src/apps/Highbyte.DotNet6502.App.SadConsole/appsettings.json b/src/apps/Highbyte.DotNet6502.App.SadConsole/appsettings.json index 4eb810c6..d4ffd4e0 100644 --- a/src/apps/Highbyte.DotNet6502.App.SadConsole/appsettings.json +++ b/src/apps/Highbyte.DotNet6502.App.SadConsole/appsettings.json @@ -1,7 +1,5 @@ { "Highbyte.DotNet6502.SadConsoleConfig": { - - "WindowTitle": "Highbyte.DotNet6502 emulator + SadConsole", "DefaultEmulator": "C64", "UIFont": null, // UI Console font. Leave blank for default SadConsole font. "UIFontSize": "One", // UI consoles font (not Emulator console). Possible values: "Quarter", "Half, "One", "Two", "Three", "Four", "Five" diff --git a/src/apps/Highbyte.DotNet6502.App.SadConsole/favicon.ico b/src/apps/Highbyte.DotNet6502.App.SadConsole/favicon.ico new file mode 100644 index 00000000..f804586d Binary files /dev/null and b/src/apps/Highbyte.DotNet6502.App.SadConsole/favicon.ico differ diff --git a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Highbyte.DotNet6502.App.SilkNetNative.csproj b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Highbyte.DotNet6502.App.SilkNetNative.csproj index 4d987144..df7b6df5 100644 --- a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Highbyte.DotNet6502.App.SilkNetNative.csproj +++ b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Highbyte.DotNet6502.App.SilkNetNative.csproj @@ -7,6 +7,10 @@ enable + + + + @@ -32,4 +36,8 @@ + + + + \ No newline at end of file diff --git a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Program.cs b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Program.cs index 6fe761dc..d635101e 100644 --- a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Program.cs +++ b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/Program.cs @@ -62,7 +62,7 @@ windowOptions.VSync = false; // TODO: With Vsync=true Silk.NET seem to use incorrect UpdatePerSecond. The actual FPS its called is 10 lower than it should be (measured in the OnUpdate method) windowOptions.WindowState = WindowState.Normal; -windowOptions.Title = "Highbyte.DotNet6502 emulator in Silk.NET window (+ SkiaSharp, OpenGL, and NAudio)"; +windowOptions.Title = "Highbyte.DotNet6502 emulator + Silk.NET (with SkiaSharp, OpenGL, NAudio)"; windowOptions.Size = new Vector2D(windowWidth, windowHeight); windowOptions.WindowBorder = WindowBorder.Fixed; windowOptions.API = GraphicsAPI.Default; // = Default = OpenGL 3.3 with forward compatibility diff --git a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetHostApp.cs b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetHostApp.cs index 077c6209..b8c994b6 100644 --- a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetHostApp.cs +++ b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetHostApp.cs @@ -6,6 +6,7 @@ using Highbyte.DotNet6502.Systems; using Highbyte.DotNet6502.Systems.Logging.InMem; using Microsoft.Extensions.Logging; +using Silk.NET.Core; namespace Highbyte.DotNet6502.App.SilkNetNative; @@ -115,6 +116,8 @@ protected void OnLoad() { SetUninitializedWindow(); + SetIcon(); + _renderContextContainer = CreateRenderContext(); _inputHandlerContext = CreateInputHandlerContext(); _audioHandlerContext = CreateAudioHandlerContext(); @@ -143,6 +146,13 @@ protected void OnLoad() _imGuiWindows.Add(_logsPanel); } + private void SetIcon() + { + //RawImage icon = SilkNetImageLoader.ReadFileAsRawImage("../../../../../../resources/images/favicon.ico"); + RawImage icon = SilkNetImageLoader.ReadFileAsRawImage("Highbyte.DotNet6502.App.SilkNetNative.Resources.Images.favicon.ico", isEmbeddedResource: true); + _window.SetWindowIcon(ref icon); + } + protected void OnClosing() { base.Close(); diff --git a/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetImageLoader.cs b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetImageLoader.cs new file mode 100644 index 00000000..0f28071e --- /dev/null +++ b/src/apps/Highbyte.DotNet6502.App.SilkNetNative/SilkNetImageLoader.cs @@ -0,0 +1,42 @@ +using System.Reflection; +using Silk.NET.Core; + +namespace Highbyte.DotNet6502.App.SilkNetNative; +public class SilkNetImageLoader +{ + public static RawImage ReadFileAsRawImage(string path, bool isEmbeddedResource = false) + { + byte[] fileBytes; + if (isEmbeddedResource) + { + Assembly assembly = Assembly.GetExecutingAssembly(); + using (Stream? resourceStream = assembly.GetManifestResourceStream(path)) + { + if (resourceStream == null) + throw new Exception($"Cannot open stream to resource {path} in current assembly."); + using (MemoryStream ms = new MemoryStream()) + { + resourceStream.CopyTo(ms); + fileBytes = ms.ToArray(); + } + } + } + else + { + fileBytes = File.ReadAllBytes(path); + } + + var bitmap = SKBitmap.Decode(fileBytes); + byte[] bytes = new byte[bitmap.Pixels.Length * 4]; + int index = 0; + foreach (var pixel in bitmap.Pixels) + { + bytes[index++] = pixel.Red; + bytes[index++] = pixel.Green; + bytes[index++] = pixel.Blue; + bytes[index++] = pixel.Alpha; + } + var rawImage = new RawImage(bitmap.Width, bitmap.Height, new Memory(bytes)); + return rawImage; + } +} diff --git a/src/apps/Highbyte.DotNet6502.App.WASM/Highbyte.DotNet6502.App.WASM.csproj b/src/apps/Highbyte.DotNet6502.App.WASM/Highbyte.DotNet6502.App.WASM.csproj index 511bbfa8..1d8bb3ad 100644 --- a/src/apps/Highbyte.DotNet6502.App.WASM/Highbyte.DotNet6502.App.WASM.csproj +++ b/src/apps/Highbyte.DotNet6502.App.WASM/Highbyte.DotNet6502.App.WASM.csproj @@ -43,6 +43,7 @@ + @@ -58,4 +59,8 @@ + + + + diff --git a/src/apps/Highbyte.DotNet6502.App.WASM/Pages/Index.razor b/src/apps/Highbyte.DotNet6502.App.WASM/Pages/Index.razor index 4c2a4274..b67ad477 100644 --- a/src/apps/Highbyte.DotNet6502.App.WASM/Pages/Index.razor +++ b/src/apps/Highbyte.DotNet6502.App.WASM/Pages/Index.razor @@ -111,9 +111,10 @@
-

- The DotNet 6502 emulator! -

+

+ + The DotNet 6502 emulator! +

A 6502 CPU emulator written in .NET, rendered with SkiaSharp, compiled to WebAssembly via Blazor, running in a browser. diff --git a/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/favicon.ico b/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/favicon.ico index 63e859b4..f804586d 100644 Binary files a/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/favicon.ico and b/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/favicon.ico differ diff --git a/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/images/logo.png b/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/images/logo.png new file mode 100644 index 00000000..daad1737 Binary files /dev/null and b/src/apps/Highbyte.DotNet6502.App.WASM/wwwroot/images/logo.png differ