Skip to content

Commit 454a355

Browse files
committed
Added Pandora to the Supports Tools
Added Pandora to the Supported Tools drop down menu for Skyrim Special Edition and Skyrim SE GOG.
1 parent 69255b9 commit 454a355

File tree

2 files changed

+188
-0
lines changed

2 files changed

+188
-0
lines changed

Diff for: Game Modes/SkyrimGOG/SkyrimGOGSupportedTools.cs

+94
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,19 @@ public override void SetupCommands()
129129
AddLaunchCommand(new Command("Config#Nemesis", "Config Nemesis", "Configures Nemesis.", imgIcon, ConfigNemesis, true));
130130
}
131131

132+
strCommand = GetPandoraLaunchCommand();
133+
Trace.TraceInformation("Pandora Command: {0} (IsNull={1})", strCommand, (strCommand == null));
134+
if ((strCommand != null) && (File.Exists(strCommand)))
135+
{
136+
imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
137+
AddLaunchCommand(new Command("Pandora", "Launch Pandora", "Launches Pandora.", imgIcon, LaunchPandora, true));
138+
}
139+
else
140+
{
141+
imgIcon = null;
142+
AddLaunchCommand(new Command("Config#Pandora", "Config Pandora", "Configures Pandora.", imgIcon, ConfigPandora, true));
143+
}
144+
132145
strCommand = GetBSLaunchCommand();
133146
Trace.TraceInformation("BodySlide Command: {0} (IsNull={1})", strCommand, (strCommand == null));
134147
if ((strCommand != null) && (File.Exists(strCommand)))
@@ -236,6 +249,15 @@ private void LaunchNemesis()
236249
Launch(strCommand, null);
237250
}
238251

252+
private void LaunchPandora()
253+
{
254+
Trace.TraceInformation("Launching Pandora");
255+
Trace.Indent();
256+
string strCommand = GetPandoraLaunchCommand();
257+
Trace.TraceInformation("Command: " + strCommand);
258+
Launch(strCommand, null);
259+
}
260+
239261
private void LaunchBS()
240262
{
241263
Trace.TraceInformation("Launching BodySlide");
@@ -489,6 +511,44 @@ private string GetNemesisLaunchCommand()
489511
return strNemesis;
490512
}
491513

514+
/// <summary>
515+
/// Gets the Pandora launch command.
516+
/// </summary>
517+
/// <returns>The Pandora launch command.</returns>
518+
private string GetPandoraLaunchCommand()
519+
{
520+
string strPandora = string.Empty;
521+
522+
if (EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId].ContainsKey("Pandora"))
523+
{
524+
strPandora = EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"];
525+
if (!string.IsNullOrWhiteSpace(strPandora) && ((strPandora.IndexOfAny(Path.GetInvalidPathChars()) >= 0) || !Directory.Exists(strPandora)))
526+
{
527+
strPandora = string.Empty;
528+
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = string.Empty;
529+
EnvironmentInfo.Settings.Save();
530+
}
531+
}
532+
533+
if (string.IsNullOrEmpty(strPandora))
534+
{
535+
string strPandoraPath = Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, @"Data\Pandora_Engine");
536+
if (Directory.Exists(strPandoraPath))
537+
{
538+
strPandora = Path.GetDirectoryName(strPandoraPath);
539+
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = strPandora;
540+
EnvironmentInfo.Settings.Save();
541+
}
542+
}
543+
544+
if (!string.IsNullOrEmpty(strPandora))
545+
{
546+
strPandora = Path.Combine(strPandora, "Pandora Behaviour Engine+.exe");
547+
}
548+
549+
return strPandora;
550+
}
551+
492552
/// <summary>
493553
/// Gets the BodySlide launch command.
494554
/// </summary>
@@ -650,6 +710,10 @@ public override void ConfigCommand(string p_strCommandID)
650710
ConfigNemesis();
651711
break;
652712

713+
case "Pandora":
714+
ConfigPandora();
715+
break;
716+
653717
default:
654718
break;
655719
}
@@ -835,6 +899,36 @@ private void ConfigNemesis()
835899
}
836900
}
837901

902+
private void ConfigPandora()
903+
{
904+
string p_strToolName = "Pandora";
905+
string p_strExecutableName = "Pandora Behaviour Engine+.exe";
906+
string p_strToolID = "Pandora";
907+
Trace.TraceInformation(string.Format("Configuring {0}", p_strToolName));
908+
Trace.Indent();
909+
910+
FolderBrowserDialog fbd = new FolderBrowserDialog();
911+
fbd.Description = string.Format("Select the folder where the {0} executable is located.", p_strToolName);
912+
fbd.ShowNewFolderButton = false;
913+
914+
fbd.ShowDialog();
915+
916+
string strPath = fbd.SelectedPath;
917+
918+
if (!string.IsNullOrEmpty(strPath))
919+
if (Directory.Exists(strPath))
920+
{
921+
string strExecutablePath = Path.Combine(strPath, p_strExecutableName);
922+
923+
if (!string.IsNullOrWhiteSpace(strExecutablePath) && File.Exists(strExecutablePath))
924+
{
925+
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId][p_strToolID] = strPath;
926+
EnvironmentInfo.Settings.Save();
927+
OnChangedToolPath(new EventArgs());
928+
}
929+
}
930+
}
931+
838932
private void ConfigBS()
839933
{
840934
string p_strToolName = "BS2";

Diff for: Game Modes/SkyrimSE/SkyrimSESupportedTools.cs

+94
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,19 @@ public override void SetupCommands()
129129
AddLaunchCommand(new Command("Config#Nemesis", "Config Nemesis", "Configures Nemesis.", imgIcon, ConfigNemesis, true));
130130
}
131131

132+
strCommand = GetPandoraLaunchCommand();
133+
Trace.TraceInformation("Pandora Command: {0} (IsNull={1})", strCommand, (strCommand == null));
134+
if ((strCommand != null) && (File.Exists(strCommand)))
135+
{
136+
imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null;
137+
AddLaunchCommand(new Command("Pandora", "Launch Pandora", "Launches Pandora.", imgIcon, LaunchPandora, true));
138+
}
139+
else
140+
{
141+
imgIcon = null;
142+
AddLaunchCommand(new Command("Config#Pandora", "Config Pandora", "Configures Pandora.", imgIcon, ConfigPandora, true));
143+
}
144+
132145
strCommand = GetBSLaunchCommand();
133146
Trace.TraceInformation("BodySlide Command: {0} (IsNull={1})", strCommand, (strCommand == null));
134147
if ((strCommand != null) && (File.Exists(strCommand)))
@@ -236,6 +249,15 @@ private void LaunchNemesis()
236249
Launch(strCommand, null);
237250
}
238251

252+
private void LaunchPandora()
253+
{
254+
Trace.TraceInformation("Launching Pandora");
255+
Trace.Indent();
256+
string strCommand = GetPandoraLaunchCommand();
257+
Trace.TraceInformation("Command: " + strCommand);
258+
Launch(strCommand, null);
259+
}
260+
239261
private void LaunchBS()
240262
{
241263
Trace.TraceInformation("Launching BodySlide");
@@ -489,6 +511,44 @@ private string GetNemesisLaunchCommand()
489511
return strNemesis;
490512
}
491513

514+
/// <summary>
515+
/// Gets the Pandora launch command.
516+
/// </summary>
517+
/// <returns>The Pandora launch command.</returns>
518+
private string GetPandoraLaunchCommand()
519+
{
520+
string strPandora = string.Empty;
521+
522+
if (EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId].ContainsKey("Pandora"))
523+
{
524+
strPandora = EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"];
525+
if (!string.IsNullOrWhiteSpace(strPandora) && ((strPandora.IndexOfAny(Path.GetInvalidPathChars()) >= 0) || !Directory.Exists(strPandora)))
526+
{
527+
strPandora = string.Empty;
528+
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = string.Empty;
529+
EnvironmentInfo.Settings.Save();
530+
}
531+
}
532+
533+
if (string.IsNullOrEmpty(strPandora))
534+
{
535+
string strPandoraPath = Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, @"Data\Pandora_Engine");
536+
if (Directory.Exists(strPandoraPath))
537+
{
538+
strPandora = Path.GetDirectoryName(strPandoraPath);
539+
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId]["Pandora"] = strPandora;
540+
EnvironmentInfo.Settings.Save();
541+
}
542+
}
543+
544+
if (!string.IsNullOrEmpty(strPandora))
545+
{
546+
strPandora = Path.Combine(strPandora, "Pandora Behaviour Engine+.exe");
547+
}
548+
549+
return strPandora;
550+
}
551+
492552
/// <summary>
493553
/// Gets the BodySlide launch command.
494554
/// </summary>
@@ -650,6 +710,10 @@ public override void ConfigCommand(string p_strCommandID)
650710
ConfigNemesis();
651711
break;
652712

713+
case "Pandora":
714+
ConfigPandora();
715+
break;
716+
653717
default:
654718
break;
655719
}
@@ -835,6 +899,36 @@ private void ConfigNemesis()
835899
}
836900
}
837901

902+
private void ConfigPandora()
903+
{
904+
string p_strToolName = "Pandora";
905+
string p_strExecutableName = "Pandora Behaviour Engine+.exe";
906+
string p_strToolID = "Pandora";
907+
Trace.TraceInformation(string.Format("Configuring {0}", p_strToolName));
908+
Trace.Indent();
909+
910+
FolderBrowserDialog fbd = new FolderBrowserDialog();
911+
fbd.Description = string.Format("Select the folder where the {0} executable is located.", p_strToolName);
912+
fbd.ShowNewFolderButton = false;
913+
914+
fbd.ShowDialog();
915+
916+
string strPath = fbd.SelectedPath;
917+
918+
if (!string.IsNullOrEmpty(strPath))
919+
if (Directory.Exists(strPath))
920+
{
921+
string strExecutablePath = Path.Combine(strPath, p_strExecutableName);
922+
923+
if (!string.IsNullOrWhiteSpace(strExecutablePath) && File.Exists(strExecutablePath))
924+
{
925+
EnvironmentInfo.Settings.SupportedTools[GameMode.ModeId][p_strToolID] = strPath;
926+
EnvironmentInfo.Settings.Save();
927+
OnChangedToolPath(new EventArgs());
928+
}
929+
}
930+
}
931+
838932
private void ConfigBS()
839933
{
840934
string p_strToolName = "BS2";

0 commit comments

Comments
 (0)