Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Os specific wrappers #1

Merged
merged 1 commit into from
Mar 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sims1WidescreenPatcher.Core/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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