Skip to content

Commit 113780d

Browse files
committed
fix configs that autofill the software name
1 parent e9ff1fc commit 113780d

File tree

2 files changed

+51
-66
lines changed

2 files changed

+51
-66
lines changed

FlashpointSecurePlayer/FlashpointSecurePlayer.cs

Lines changed: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace FlashpointSecurePlayer {
1919
public partial class FlashpointSecurePlayer : Form {
2020
private const string APPLICATION_MUTEX_NAME = "Flashpoint Secure Player";
21+
private const string EMPTY_MODE_NAME = "";
2122
private const string FLASHPOINT_LAUNCHER_PARENT_PROCESS_EXE_FILE_NAME = "cmd.exe";
2223
private const string FLASHPOINT_LAUNCHER_PROCESS_NAME = "flashpoint";
2324
private Mutex ApplicationMutex = null;
@@ -32,8 +33,8 @@ public partial class FlashpointSecurePlayer : Form {
3233
private bool RunAsAdministratorModification = false;
3334
private List<string> DownloadsBeforeModificationNames = null;
3435
private bool ActiveX = false;
35-
private string Server = null;
36-
private string Software = null;
36+
private string Server = EMPTY_MODE_NAME;
37+
private string Software = EMPTY_MODE_NAME;
3738
private ProcessStartInfo SoftwareProcessStartInfo = null;
3839
private delegate void ErrorDelegate(string text);
3940

@@ -315,7 +316,7 @@ private async Task StartSecurePlayback() {
315316
ShowError(Properties.Resources.GameNotActiveXControl);
316317
return;
317318
}
318-
319+
319320
GetBinaryType(ModificationsName, out BINARY_TYPE binaryType);
320321

321322
// first, we install the control without a registry backup running
@@ -405,33 +406,7 @@ private async Task StartSecurePlayback() {
405406
securePlaybackProgressBar.Value = 100;
406407
ShowOutput(Properties.Resources.RegistryBackupWasSuccessful);
407408
return;
408-
} else if (!String.IsNullOrEmpty(Server)) {
409-
// switch to server form
410-
ResetProgressBar();
411-
ShowOutput(Properties.Resources.RequiredComponentsAreLoading);
412-
413-
try {
414-
await ActivateModificationsAsync(null, delegate (string text) {
415-
if (text.IndexOf("\n") == -1) {
416-
ShowError(text);
417-
} else {
418-
ShowError();
419-
MessageBox.Show(text, Properties.Resources.FlashpointSecurePlayer, MessageBoxButtons.OK, MessageBoxIcon.Error);
420-
}
421-
422-
throw new InvalidModificationException();
423-
}).ConfigureAwait(true);
424-
} catch (InvalidModificationException) {
425-
return;
426-
}
427-
428-
Server serverForm = new Server(new Uri(Server));
429-
430-
securePlaybackProgressBar.Value = 100;
431-
Hide();
432-
serverForm.Show();
433-
return;
434-
} else if (!String.IsNullOrEmpty(Software)) {
409+
} else {
435410
// switch to synced process
436411
ResetProgressBar();
437412
ShowOutput(Properties.Resources.RequiredComponentsAreLoading);
@@ -451,50 +426,60 @@ await ActivateModificationsAsync(Software, delegate (string text) {
451426
return;
452427
}
453428

454-
securePlaybackProgressBar.Value = 50;
429+
if (!String.IsNullOrEmpty(Server)) {
430+
securePlaybackProgressBar.Value = 50;
431+
Server serverForm = new Server(new Uri(Server));
455432

456-
try {
457-
// default to zero in case of error
458-
int argc = 0;
459-
string[] argv = CommandLineToArgv(Software, out argc);
433+
securePlaybackProgressBar.Value = 100;
434+
Hide();
435+
serverForm.Show();
436+
return;
437+
} else if (!String.IsNullOrEmpty(Software)) {
438+
securePlaybackProgressBar.Value = 50;
460439

461-
if (SoftwareProcessStartInfo == null) {
462-
SoftwareProcessStartInfo = new ProcessStartInfo();
463-
}
440+
try {
441+
// default to zero in case of error
442+
int argc = 0;
443+
string[] argv = CommandLineToArgv(Software, out argc);
464444

465-
SoftwareProcessStartInfo.FileName = Path.GetFullPath(argv[0]);
466-
SoftwareProcessStartInfo.Arguments = GetCommandLineArgumentRange(Software, 1, -1);
467-
SoftwareProcessStartInfo.ErrorDialog = false;
468-
SoftwareProcessStartInfo.WorkingDirectory = Path.GetDirectoryName(Path.GetFullPath(argv[0]));
445+
if (SoftwareProcessStartInfo == null) {
446+
SoftwareProcessStartInfo = new ProcessStartInfo();
447+
}
469448

470-
Process process = Process.Start(SoftwareProcessStartInfo);
449+
SoftwareProcessStartInfo.FileName = Path.GetFullPath(argv[0]);
450+
SoftwareProcessStartInfo.Arguments = GetCommandLineArgumentRange(Software, 1, -1);
451+
SoftwareProcessStartInfo.ErrorDialog = false;
452+
SoftwareProcessStartInfo.WorkingDirectory = Path.GetDirectoryName(Path.GetFullPath(argv[0]));
471453

472-
try {
473-
ProcessSync.Start(process);
474-
} catch (JobObjectException) {
475-
// popup message box and blow up
476-
ShowError();
477-
MessageBox.Show(Properties.Resources.JobObjectNotCreated, Properties.Resources.FlashpointSecurePlayer, MessageBoxButtons.OK, MessageBoxIcon.Error);
478-
process.Kill();
479-
Environment.Exit(-1);
480-
return;
481-
}
454+
Process process = Process.Start(SoftwareProcessStartInfo);
482455

483-
securePlaybackProgressBar.Value = 100;
484-
Hide();
456+
try {
457+
ProcessSync.Start(process);
458+
} catch (JobObjectException) {
459+
// popup message box and blow up
460+
ShowError();
461+
MessageBox.Show(Properties.Resources.JobObjectNotCreated, Properties.Resources.FlashpointSecurePlayer, MessageBoxButtons.OK, MessageBoxIcon.Error);
462+
process.Kill();
463+
Environment.Exit(-1);
464+
return;
465+
}
485466

486-
if (!process.HasExited) {
487-
process.WaitForExit();
488-
}
467+
securePlaybackProgressBar.Value = 100;
468+
Hide();
489469

490-
Application.Exit();
491-
} catch {
492-
Show();
493-
ShowError();
494-
MessageBox.Show(Properties.Resources.ProcessFailedStart, Properties.Resources.FlashpointSecurePlayer, MessageBoxButtons.OK, MessageBoxIcon.Error);
495-
Application.Exit();
470+
if (!process.HasExited) {
471+
process.WaitForExit();
472+
}
473+
474+
Application.Exit();
475+
} catch {
476+
Show();
477+
ShowError();
478+
MessageBox.Show(Properties.Resources.ProcessFailedStart, Properties.Resources.FlashpointSecurePlayer, MessageBoxButtons.OK, MessageBoxIcon.Error);
479+
Application.Exit();
480+
}
481+
return;
496482
}
497-
return;
498483
}
499484
throw new InvalidCurationException();
500485
}

FlashpointSecurePlayer/FlashpointSecurePlayerConfigs/3dgroovegx.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modeTemplates>
1111
<softwareModeTemplate>
1212
<regexes>
13-
<regex name="(.+)" replace="3DGrooveGX\GroovePlayer.exe" />
13+
<regex name="^" replace="3DGrooveGX\GroovePlayer.exe" />
1414
</regexes>
1515
</softwareModeTemplate>
1616
</modeTemplates>

0 commit comments

Comments
 (0)