diff --git a/.github/workflows/deploy-build.yml b/.github/workflows/deploy-build.yml index d5b1e4d5..7655e5e4 100644 --- a/.github/workflows/deploy-build.yml +++ b/.github/workflows/deploy-build.yml @@ -72,10 +72,10 @@ jobs: - name: Build artifact zip for Thunderstore run: | mkdir -p ./artifacts/thunderstore/Plugins/S1API - cp ./S1APILoader/bin/MonoMelon/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.MelonLoader.dll + cp ./S1APILoader/bin/MonoMelon/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.dll # cp ./S1APILoader/bin/MonoBepInEx/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.BepInEx.dll - cp ./S1API/bin/Il2CppMelon/net6.0/S1API.dll ./artifacts/thunderstore/Plugins/S1API/S1API.Il2Cpp.MelonLoader.dll - cp ./S1API/bin/MonoMelon/netstandard2.1/S1API.dll ./artifacts/thunderstore/Plugins/S1API/S1API.Mono.MelonLoader.dll + cp ./S1API/bin/Il2CppMelon/net6.0/S1API.dll ./artifacts/thunderstore/Mods/S1API.Il2Cpp.MelonLoader.dll + cp ./S1API/bin/MonoMelon/netstandard2.1/S1API.dll ./artifacts/thunderstore/Mods/S1API.Mono.MelonLoader.dll # cp ./S1API/bin/Il2CppMelon/net6.0/S1API.dll ./artifacts/thunderstore/Plugins/S1API/S1API.Il2Cpp.BepInEx.dll # cp ./S1API/bin/MonoMelon/netstandard2.1/S1API.dll ./artifacts/thunderstore/Plugins/S1API/S1API.Mono.BepInEx.dll diff --git a/S1API/S1API.csproj b/S1API/S1API.csproj index fbc93d6b..fc6e8191 100644 --- a/S1API/S1API.csproj +++ b/S1API/S1API.csproj @@ -96,13 +96,13 @@ - - + + - - + + diff --git a/S1APILoader/S1APILoader.cs b/S1APILoader/S1APILoader.cs index 4c53f247..d52334d7 100644 --- a/S1APILoader/S1APILoader.cs +++ b/S1APILoader/S1APILoader.cs @@ -17,20 +17,22 @@ public override void OnPreModsLoaded() if (pluginsFolder == null) throw new Exception("Failed to identify plugins folder."); - string buildsFolder = Path.Combine(pluginsFolder, BuildFolderName); + string modsFolder = Path.Combine(pluginsFolder, "../Mods"); string activeBuild = MelonUtils.IsGameIl2Cpp() ? "Il2Cpp" : "Mono"; + string inactiveBuild = !MelonUtils.IsGameIl2Cpp() ? "Il2Cpp" : "Mono"; + MelonLogger.Msg($"Loading S1API for {activeBuild}..."); - string s1APIBuildFile = Path.Combine(buildsFolder, $"S1API.{activeBuild}.dll"); + string s1APIActiveBuildFile = Path.Combine(modsFolder, $"S1API.{activeBuild}.MelonLoader.dll"); + string s1APIInactiveBuildFile = Path.Combine(modsFolder, $"S1API.{inactiveBuild}.MelonLoader.dll"); - // FIX: https://github.com/KaBooMa/S1API/issues/30 - // Manual assembly loading versus file manipulation. - // Thunderstore doesn't pick it up if we do file manipulation. - Assembly assembly = Assembly.LoadFile(s1APIBuildFile); - MelonAssembly melonAssembly = MelonAssembly.LoadMelonAssembly(s1APIBuildFile, assembly); - foreach (MelonBase melon in melonAssembly.LoadedMelons) - melon.Register(); + string disabledActiveBuildFile = $"{s1APIActiveBuildFile}.disabled"; + if (File.Exists(disabledActiveBuildFile)) + File.Move($"{s1APIActiveBuildFile}.disabled", s1APIActiveBuildFile); + + if (File.Exists(s1APIInactiveBuildFile)) + File.Move(s1APIInactiveBuildFile, $"{s1APIInactiveBuildFile}.disabled"); MelonLogger.Msg($"Successfully loaded S1API for {activeBuild}!"); } diff --git a/S1APILoader/S1APILoader.csproj b/S1APILoader/S1APILoader.csproj index b1f35e40..b664e6a4 100644 --- a/S1APILoader/S1APILoader.csproj +++ b/S1APILoader/S1APILoader.csproj @@ -20,13 +20,13 @@ - + - + - + - +