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

Epic and GOG utils #2128

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aurora.Settings;
using Aurora.Utils;
using System;
using System.IO;
using System.Windows;
Expand Down Expand Up @@ -29,15 +30,35 @@ private void SetSettings()

private void patch_button_Click(object sender, RoutedEventArgs e)
{
if (InstallWrapper())
bool success = false;

var installpath = SteamUtils.GetGamePath(588650);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

installpath = GOGUtils.GetGamePath(1237807960);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora Wrapper Patch installed successfully.");
else
MessageBox.Show("Aurora Wrapper Patch could not be installed.\r\nGame is not installed.");
}

private void unpatch_button_Click(object sender, RoutedEventArgs e)
{
if (UninstallWrapper())
bool success = false;

var installpath = SteamUtils.GetGamePath(588650);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

installpath = GOGUtils.GetGamePath(1237807960);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora Wrapper Patch uninstalled successfully.");
else
MessageBox.Show("Aurora Wrapper Patch could not be uninstalled.\r\nGame is not installed.");
Expand All @@ -58,12 +79,8 @@ private void patch_button_manually_Click(object sender, RoutedEventArgs e)

private int GameID = 588650;

private bool InstallWrapper(string installpath = "")
private bool InstallWrapper(string installpath)
{
if (String.IsNullOrWhiteSpace(installpath))
installpath = Utils.SteamUtils.GetGamePath(this.GameID);


if (!String.IsNullOrWhiteSpace(installpath))
{
using (BinaryWriter razer_wrapper_86 = new BinaryWriter(new FileStream(System.IO.Path.Combine(installpath, "RzChromaSDK.dll"), FileMode.Create)))
Expand All @@ -84,9 +101,8 @@ private bool InstallWrapper(string installpath = "")
}
}

private bool UninstallWrapper()
private bool UninstallWrapper(string installpath)
{
String installpath = Utils.SteamUtils.GetGamePath(this.GameID);
if (!String.IsNullOrWhiteSpace(installpath))
{
string path = System.IO.Path.Combine(installpath, "RzChromaSDK.dll");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aurora.Settings;
using Aurora.Utils;
using System;
using System.IO;
using System.Windows;
Expand Down Expand Up @@ -29,15 +30,35 @@ private void SetSettings()

private void patch_button_Click(object sender, RoutedEventArgs e)
{
if (InstallWrapper())
bool success = false;

var installpath = SteamUtils.GetGamePath(427520);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

installpath = GOGUtils.GetGamePath(1238653230);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora Wrapper Patch installed successfully.");
else
MessageBox.Show("Aurora Wrapper Patch could not be installed.\r\nGame is not installed.");
}

private void unpatch_button_Click(object sender, RoutedEventArgs e)
{
if (UninstallWrapper())
bool success = false;

var installpath = SteamUtils.GetGamePath(427520);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

installpath = GOGUtils.GetGamePath(1238653230);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora Wrapper Patch uninstalled successfully.");
else
MessageBox.Show("Aurora Wrapper Patch could not be uninstalled.\r\nGame is not installed.");
Expand All @@ -56,14 +77,8 @@ private void patch_button_manually_Click(object sender, RoutedEventArgs e)
}
}

private int GameID = 427520;

private bool InstallWrapper(string installpath = "")
private bool InstallWrapper(string installpath)
{
if (String.IsNullOrWhiteSpace(installpath))
installpath = Utils.SteamUtils.GetGamePath(this.GameID);


if (!String.IsNullOrWhiteSpace(installpath))
{
using (BinaryWriter razer_wrapper_86 = new BinaryWriter(new FileStream(System.IO.Path.Combine(installpath, "bin" ,"x64" , "RzChromaSDK.dll"), FileMode.Create)))
Expand All @@ -84,9 +99,8 @@ private bool InstallWrapper(string installpath = "")
}
}

private bool UninstallWrapper()
private bool UninstallWrapper(string installpath)
{
String installpath = Utils.SteamUtils.GetGamePath(this.GameID);
if (!String.IsNullOrWhiteSpace(installpath))
{
string path = System.IO.Path.Combine(installpath, "bin", "x64", "RzChromaSDK.dll");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<TabControl>
<TabItem Header="Overview for Hotline Miami">
<Grid>
<TextBlock Margin="10,30,0,0" VerticalAlignment="Top" TextWrapping="Wrap" HorizontalAlignment="Left" Width="824"><Run Text="In order for Hotline Miami support to work, you have to apply the Aurora Wrapper Patch for LightFX in order for Aurora to receive lighting information. Aurora attempts to automatically install the wrapper on first launch (It will fail to do so if the game was not installed on first launch of Aurora, in which case you need to install the LightFX wrapper). If you wish to uninstall the LightFX wrapper file, you can press &quot;Unpatch Hotline Miami&quot;. After patching, make sure to enable LightFX in the game settings."/><LineBreak/><Run Text="If your copy of Hotline is not from Steam, you can press the &quot;Patch Hotline Miami manually&quot; button and navigate to the location of the &quot;HotlineMiami.exe&quot; file. This uses natively supported LightFX support, but it is still used at your own risk."/></TextBlock>
<TextBlock Margin="10,30,0,0" VerticalAlignment="Top" TextWrapping="Wrap" HorizontalAlignment="Left" Width="824"><Run Text="In order for Hotline Miami support to work, you have to apply the Aurora Wrapper Patch for LightFX in order for Aurora to receive lighting information. Aurora attempts to automatically install the wrapper on first launch (It will fail to do so if the game was not installed on first launch of Aurora, in which case you need to install the LightFX wrapper). If you wish to uninstall the LightFX wrapper file, you can press &quot;Unpatch Hotline Miami&quot;. After patching, make sure to enable LightFX in the game settings."/><LineBreak/><Run Text="If your copy of Hotline is not from Steam"/><Run Text=" or GOG"/><Run Text=", you can press the &quot;Patch Hotline Miami manually&quot; button and navigate to the location of the &quot;HotlineMiami.exe&quot; file. This uses natively supported LightFX support, but it is still used at your own risk."/></TextBlock>
<Button x:Name="patch_button" Content="Patch Hotline Miami" HorizontalAlignment="Left" Margin="10,131,0,0" VerticalAlignment="Top" Click="patch_button_Click"/>
<CheckBox x:Name="game_enabled" Content="Enable Aurora to provide lighting effects with Hotline Miami" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Checked="game_enabled_Checked" Unchecked="game_enabled_Checked"/>
<Button x:Name="unpatch_button" Content="Unpatch Hotline Miami" HorizontalAlignment="Left" Margin="10,156,0,0" VerticalAlignment="Top" Click="unpatch_button_Click"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Aurora.Controls;
using Aurora.Settings;
using Aurora.Utils;
using System;
using System.IO;
using System.Windows;
Expand All @@ -25,7 +26,8 @@ public Control_HM(Application profile)
//Apply LightFX Wrapper, if needed.
if (!(profile_manager.Settings as FirstTimeApplicationSettings).IsFirstTimeInstalled)
{
InstallWrapper();
InstallWrapper(SteamUtils.GetGamePath(219150));
InstallWrapper(GOGUtils.GetGamePath(1207659118));
(profile_manager.Settings as FirstTimeApplicationSettings).IsFirstTimeInstalled = true;
}

Expand All @@ -44,18 +46,38 @@ private void SetSettings()

private void patch_button_Click(object sender, RoutedEventArgs e)
{
if (InstallWrapper())
bool success = false;

var installpath = SteamUtils.GetGamePath(219150);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

installpath = GOGUtils.GetGamePath(1207659118);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora LightFX Wrapper installed successfully.");
else
MessageBox.Show("Aurora LightFX Wrapper could not be installed.\r\nGame is not installed.");
MessageBox.Show("Aurora LightFX Wrapper could not be installed.\r\nGame is not installed over Steam or GOG.");
}

private void unpatch_button_Click(object sender, RoutedEventArgs e)
{
if (UninstallWrapper())
bool success = false;

var installpath = SteamUtils.GetGamePath(219150);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

installpath = GOGUtils.GetGamePath(1207659118);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora LightFX Wrapper uninstalled successfully.");
else
MessageBox.Show("Aurora LightFX Wrapper could not be uninstalled.\r\nGame is not installed.");
MessageBox.Show("Aurora LightFX Wrapper could not be uninstalled.\r\nGame is not installed over Steam or GOG.");
}

private void patch_drm_button_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -89,12 +111,8 @@ private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
}

private bool InstallWrapper(string installpath = "")
private bool InstallWrapper(string installpath)
{
if (String.IsNullOrWhiteSpace(installpath))
installpath = Utils.SteamUtils.GetGamePath(219150);


if (!String.IsNullOrWhiteSpace(installpath))
{
string path = System.IO.Path.Combine(installpath, "LightFX.dll");
Expand All @@ -115,9 +133,8 @@ private bool InstallWrapper(string installpath = "")
}
}

private bool UninstallWrapper()
private bool UninstallWrapper(string installpath)
{
String installpath = Utils.SteamUtils.GetGamePath(219150);
if (!String.IsNullOrWhiteSpace(installpath))
{
string path = System.IO.Path.Combine(installpath, "LightFX.dll");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using System.Windows;
using System.Windows.Controls;
using Aurora.Utils;

namespace Aurora.Profiles.TheTalosPrinciple
{
Expand All @@ -25,7 +26,14 @@ public Control_TalosPrinciple(Application profile)
//Apply LightFX Wrapper, if needed.
if (!(profile_manager.Settings as FirstTimeApplicationSettings).IsFirstTimeInstalled)
{
InstallWrapper();
var installpath = SteamUtils.GetGamePath(257510);
if (!String.IsNullOrWhiteSpace(installpath))
InstallWrapper(installpath);

installpath = EpicUtils.GetGameManifestByExe("talos.exe")?.InstallLocation ?? EpicUtils.GetGameManifestByExe("talos_unrestricted.exe")?.InstallLocation;
if (!String.IsNullOrWhiteSpace(installpath))
InstallWrapper(installpath);

(profile_manager.Settings as FirstTimeApplicationSettings).IsFirstTimeInstalled = true;
}

Expand All @@ -44,15 +52,33 @@ private void SetSettings()

private void patch_button_Click(object sender, RoutedEventArgs e)
{
if (InstallWrapper())
bool success = false;
var installpath = SteamUtils.GetGamePath(257510);
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

installpath = EpicUtils.GetGameManifestByExe("talos.exe")?.InstallLocation ?? EpicUtils.GetGameManifestByExe("talos_unrestricted.exe")?.InstallLocation;
if (!String.IsNullOrWhiteSpace(installpath))
success = InstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora LightFX Wrapper installed successfully.");
else
MessageBox.Show("Aurora LightFX Wrapper could not be installed.\r\nGame is not installed.");
MessageBox.Show("Aurora LightFX Wrapper could not be installed.\r\nGame is not installed over Steam or Epic Games.");
}

private void unpatch_button_Click(object sender, RoutedEventArgs e)
{
if (UninstallWrapper())
bool success = false;
var installpath = SteamUtils.GetGamePath(257510);
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

installpath = EpicUtils.GetGameManifestByExe("talos.exe")?.InstallLocation ?? EpicUtils.GetGameManifestByExe("talos_unrestricted.exe")?.InstallLocation;
if (!String.IsNullOrWhiteSpace(installpath))
success = UninstallWrapper(installpath);

if (success)
MessageBox.Show("Aurora LightFX Wrapper uninstalled successfully.");
else
MessageBox.Show("Aurora LightFX Wrapper could not be uninstalled.\r\nGame is not installed.");
Expand All @@ -75,12 +101,8 @@ private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
}

private bool InstallWrapper(string installpath = "")
private bool InstallWrapper(string installpath)
{
if (String.IsNullOrWhiteSpace(installpath))
installpath = Utils.SteamUtils.GetGamePath(257510);


if (!String.IsNullOrWhiteSpace(installpath))
{
//86
Expand Down Expand Up @@ -113,9 +135,8 @@ private bool InstallWrapper(string installpath = "")
}
}

private bool UninstallWrapper()
private bool UninstallWrapper(string installpath)
{
String installpath = Utils.SteamUtils.GetGamePath(257510);
if (!String.IsNullOrWhiteSpace(installpath))
{
//86
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,62 @@ private void SetSettings()

private void install_mod_button_Click(object sender, RoutedEventArgs e)
{
String installpath = SteamUtils.GetGamePath(292030);
if (!String.IsNullOrWhiteSpace(installpath))//if we find the path through steam
string Steaminstallpath = SteamUtils.GetGamePath(292030);
string Epicinstallpath = EpicUtils.GetGameManifestByExe("Witcher3.exe")?.InstallLocation;
string GOGinstallpath = GOGUtils.GetGamePath(1207664643); //Normal version
string GOGGotyinstallpath = GOGUtils.GetGamePath(1495134320); //GOTY version


if (!String.IsNullOrWhiteSpace(Steaminstallpath) || !String.IsNullOrWhiteSpace(Epicinstallpath) || !String.IsNullOrWhiteSpace(GOGinstallpath) || !String.IsNullOrWhiteSpace(GOGGotyinstallpath))
{
InstallMod(installpath);
if (!String.IsNullOrWhiteSpace(Steaminstallpath))
InstallMod(Steaminstallpath);

if (!String.IsNullOrWhiteSpace(Epicinstallpath))
InstallMod(Epicinstallpath);

if (!String.IsNullOrWhiteSpace(GOGinstallpath))
InstallMod(GOGinstallpath);

if (!String.IsNullOrWhiteSpace(GOGGotyinstallpath))
InstallMod(GOGGotyinstallpath);
}
else//user could have the GOG version of the game
else//user could have the Origin version of the game
{
System.Windows.MessageBox.Show("Witcher 3 was not installed through steam, please pick the path manually");
System.Windows.MessageBox.Show("Witcher 3 was not installed through Steam, Epic Games or GOG, please pick the path manually");
var dialog = new System.Windows.Forms.FolderBrowserDialog();
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
InstallMod(dialog.SelectedPath);
}
}

}

private void uninstall_mod_button_Click(object sender, RoutedEventArgs e)
{
String installpath = SteamUtils.GetGamePath(292030);
if (!String.IsNullOrWhiteSpace(installpath))
string Steaminstallpath = SteamUtils.GetGamePath(292030);
string Epicinstallpath = EpicUtils.GetGameManifestByExe("Witcher3.exe")?.InstallLocation;
string GOGinstallpath = GOGUtils.GetGamePath(1207664643); //Normal version
string GOGGotyinstallpath = GOGUtils.GetGamePath(1495134320); //GOTY version

if (!String.IsNullOrWhiteSpace(Steaminstallpath) || !String.IsNullOrWhiteSpace(Epicinstallpath) || !String.IsNullOrWhiteSpace(GOGinstallpath) || !String.IsNullOrWhiteSpace(GOGGotyinstallpath))
{
UninstallMod(installpath);
if (!String.IsNullOrWhiteSpace(Steaminstallpath))
UninstallMod(Steaminstallpath);

if (!String.IsNullOrWhiteSpace(Epicinstallpath))
UninstallMod(Epicinstallpath);

if (!String.IsNullOrWhiteSpace(GOGinstallpath))
UninstallMod(GOGinstallpath);

if (!String.IsNullOrWhiteSpace(GOGGotyinstallpath))
UninstallMod(GOGGotyinstallpath);
}
else
{
MessageBox.Show("Witcher 3 was not installed through steam, please pick the path manually");
MessageBox.Show("Witcher 3 was not installed through Steam, Epic Games or GOG, please pick the path manually");
var dialog = new System.Windows.Forms.FolderBrowserDialog();
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Expand Down
Loading