Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehjohn committed Aug 15, 2024
1 parent 93577c8 commit 9281374
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
7 changes: 6 additions & 1 deletion src/Zen.Desktop.Host/Infrastructure/CharacterMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ private CharacterMap()

public int GetCharacterStartPixel(char character)
{
return _characterMap[character];
if (_characterMap.TryGetValue(character, out var pixel))
{
return pixel;
}

return _characterMap['?'];
}

private void InitialiseCharacterMap()
Expand Down
24 changes: 17 additions & 7 deletions src/Zen.Desktop.Host/Infrastructure/Settings/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.Json;
using Zen.Common.Infrastructure;
using Zen.System.Infrastructure;
Expand Down Expand Up @@ -34,23 +35,32 @@ public class AppSettings

private static AppSettings GetAppSettings()
{
AppSettings settings;
var settings = new AppSettings
{
AudioEngine = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
? AudioEngine.Bass
: AudioEngine.PortAudio,
ScaleFactor = 2,
Sound = true,
SystemModel = Model.SpectrumPlus2
};

try
{
var json = File.ReadAllText(SettingsFile);

settings = JsonSerializer.Deserialize<AppSettings>(json);
if (File.Exists(SettingsFile))
{
var json = File.ReadAllText(SettingsFile);

settings.Speed = Speed.Normal;
settings = JsonSerializer.Deserialize<AppSettings>(json);
}
}
catch (Exception exception)
{
Logger.LogException(nameof(AppSettings), exception);

settings = new AppSettings();
}

settings.Speed = Speed.Normal;

return settings;
}

Expand Down
3 changes: 0 additions & 3 deletions src/Zen.Desktop.Host/Zen.Desktop.Host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
<ProjectReference Include="..\Zen.Utilities\Zen.Utilities.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="app-settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Rom Images\ZX Spectrum +2\image-0.rom">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
9 changes: 0 additions & 9 deletions src/Zen.Desktop.Host/app-settings.json

This file was deleted.

0 comments on commit 9281374

Please sign in to comment.