From a7d26ebdb8ab851189c1893320f7649129d761fd Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 16 May 2021 02:11:58 +0200 Subject: [PATCH] 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 --- GCMM/MainUtils.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/GCMM/MainUtils.cs b/GCMM/MainUtils.cs index bf9f474..54d4c5b 100644 --- a/GCMM/MainUtils.cs +++ b/GCMM/MainUtils.cs @@ -40,8 +40,7 @@ namespace GCMM if (line.StartsWith("133062..GAME_PATH=") && line.Contains('/')) { gamePathSet = true; - return - $"{line.Substring(0, Math.Max(line.LastIndexOf("TBMM", StringComparison.Ordinal), line.Length))}{(enable ? "TBMM/" : "")}"; + return $"{line.Replace("/TBMM/", "/")}{(enable ? "TBMM/" : "")}"; } return line; @@ -50,7 +49,7 @@ namespace GCMM } return gamePathSet; - } + } //TODO: Setting the game path might not be a good idea because of updates... public void EnableDisableAutoPatchingWithDialog(bool enable) { @@ -73,7 +72,7 @@ namespace GCMM if (!File.Exists(launcherConfig)) return null; string path = File.ReadLines(launcherConfig) .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; return null; }