Fix auto-patching and game detection

I also realized that this auto-patching isn't gonna work well, so I should probably resort to file swapping or something
This commit is contained in:
Norbi Peti 2021-05-16 02:11:58 +02:00
parent e36dcb8477
commit a7d26ebdb8

View file

@ -40,8 +40,7 @@ namespace GCMM
if (line.StartsWith("133062..GAME_PATH=") && line.Contains('/')) if (line.StartsWith("133062..GAME_PATH=") && line.Contains('/'))
{ {
gamePathSet = true; gamePathSet = true;
return return $"{line.Replace("/TBMM/", "/")}{(enable ? "TBMM/" : "")}";
$"{line.Substring(0, Math.Max(line.LastIndexOf("TBMM", StringComparison.Ordinal), line.Length))}{(enable ? "TBMM/" : "")}";
} }
return line; return line;
@ -50,7 +49,7 @@ namespace GCMM
} }
return gamePathSet; return gamePathSet;
} } //TODO: Setting the game path might not be a good idea because of updates...
public void EnableDisableAutoPatchingWithDialog(bool enable) public void EnableDisableAutoPatchingWithDialog(bool enable)
{ {
@ -73,7 +72,7 @@ namespace GCMM
if (!File.Exists(launcherConfig)) return null; if (!File.Exists(launcherConfig)) return null;
string path = File.ReadLines(launcherConfig) string path = File.ReadLines(launcherConfig)
.FirstOrDefault(line => line.StartsWith("133062..GAME_PATH=")) .FirstOrDefault(line => line.StartsWith("133062..GAME_PATH="))
?.Substring("133062..GAME_PATH=".Length); ?.Substring("133062..GAME_PATH=".Length).Replace("/TBMM/", "/") + "StandaloneWindows64";
if (path != null && GetExe(path) != null) return path; if (path != null && GetExe(path) != null) return path;
return null; return null;
} }