diff --git a/TBMM/MainUtils.cs b/TBMM/MainUtils.cs
index cf08dd2..db82cad 100644
--- a/TBMM/MainUtils.cs
+++ b/TBMM/MainUtils.cs
@@ -109,6 +109,7 @@ namespace TBMM
private void HandleGameExit(object sender, EventArgs e)
{
+ Debug.WriteLine("Handling game exit");
_gameProcess = (null, false);
if (InvokeMethod(CheckIfPatched) != GameState.Patched || Configuration.KeepPatched)
return;
@@ -128,27 +129,37 @@ namespace TBMM
private bool CheckIfGameIsRunning()
{
+ Debug.WriteLine($"Check if game is running: {_gameProcess}");
switch (_gameProcess.Process)
{
case { HasExited: false }:
+ Debug.WriteLine("Game has not exited");
return true;
case { HasExited: true }:
+ Debug.WriteLine("Game has exited, dialog shown");
MessageBox.Show("Game has exited without handling... Please report.");
HandleGameExit(null, EventArgs.Empty);
return false;
default:
+ Debug.WriteLine($"Process seems to be null: {_gameProcess}");
if (_gameProcess.Process?.HasExited ?? true)
+ {
_gameProcess = (Process.GetProcessesByName(GetExe(withExtension: false)).FirstOrDefault(), false);
+ Debug.WriteLine($"Game process exited already, got new process object: {_gameProcess}");
+ }
if (_gameProcess.Process == null) return false;
if (_gameProcess.Process.HasExited)
{
+ Debug.WriteLine($"Game has exited already: {_gameProcess}");
HandleGameExit(null, EventArgs.Empty);
return false;
}
else
{
+ Debug.WriteLine($"Game is still running");
if (_gameProcess.ExitHandlerAdded) return true;
+ Debug.WriteLine("Game running and no exit handler yet, adding it");
_gameProcess.Process.Exited += HandleGameExit;
_gameProcess.Process.EnableRaisingEvents = true;
_gameProcess.ExitHandlerAdded = true;
diff --git a/TBMM/TBMM.csproj b/TBMM/TBMM.csproj
index 9898069..d8bfd39 100644
--- a/TBMM/TBMM.csproj
+++ b/TBMM/TBMM.csproj
@@ -6,7 +6,7 @@
true
false
favicon.ico
- 1.5.0
+ 1.6.0
NorbiPeti
ExMods
A mod manager for Techblox. It automatically downloads and runs GCIPA and allows the user to install mods.