Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/deploy-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions S1API/S1API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@
<!-- Automated local deployment -->
<Target Name="PostBuildIl2Cpp" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and ('$(Configuration)' == 'Il2CppMono' or '$(Configuration)' == 'Il2CppBepInEx') ">
<Message Text="Deploying S1API to local Il2Cpp plugins folder" Importance="high"/>
<Copy SourceFiles=".\bin\Il2Cpp\net6.0\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll"/>
<Copy SourceFiles=".\bin\Mono\netstandard2.1\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Mono.dll"/>
<Copy SourceFiles=".\bin\Il2CppMelon\net6.0\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll"/>
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Mono.dll"/>
</Target>

<Target Name="PostBuildMono" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and ('$(Configuration)' == 'MonoMelon' or '$(Configuration)' == 'MonoBepInEx') ">
<Message Text="Deploying S1API to local Mono plugins folder" Importance="high"/>
<Copy SourceFiles=".\bin\Il2Cpp\net6.0\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll"/>
<Copy SourceFiles=".\bin\Mono\netstandard2.1\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Mono.dll"/>
<Copy SourceFiles=".\bin\Il2CppMelon\net6.0\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll"/>
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Mono.dll"/>
</Target>
</Project>
20 changes: 11 additions & 9 deletions S1APILoader/S1APILoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}!");
}
Expand Down
8 changes: 4 additions & 4 deletions S1APILoader/S1APILoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
<PackageReference Include="LavaGang.MelonLoader" Version="0.7.0" />
</ItemGroup>

<Target Name="PostBuildIl2Cpp" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and '$(Configuration)' == 'Il2Cpp' ">
<Target Name="PostBuildIl2Cpp" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and '$(Configuration)' == 'Il2CppMelon' ">
<Message Text="Deploying S1APILoader to local Il2Cpp plugins folder" Importance="high"/>
<Copy SourceFiles=".\bin\Il2Cpp\netstandard2.1\S1APILoader.dll" DestinationFolder="$(LocalIl2CppDeploymentPath)\Plugins"/>
<Copy SourceFiles=".\bin\Il2CppMelon\netstandard2.1\S1APILoader.dll" DestinationFolder="$(LocalIl2CppDeploymentPath)\Plugins"/>
</Target>

<Target Name="PostBuildMono" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and '$(Configuration)' == 'Mono' ">
<Target Name="PostBuildMono" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and '$(Configuration)' == 'MonoMelon' ">
<Message Text="Deploying S1APILoader to local Mono plugins folder" Importance="high"/>
<Copy SourceFiles=".\bin\Mono\netstandard2.1\S1APILoader.dll" DestinationFolder="$(LocalMonoDeploymentPath)\Plugins"/>
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1APILoader.dll" DestinationFolder="$(LocalMonoDeploymentPath)\Plugins"/>
</Target>
</Project>
Loading