Skip to content

Commit

Permalink
Os specific wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
FaithBeam committed Mar 19, 2023
1 parent 9390026 commit 5e16d98
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sims1WidescreenPatcher.Core/ViewModels/MainWindowViewModel.cs
@@ -1,5 +1,6 @@
using System.Reactive;
using System.Reactive.Linq;
using System.Runtime.InteropServices;
using System.Windows.Input;
using Avalonia.Collections;
using ReactiveUI;
Expand Down Expand Up @@ -118,8 +119,7 @@ private bool IsBusy
}
}

public AvaloniaList<WrapperUtility.Wrapper> Wrappers { get; } =
new(WrapperUtility.Wrapper.DDrawCompat, WrapperUtility.Wrapper.DgVoodoo2, WrapperUtility.Wrapper.None);
public AvaloniaList<WrapperUtility.Wrapper> Wrappers => new(WrapperUtility.GetWrappers());

public WrapperUtility.Wrapper SelectedWrapper
{
Expand Down
19 changes: 18 additions & 1 deletion Sims1WidescreenPatcher.Utilities/WrapperUtility.cs
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Runtime.InteropServices;
using Serilog;

namespace Sims1WidescreenPatcher.Utilities;
Expand All @@ -12,11 +13,27 @@ public enum Wrapper
DgVoodoo2
}

private static string[] _ddrawCompatResources = {"ddraw.dll"};
private static string[] _ddrawCompatResources = { "ddraw.dll" };

private static string[] _dgvoodooResources =
{"D3D8.dll", "D3DImm.dll", "DDraw.dll", "dgVoodoo.conf", "dgVoodooCpl.exe"};

public static List<Wrapper> GetWrappers()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return new List<Wrapper> { Wrapper.DDrawCompat, Wrapper.DgVoodoo2, Wrapper.None };
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return new List<Wrapper> { Wrapper.None, Wrapper.DgVoodoo2 };
}
else
{
return new List<Wrapper> { Wrapper.None };
}
}

public static async Task ExtractWrapper(Wrapper wrapper, string path)
{
Log.Information("Begin extract wrapper");
Expand Down

0 comments on commit 5e16d98

Please sign in to comment.