diff --git a/SA-Mod-Manager/Controls/SA2/GameConfig.xaml.cs b/SA-Mod-Manager/Controls/SA2/GameConfig.xaml.cs index b5d29808..9499e6e0 100644 --- a/SA-Mod-Manager/Controls/SA2/GameConfig.xaml.cs +++ b/SA-Mod-Manager/Controls/SA2/GameConfig.xaml.cs @@ -30,9 +30,9 @@ public GameConfig(ref object gameSettings, ref bool suppressEvent_) InitializeComponent(); suppressEvent = suppressEvent_; GameProfile = (GameSettings)gameSettings; - if (App.CurrentGame?.modDirectory != null && Directory.Exists(App.CurrentGame.modDirectory)) + if (App.CurrentGame?.modDirectory != null && Directory.Exists(App.CurrentGame.modLoaderDirectory)) { - string pathDest = Path.Combine(App.CurrentGame.modDirectory, "Patches.json"); + string pathDest = Path.Combine(App.CurrentGame.modLoaderDirectory, "Patches.json"); if (File.Exists(pathDest)) patchesPath = pathDest; SetPatches(); diff --git a/SA-Mod-Manager/Controls/SADX/GameConfig.xaml.cs b/SA-Mod-Manager/Controls/SADX/GameConfig.xaml.cs index a9fa5951..4905a080 100644 --- a/SA-Mod-Manager/Controls/SADX/GameConfig.xaml.cs +++ b/SA-Mod-Manager/Controls/SADX/GameConfig.xaml.cs @@ -40,10 +40,10 @@ public GameConfig(ref object gameSettings, ref bool suppressEvent_) suppressEvent = suppressEvent_; GameProfile = (GameSettings)gameSettings; UpdateAppLauncherBtn(); - if (Directory.Exists(App.CurrentGame.modDirectory)) + if (Directory.Exists(App.CurrentGame.modLoaderDirectory)) { - string pathDest = Path.Combine(App.CurrentGame.modDirectory, "Patches.json"); + string pathDest = Path.Combine(App.CurrentGame.modLoaderDirectory, "Patches.json"); if (File.Exists(pathDest)) patchesPath = pathDest; diff --git a/SA-Mod-Manager/GamesInstall.cs b/SA-Mod-Manager/GamesInstall.cs index 2188fe9b..8c4cf988 100644 --- a/SA-Mod-Manager/GamesInstall.cs +++ b/SA-Mod-Manager/GamesInstall.cs @@ -51,6 +51,14 @@ public string modDirectory } } + public string modLoaderDirectory + { + get + { + return Path.Combine(gameDirectory, "mods", ".modloader"); + } + } + /// /// Profiles Directory where Manager, Game Profiles, and other settings are stored. /// @@ -123,9 +131,9 @@ public static async Task InstallDLL_Loader(Game game, bool isupdate = false) return; - Util.CreateSafeDirectory(game.modDirectory); + Util.CreateSafeDirectory(game.modLoaderDirectory); - string loaderPath = Path.Combine(game.modDirectory, game.loader.name + ".dll"); + string loaderPath = Path.Combine(game.modLoaderDirectory, game.loader.name + ".dll"); try { @@ -178,8 +186,8 @@ public static async Task InstallDLL_Loader(Game game, bool isupdate = false) var offline = new OfflineInstall(game.loader.name); offline.Show(); await Task.Delay(700); - Util.ExtractEmbedded7z(game.loader.name + ".7z", game.modDirectory); - bool success = File.Exists(Path.Combine(game.modDirectory, game.loader.name + ".dll")); + Util.ExtractEmbedded7z(game.loader.name + ".7z", game.modLoaderDirectory); + bool success = File.Exists(Path.Combine(game.modLoaderDirectory, game.loader.name + ".dll")); offline.CheckSuccess(success); await Task.Delay(500); @@ -250,10 +258,10 @@ public static async Task UpdateLoader(Game game, string dlLink, bool updat { string fileName = game.loader.name + ".7z"; Uri uri = new(dlLink); - string pathFinal = Path.Combine(game.modDirectory, fileName); + string pathFinal = Path.Combine(game.modLoaderDirectory, fileName); var loaderInfo = new List { - new(game.loader.name, fileName, game.modDirectory, uri, update ? DownloadDialog.DLType.Update : DownloadDialog.DLType.Install) + new(game.loader.name, fileName, game.modLoaderDirectory, uri, update ? DownloadDialog.DLType.Update : DownloadDialog.DLType.Install) }; var dl = new DownloadDialog(loaderInfo); @@ -293,11 +301,7 @@ public static async Task UpdateLoader(Game game, string dlLink, bool updat dl.StartDL(); if (success) { - List excludeFile = ["extlib"]; - await Util.Extract(pathFinal, game.modDirectory, true); - string ExtLibPath = Path.GetFullPath(Path.Combine(game.modDirectory, "extlib")); - if (Directory.Exists(ExtLibPath)) - Directory.Move(ExtLibPath, App.extLibPath); + await Util.Extract(pathFinal, App.CurrentGame.modLoaderDirectory, true); if (update) File.Copy(App.CurrentGame.loader.loaderdllpath, App.CurrentGame.loader.dataDllPath, true); diff --git a/SA-Mod-Manager/Management/ProfileManager.cs b/SA-Mod-Manager/Management/ProfileManager.cs index 8125053a..661a1b46 100644 --- a/SA-Mod-Manager/Management/ProfileManager.cs +++ b/SA-Mod-Manager/Management/ProfileManager.cs @@ -26,7 +26,7 @@ private static string ProfilesDirectory if (App.CurrentGame.modDirectory == null) return string.Empty; else - return Path.Combine(App.CurrentGame.modDirectory, ".modloader", "profiles"); + return Path.Combine(App.CurrentGame.modLoaderDirectory, "profiles"); } } diff --git a/SA-Mod-Manager/Resources/SA2ModLoader.7z b/SA-Mod-Manager/Resources/SA2ModLoader.7z index 4386e762..cbe41a29 100644 Binary files a/SA-Mod-Manager/Resources/SA2ModLoader.7z and b/SA-Mod-Manager/Resources/SA2ModLoader.7z differ diff --git a/SA-Mod-Manager/Resources/SADXModLoader.7z b/SA-Mod-Manager/Resources/SADXModLoader.7z index ece64b18..b319120f 100644 Binary files a/SA-Mod-Manager/Resources/SADXModLoader.7z and b/SA-Mod-Manager/Resources/SADXModLoader.7z differ diff --git a/SA-Mod-Manager/UI/MainWindow.xaml.cs b/SA-Mod-Manager/UI/MainWindow.xaml.cs index 2337e1cd..e47c3833 100644 --- a/SA-Mod-Manager/UI/MainWindow.xaml.cs +++ b/SA-Mod-Manager/UI/MainWindow.xaml.cs @@ -113,7 +113,7 @@ private async void MainWindowManager_Loaded(object sender, RoutedEventArgs e) Load(); SetBindings(); //theme is set here - if (string.IsNullOrEmpty(App.CurrentGame?.modDirectory) == false) + if (Util.IsStringValid(App.CurrentGame?.modDirectory)) { var oneClick = new OneClickInstall(updatePath); await oneClick.UriInit(); @@ -1451,19 +1451,21 @@ private void UpdateManagerInfo() { //App.CurrentGame.modDirectory = Path.Combine(App.CurrentGame.gameDirectory, "mods"); - App.CurrentGame.loader.mlverPath = Path.Combine(App.CurrentGame.modDirectory, App.CurrentGame.loader.mlverfile); + App.CurrentGame.loader.mlverPath = Path.Combine(App.CurrentGame.modLoaderDirectory, App.CurrentGame.loader.mlverfile); App.CurrentGame.loader.IniPath = Path.Combine(App.CurrentGame.gameDirectory, Path.Combine("mods", App.CurrentGame.defaultIniProfile)); App.CurrentGame.loader.dataDllOriginPath = Path.Combine(App.CurrentGame.gameDirectory, App.CurrentGame.loader.originPath.defaultDataDllOriginPath); - App.CurrentGame.loader.loaderdllpath = Path.Combine(App.CurrentGame.gameDirectory, Path.Combine(App.CurrentGame.modDirectory, App.CurrentGame.loader.name + ".dll")); + App.CurrentGame.loader.loaderdllpath = Path.Combine(App.CurrentGame.modLoaderDirectory, App.CurrentGame.loader.name + ".dll"); + + var dllPath = App.CurrentGame.loader.loaderdllpath; App.CurrentGame.loader.dataDllPath = Path.Combine(App.CurrentGame.gameDirectory, App.CurrentGame.loader.originPath.defaultDataDllPath); updatePath = Path.GetFullPath(Path.Combine(App.CurrentGame.modDirectory, ".updates")); - codelstpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modDirectory, "Codes.lst")); - codexmlpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modDirectory, "Codes.xml")); - codedatpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modDirectory, "Codes.dat")); - patchdatpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modDirectory, "Patches.dat")); + codelstpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modLoaderDirectory, "Codes.lst")); + codexmlpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modLoaderDirectory, "Codes.xml")); + codedatpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modLoaderDirectory, "Codes.dat")); + patchdatpath = Path.GetFullPath(Path.Combine(App.CurrentGame.modLoaderDirectory, "Patches.dat")); - App.extLibPath = Path.Combine(App.CurrentGame.modDirectory, ".modloader", "extlib"); + App.extLibPath = Path.Combine(App.CurrentGame.modLoaderDirectory, "extlib"); Controls.SADX.GameConfig.UpdateD3D8Paths(); diff --git a/SA-Mod-Manager/Util.cs b/SA-Mod-Manager/Util.cs index b3dc17f6..2b192542 100644 --- a/SA-Mod-Manager/Util.cs +++ b/SA-Mod-Manager/Util.cs @@ -734,7 +734,7 @@ private static void UpdatePathsForPortableMode() if (App.isLinux && Directory.Exists(App.extLibPath) == false) //force portable mode for new users on Linux since it tends to work better. { App.ConfigFolder = Path.Combine(App.StartDirectory, "SAManager"); - App.extLibPath = Path.Combine(App.CurrentGame.modDirectory, ".modloader", "extlib"); + App.extLibPath = Path.Combine(App.CurrentGame.modLoaderDirectory, "extlib"); App.crashFolder = Path.Combine(App.ConfigFolder, "CrashDump"); } }