Skip to content

Commit

Permalink
Added Pandora to the Supports Tools
Browse files Browse the repository at this point in the history
Added Pandora to the Supported Tools drop down menu for Skyrim Special Edition and Skyrim SE GOG.
  • Loading branch information
DuskDweller committed Jan 17, 2025
1 parent 69255b9 commit 454a355
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 0 deletions.
94 changes: 94 additions & 0 deletions Game Modes/SkyrimGOG/SkyrimGOGSupportedTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ public override void SetupCommands()
AddLaunchCommand(new Command("Config#Nemesis", "Config Nemesis", "Configures Nemesis.", imgIcon, ConfigNemesis, true));
}

strCommand = GetPandoraLaunchCommand();
Trace.TraceInformation("Pandora Command: {0} (IsNull={1})", strCommand, (strCommand == null));
if ((strCommand != null) && (File.Exists(strCommand)))
{
imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
AddLaunchCommand(new Command("Pandora", "Launch Pandora", "Launches Pandora.", imgIcon, LaunchPandora, true));
}
else
{
imgIcon = null;
AddLaunchCommand(new Command("Config#Pandora", "Config Pandora", "Configures Pandora.", imgIcon, ConfigPandora, true));
}

strCommand = GetBSLaunchCommand();
Trace.TraceInformation("BodySlide Command: {0} (IsNull={1})", strCommand, (strCommand == null));
if ((strCommand != null) && (File.Exists(strCommand)))
Expand Down Expand Up @@ -236,6 +249,15 @@ private void LaunchNemesis()
Launch(strCommand, null);
}

private void LaunchPandora()
{
Trace.TraceInformation("Launching Pandora");
Trace.Indent();
string strCommand = GetPandoraLaunchCommand();
Trace.TraceInformation("Command: " + strCommand);
Launch(strCommand, null);
}

private void LaunchBS()
{
Trace.TraceInformation("Launching BodySlide");
Expand Down Expand Up @@ -489,6 +511,44 @@ private string GetNemesisLaunchCommand()
return strNemesis;
}

/// <summary>
/// Gets the Pandora launch command.
/// </summary>
/// <returns>The Pandora launch command.</returns>
private string GetPandoraLaunchCommand()
{
string strPandora = string.Empty;

if (EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId].ContainsKey("Pandora"))
{
strPandora = EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"];
if (!string.IsNullOrWhiteSpace(strPandora) && ((strPandora.IndexOfAny(Path.GetInvalidPathChars()) >= 0) || !Directory.Exists(strPandora)))
{
strPandora = string.Empty;
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = string.Empty;
EnvironmentInfo.Settings.Save();
}
}

if (string.IsNullOrEmpty(strPandora))
{
string strPandoraPath = Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, @"Data\Pandora_Engine");
if (Directory.Exists(strPandoraPath))
{
strPandora = Path.GetDirectoryName(strPandoraPath);
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = strPandora;
EnvironmentInfo.Settings.Save();
}
}

if (!string.IsNullOrEmpty(strPandora))
{
strPandora = Path.Combine(strPandora, "Pandora Behaviour Engine+.exe");
}

return strPandora;
}

/// <summary>
/// Gets the BodySlide launch command.
/// </summary>
Expand Down Expand Up @@ -650,6 +710,10 @@ public override void ConfigCommand(string p_strCommandID)
ConfigNemesis();
break;

case "Pandora":
ConfigPandora();
break;

default:
break;
}
Expand Down Expand Up @@ -835,6 +899,36 @@ private void ConfigNemesis()
}
}

private void ConfigPandora()
{
string p_strToolName = "Pandora";
string p_strExecutableName = "Pandora Behaviour Engine+.exe";
string p_strToolID = "Pandora";
Trace.TraceInformation(string.Format("Configuring {0}", p_strToolName));
Trace.Indent();

FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = string.Format("Select the folder where the {0} executable is located.", p_strToolName);
fbd.ShowNewFolderButton = false;

fbd.ShowDialog();

string strPath = fbd.SelectedPath;

if (!string.IsNullOrEmpty(strPath))
if (Directory.Exists(strPath))
{
string strExecutablePath = Path.Combine(strPath, p_strExecutableName);

if (!string.IsNullOrWhiteSpace(strExecutablePath) && File.Exists(strExecutablePath))
{
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId][p_strToolID] = strPath;
EnvironmentInfo.Settings.Save();
OnChangedToolPath(new EventArgs());
}
}
}

private void ConfigBS()
{
string p_strToolName = "BS2";
Expand Down
94 changes: 94 additions & 0 deletions Game Modes/SkyrimSE/SkyrimSESupportedTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ public override void SetupCommands()
AddLaunchCommand(new Command("Config#Nemesis", "Config Nemesis", "Configures Nemesis.", imgIcon, ConfigNemesis, true));
}

strCommand = GetPandoraLaunchCommand();
Trace.TraceInformation("Pandora Command: {0} (IsNull={1})", strCommand, (strCommand == null));
if ((strCommand != null) && (File.Exists(strCommand)))
{
imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
AddLaunchCommand(new Command("Pandora", "Launch Pandora", "Launches Pandora.", imgIcon, LaunchPandora, true));
}
else
{
imgIcon = null;
AddLaunchCommand(new Command("Config#Pandora", "Config Pandora", "Configures Pandora.", imgIcon, ConfigPandora, true));
}

strCommand = GetBSLaunchCommand();
Trace.TraceInformation("BodySlide Command: {0} (IsNull={1})", strCommand, (strCommand == null));
if ((strCommand != null) && (File.Exists(strCommand)))
Expand Down Expand Up @@ -236,6 +249,15 @@ private void LaunchNemesis()
Launch(strCommand, null);
}

private void LaunchPandora()
{
Trace.TraceInformation("Launching Pandora");
Trace.Indent();
string strCommand = GetPandoraLaunchCommand();
Trace.TraceInformation("Command: " + strCommand);
Launch(strCommand, null);
}

private void LaunchBS()
{
Trace.TraceInformation("Launching BodySlide");
Expand Down Expand Up @@ -489,6 +511,44 @@ private string GetNemesisLaunchCommand()
return strNemesis;
}

/// <summary>
/// Gets the Pandora launch command.
/// </summary>
/// <returns>The Pandora launch command.</returns>
private string GetPandoraLaunchCommand()
{
string strPandora = string.Empty;

if (EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId].ContainsKey("Pandora"))
{
strPandora = EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"];
if (!string.IsNullOrWhiteSpace(strPandora) && ((strPandora.IndexOfAny(Path.GetInvalidPathChars()) >= 0) || !Directory.Exists(strPandora)))
{
strPandora = string.Empty;
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = string.Empty;
EnvironmentInfo.Settings.Save();
}
}

if (string.IsNullOrEmpty(strPandora))
{
string strPandoraPath = Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, @"Data\Pandora_Engine");
if (Directory.Exists(strPandoraPath))
{
strPandora = Path.GetDirectoryName(strPandoraPath);
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = strPandora;
EnvironmentInfo.Settings.Save();
}
}

if (!string.IsNullOrEmpty(strPandora))
{
strPandora = Path.Combine(strPandora, "Pandora Behaviour Engine+.exe");
}

return strPandora;
}

/// <summary>
/// Gets the BodySlide launch command.
/// </summary>
Expand Down Expand Up @@ -650,6 +710,10 @@ public override void ConfigCommand(string p_strCommandID)
ConfigNemesis();
break;

case "Pandora":
ConfigPandora();
break;

default:
break;
}
Expand Down Expand Up @@ -835,6 +899,36 @@ private void ConfigNemesis()
}
}

private void ConfigPandora()
{
string p_strToolName = "Pandora";
string p_strExecutableName = "Pandora Behaviour Engine+.exe";
string p_strToolID = "Pandora";
Trace.TraceInformation(string.Format("Configuring {0}", p_strToolName));
Trace.Indent();

FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = string.Format("Select the folder where the {0} executable is located.", p_strToolName);
fbd.ShowNewFolderButton = false;

fbd.ShowDialog();

string strPath = fbd.SelectedPath;

if (!string.IsNullOrEmpty(strPath))
if (Directory.Exists(strPath))
{
string strExecutablePath = Path.Combine(strPath, p_strExecutableName);

if (!string.IsNullOrWhiteSpace(strExecutablePath) && File.Exists(strExecutablePath))
{
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId][p_strToolID] = strPath;
EnvironmentInfo.Settings.Save();
OnChangedToolPath(new EventArgs());
}
}
}

private void ConfigBS()
{
string p_strToolName = "BS2";
Expand Down

0 comments on commit 454a355

Please sign in to comment.