Skip to content

Commit

Permalink
Auto detect Windows vs Linux.
Browse files Browse the repository at this point in the history
And name both panacea and Lua Backend depending on the users OS
  • Loading branch information
shananas committed Jan 25, 2025
1 parent f430a07 commit 2bf86b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
20 changes: 15 additions & 5 deletions OpenKh.Tools.ModsManager/ViewModels/SetupWizardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Text.RegularExpressions;
using System.Threading;
using System.IO.Compression;
using System.Diagnostics;

namespace OpenKh.Tools.ModsManager.ViewModels
{
Expand Down Expand Up @@ -574,12 +575,12 @@ public bool IsLuaBackendInstalled
{
if (PcReleaseLocation != null && GameCollection == 0)
{
return File.Exists(Path.Combine(PcReleaseLocation, "LuaBackend.dll")) &&
return (File.Exists(Path.Combine(PcReleaseLocation, "LuaBackend.dll")) || File.Exists(Path.Combine(PcReleaseLocation, "dinput8.dll"))) &&
File.Exists(Path.Combine(PcReleaseLocation, "LuaBackend.toml"));
}
else if (PcReleaseLocationKH3D != null && GameCollection == 1)
{
return File.Exists(Path.Combine(PcReleaseLocationKH3D, "LuaBackend.dll")) &&
return (File.Exists(Path.Combine(PcReleaseLocationKH3D, "LuaBackend.dll")) || File.Exists(Path.Combine(PcReleaseLocationKH3D, "dinput8.dll"))) &&
File.Exists(Path.Combine(PcReleaseLocationKH3D, "LuaBackend.toml"));
}
else
Expand Down Expand Up @@ -993,7 +994,7 @@ public SetupWizardViewModel()
}
try
{
if (!Convert.ToBoolean(AlternateName))
if(Process.GetProcessesByName("winlogon").Length > 0)
{
File.Copy(PanaceaSourceLocation, PanaceaDestinationLocation, true);
File.Delete(PanaceaAlternateLocation);
Expand Down Expand Up @@ -1192,9 +1193,16 @@ public SetupWizardViewModel()
}
else
{
if (File.Exists((Path.Combine(TempExtractionLocation, "DBGHELP.dll"))))
if (File.Exists(Path.Combine(TempExtractionLocation, "DBGHELP.dll")))
{
File.Move(Path.Combine(TempExtractionLocation, "DBGHELP.dll"), Path.Combine(DestinationCollection, "LuaBackend.dll"), true);
if (Process.GetProcessesByName("winlogon").Length > 0)
{
File.Move(Path.Combine(TempExtractionLocation, "DBGHELP.dll"), Path.Combine(DestinationCollection, "LuaBackend.dll"), true);
}
else
{
File.Move(Path.Combine(TempExtractionLocation, "DBGHELP.dll"), Path.Combine(DestinationCollection, "dinput8.dll"), true);
}
}
if (File.Exists(Path.Combine(TempExtractionLocation, "LuaBackend.toml")))
{
Expand Down Expand Up @@ -1431,11 +1439,13 @@ public SetupWizardViewModel()
if (GameCollection == 0)
{
File.Delete(Path.Combine(PcReleaseLocation, "LuaBackend.dll"));
File.Delete(Path.Combine(PcReleaseLocation, "dinput8.dll"));
File.Delete(Path.Combine(PcReleaseLocation, "LuaBackend.toml"));
}
else if (GameCollection == 1)
{
File.Delete(Path.Combine(PcReleaseLocationKH3D, "LuaBackend.dll"));
File.Delete(Path.Combine(PcReleaseLocation, "dinput8.dll"));
File.Delete(Path.Combine(PcReleaseLocationKH3D, "LuaBackend.toml"));
}
OnPropertyChanged(nameof(IsLuaBackendInstalled));
Expand Down
15 changes: 2 additions & 13 deletions OpenKh.Tools.ModsManager/Views/SetupWizardWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@
<TextBlock Margin="0 0 0 3" TextWrapping="Wrap">
Panacea allows the PC version of Kingdom Hearts to load the mods you have installed, without
modifying the game files.
The file is named 'DBGHELP.dll' for Windows and 'version.dll' for Linux and it can be found in your game's install folder.
Panacea will run every time you start the game and attempt to load built mods. To uninstall Panacea, click Remove Panacea button.
</TextBlock>
<StackPanel Visibility="{Binding PanaceaNotInstalledVisibility}">
Expand All @@ -310,20 +309,10 @@
</TextBlock>
<Button
Margin="0 0 0 6"
Content="Install Panacea for Windows"
Content="Install Panacea"
HorizontalAlignment="Left"
Width="205"
Command="{Binding InstallPanaceaCommand}" CommandParameter="false"/>
<TextBlock Margin="0 0 0 3" TextWrapping="Wrap">
<Run Foreground="Red">WARNING</Run>
linux support is still a WIP. While it does currently work it is a lot of extra setup.
</TextBlock>
<Button
Margin="0 0 0 6"
Content="Install Panacea for Linux"
HorizontalAlignment="Left"
Width="205"
Command="{Binding InstallPanaceaCommand}" CommandParameter="true"/>
Command="{Binding InstallPanaceaCommand}"/>
</StackPanel>
<StackPanel Visibility="{Binding PanaceaInstalledVisibility}">
<TextBlock Margin="0 0 0 3" TextWrapping="Wrap">
Expand Down

0 comments on commit 2bf86b0

Please sign in to comment.