diff --git a/.github/README.md b/.github/README.md index bce34586..98dcc989 100644 --- a/.github/README.md +++ b/.github/README.md @@ -11,9 +11,9 @@ [Documentation](https://docs.spacewarp.org) -Space Warp is a mod loader for Kerbal Space Program 2. +Space Warp is a modding API for Kerbal Space Program 2 with support for BepInEx and the official mod loader.* -Note: Use at your own risk, as this is an early version that is expected to undergo many changes. +*\*Note: The official mod loader is unfinished, so BepInEx is currently still required to enable it.* ## Installation @@ -41,11 +41,19 @@ That should be it, you can now launch the game and enjoy! To compile this project, you will need to follow these steps: -1. Install NuGet +1. Install .NET 7+ SDK 2. Run `dotnet restore` inside the top directory to install the packages. -3. Run one of the build scripts (see below for more info) and copy the contents from the correct build output directory into the KSP2 root director +3. Run `dotnet build -c ` to build the project, where `` is one of the following: + - `Debug` - Builds the project in debug mode + - `Deploy` - Builds the project in debug mode and copies the output to the KSP2 directory + - `DeployAndRun` - Builds the project in debug mode, copies the output to the KSP2 directory, and runs the game + - `Release` - Builds the project in release mode, zips the output, and builds a NuGet package -Mods are currently implemented as monobehaviours with two fields: a `Logger` for logging and a `Manager` that points to Spacewarp. A mod template generator exists as a Python script. +or you can use Visual Studio 2022 or JetBrains Rider to build the project. + +There are also scripts in the `scripts` folder that can be used to build the project in each of the configurations, they simply run the `dotnet build` command with the correct arguments. + +The outputs can be found in `dist/`. The Release zip will be in the `dist` folder, and the NuGet package will be in the `nuget` folder. ## Mod Structure @@ -63,23 +71,12 @@ KSP2_Root_Folder/ │ │ │ │ │ ├── *.bundle │ │ │ │ ├── images/ │ │ │ │ │ ├── * +│ │ │ │ ├── soundbanks/ +│ │ │ │ │ ├── *.bnk │ │ │ ├── localizations/ │ │ │ │ ├── *.csv │ │ │ ├── addressables/ │ │ │ │ ├── catalog.json │ │ │ │ ├── * │ │ │ ├── *.dll -``` - -## Build Scripts - -Each build scripts is essentially just a wrapper around `python3 builder.py $@`. The actual builder code is in `builder.py`. -Before running, open a terminal and `cd` into the repo, then run `pip install -r requirements.txt` to install the required dependencies (its just `argparse`). - -The build scripts are: -`build.bat` for Windows, `build.ps1` for Windows (Powershell), and `build.sh` for Linux - -The available arguments are: -- `-r` or `--release` to build in release mode - -When building, the build output will be in `build/SpaceWarp`, and the compressed version will be `build/SpaceWarp-[Debug|Release]-[commit].zip`. +``` \ No newline at end of file diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index c67e4b6a..78309260 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -9,38 +9,39 @@ on: jobs: build: runs-on: ubuntu-latest - - strategy: - matrix: - run_args: ["" , "-r"] - + steps: - - name: Check Out Repository + - name: Check out repository uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: 3.9 - - - name: Run Python Script - run: sudo python builder.py ${{ matrix.run_args }} - # I'm sure running it in sudo will cause NO issues what so ever. - - - name: Find Zip + + - name: Download NuGet + id: download-nuget + run: | + sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + + - name: Build the solution + run: dotnet build "SpaceWarp.sln" -c Release + + - name: Find zip id: find-zip run: | - if [ "${{ matrix.run_args }}" == "-r" ]; then - echo "zip=$(ls -1 build/SpaceWarp-Release*.zip | head -n 1)" >> $GITHUB_ENV - echo "artifact_name=SpaceWarpRelease" >> $GITHUB_ENV - else - echo "zip=$(ls -1 build/SpaceWarp-Debug*.zip | head -n 1)" >> $GITHUB_ENV - echo "artifact_name=SpaceWarpDebug" >> $GITHUB_ENV - fi - # Least cursed Sinon code. - - - name: Upload Artifact + echo "zip=$(ls -1 dist/SpaceWarp-*.zip | head -n 1)" >> $GITHUB_ENV + echo "artifact_name=SpaceWarpRelease" >> $GITHUB_ENV + + - name: Upload release zip uses: actions/upload-artifact@v3 with: name: ${{ env.artifact_name }} path: ${{ env.zip }} + + - name: Find NuGet package + id: find-nupkg + run: | + echo "nupkg=$(ls -1 nuget/SpaceWarp.*.nupkg | head -n 1)" >> $GITHUB_ENV + echo "artifact_name=SpaceWarpNuGet" >> $GITHUB_ENV + + - name: Upload NuGet package + uses: actions/upload-artifact@v3 + with: + name: ${{ env.artifact_name }} + path: ${{ env.nupkg }} diff --git a/.github/workflows/release_nuget.yml b/.github/workflows/release_nuget.yml new file mode 100644 index 00000000..11a70575 --- /dev/null +++ b/.github/workflows/release_nuget.yml @@ -0,0 +1,51 @@ +name: Publish NuGet Package + +on: + release: + types: [ "published" ] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Install jq + uses: dcarbone/install-jq-action@v2.1.0 + + - name: Download NuGet + id: download-nuget + run: | + sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + + - name: Build the solution + run: dotnet build "SpaceWarp.sln" -c Release + + - name: Extract current version + id: get-version + run: | + version=$(jq -r '.version' plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json) + echo "Version is $version" + echo "::set-output name=version::$version" + + - name: Check if version exists + id: check-version + run: | + version=${{ steps.get-version.outputs.version }} + response=$(curl -s "https://nuget.spacewarp.org/v3/search?q=SpaceWarp") + exists=$(echo "$response" | jq -r --arg id "SpaceWarp" --arg version "$version" '.data[] | select(.id == $id) | .versions[] | select(.version == $version) | .version') + if [ "$exists" == "$version" ]; then + echo "Version $version already exists in the NuGet repository" + exit 1 + else + echo "Version $version does not exist in the NuGet repository" + echo "::set-output name=should_publish::true" + fi + + - name: Publish NuGet package + if: steps.check-version.outputs.should_publish == 'true' + run: | + nupkg_path=$(ls -1 nuget/SpaceWarp.*.nupkg | head -n 1) + dotnet nuget push "$nupkg_path" -s https://nuget.spacewarp.org/v3/index.json -k ${{ secrets.NUGET_SERVER_KEY }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index a9263cf3..bfba49bc 100644 --- a/.gitignore +++ b/.gitignore @@ -350,8 +350,10 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ -# Build script folder -build/ +# Build folders +/build +/dist +/nuget # Idea folder .idea diff --git a/Directory.Build.props b/Directory.Build.props index e2aa9f15..0fe657a8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,51 +1,64 @@ + - - 1.6.0 + netstandard2.1 - SpaceWarp - 11 true - false - false - - $(NoWarn),CS0436,CS1591 + latest + true true - + + + C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2 + - - - - - - System.Index; - System.Range; - System.Diagnostics.CodeAnalysis.NotNullWhenAttribute; - System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute; - + + $(MSBuildThisFileDirectory) + $(SolutionDir)build/bin/plugin/$(Configuration) + $(SolutionDir)build/obj/plugin/$(Configuration) + $(SolutionDir)build/bin/modules/$(Configuration) + $(SolutionDir)build/obj/modules/$(Configuration) + $(SolutionDir)build/bin/patcher/$(Configuration) + $(SolutionDir)build/obj/patcher/$(Configuration) + $(ModulesBinPath)/$(MSBuildProjectName) + $(ModulesObjPath)/$(MSBuildProjectName) + $(MSBuildProjectName) + $(AssemblyName) + Debug;Release;Deploy;DeployAndRun + AnyCPU + $(NoWarn);CS0436 - - - + + + https://nuget.spacewarp.org/v3/index.json + + + + + + - - - - - - - - + + + + + - - - - - + + + @(Swinfo -> '%(mod_id)') + @(Swinfo -> '%(version)') + $(Version.Substring(0, $(Version.IndexOf('-')))) + @(Swinfo -> '%(name)') + @(Swinfo -> '%(author)') + @(Swinfo -> '%(description)') + git + @(Swinfo -> '%(source)') + $(ModId) + $(Product) + $(Version) + + diff --git a/Directory.Build.targets b/Directory.Build.targets deleted file mode 100644 index 1d724984..00000000 --- a/Directory.Build.targets +++ /dev/null @@ -1,8 +0,0 @@ - - - - $(MSBuildThisFileDirectory)external_dlls; - $(AssemblySearchPaths) - - - diff --git a/LICENSE b/LICENSE index c3389fba..17e7c38d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 X606 +Copyright (c) 2023 Space Warp Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index 7bd106e5..00000000 --- a/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/SpaceWarp.nuspec b/Package.nuspec similarity index 53% rename from SpaceWarp.nuspec rename to Package.nuspec index 4907f98b..bb62b5a2 100644 --- a/SpaceWarp.nuspec +++ b/Package.nuspec @@ -1,26 +1,26 @@ - SpaceWarp - 1.6.0 - SpaceWarp contributors + $id$ + $version$ + $authors$ false - https://raw.githubusercontent.com/SpaceWarp/SpaceWarp/main/LICENSE - A C# modding API for KSP2 - spacewarp ksp2 modding - icon.png + https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/LICENSE + $description$ + ksp2 mod library api spacewarp https://spacewarp.org - + README.md + icon.png - - - + + + diff --git a/README.md b/README.md new file mode 100644 index 00000000..cdd1df03 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Space Warp +Space Warp is an API for KSP 2 mod developers. diff --git a/SpaceWarp.Core/SpaceWarp.Core.csproj b/SpaceWarp.Core/SpaceWarp.Core.csproj deleted file mode 100644 index 0a719d84..00000000 --- a/SpaceWarp.Core/SpaceWarp.Core.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - - $(SpaceWarpVersion) - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - all - true - SpaceWarpPatcher.dll - - - - - - - - - - - - \ No newline at end of file diff --git a/SpaceWarp.Game/SpaceWarp.Game.csproj b/SpaceWarp.Game/SpaceWarp.Game.csproj deleted file mode 100644 index b72b251d..00000000 --- a/SpaceWarp.Game/SpaceWarp.Game.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj b/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj deleted file mode 100644 index bd80b024..00000000 --- a/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/SpaceWarp.Sound/SpaceWarp.Sound.csproj b/SpaceWarp.Sound/SpaceWarp.Sound.csproj deleted file mode 100644 index 066ce7f0..00000000 --- a/SpaceWarp.Sound/SpaceWarp.Sound.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/SpaceWarp.UI/SpaceWarp.UI.csproj b/SpaceWarp.UI/SpaceWarp.UI.csproj deleted file mode 100644 index 6282066c..00000000 --- a/SpaceWarp.UI/SpaceWarp.UI.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - - ..\ThirdParty\ConfigurationManager\ConfigurationManager.dll - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj b/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj deleted file mode 100644 index f71f632f..00000000 --- a/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/SpaceWarp.sln b/SpaceWarp.sln index 6e8f74f9..c19f2bbb 100644 --- a/SpaceWarp.sln +++ b/SpaceWarp.sln @@ -1,73 +1,103 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.4.33205.214 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp", "SpaceWarp\SpaceWarp.csproj", "{42FA2F7B-A595-44E8-8CD5-A9C30B80A667}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp", "src/SpaceWarp/SpaceWarp.csproj", "{42FA2F7B-A595-44E8-8CD5-A9C30B80A667}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpPatcher", "SpaceWarpPatcher\SpaceWarpPatcher.csproj", "{2EF642D0-F66D-461C-A5B0-953E39307B76}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Core", "src/SpaceWarp.Core/SpaceWarp.Core.csproj", "{E8F2ACB8-0F86-4558-9B78-BCD8261D2310}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Game", "SpaceWarp.Game\SpaceWarp.Game.csproj", "{E5E27976-8A2F-4DA8-A459-7D98268E7C40}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Game", "src/SpaceWarp.Game/SpaceWarp.Game.csproj", "{E5E27976-8A2F-4DA8-A459-7D98268E7C40}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.VersionChecking", "SpaceWarp.VersionChecking\SpaceWarp.VersionChecking.csproj", "{6B76C415-5BC2-4AB0-8862-760D9DC8F485}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Messaging", "src/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj", "{66BA4E01-8521-42EB-9D7D-8EB653757177}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.UI", "SpaceWarp.UI\SpaceWarp.UI.csproj", "{CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Sound", "src/SpaceWarp.Sound/SpaceWarp.Sound.csproj", "{BA439A24-7EA3-4E79-A44C-1FA303B9331C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Sound", "SpaceWarp.Sound\SpaceWarp.Sound.csproj", "{BA439A24-7EA3-4E79-A44C-1FA303B9331C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.UI", "src/SpaceWarp.UI/SpaceWarp.UI.csproj", "{CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Core", "SpaceWarp.Core\SpaceWarp.Core.csproj", "{E8F2ACB8-0F86-4558-9B78-BCD8261D2310}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.VersionChecking", "src/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj", "{6B76C415-5BC2-4AB0-8862-760D9DC8F485}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.Messaging", "SpaceWarp.Messaging\SpaceWarp.Messaging.csproj", "{66BA4E01-8521-42EB-9D7D-8EB653757177}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpPatcher", "src/SpaceWarpPatcher/SpaceWarpPatcher.csproj", "{2EF642D0-F66D-461C-A5B0-953E39307B76}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpTest", "SpaceWarpTest\SpaceWarpTest.csproj", "{8DB42693-9177-40B9-AC6A-B6D7A4823FAD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpTest", "src/SpaceWarpTest/SpaceWarpTest.csproj", "{8DB42693-9177-40B9-AC6A-B6D7A4823FAD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Deploy|Any CPU = Deploy|Any CPU + DeployAndRun|Any CPU = DeployAndRun|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.Debug|Any CPU.Build.0 = Debug|Any CPU {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.Release|Any CPU.ActiveCfg = Release|Any CPU {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.Release|Any CPU.Build.0 = Release|Any CPU - {2EF642D0-F66D-461C-A5B0-953E39307B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2EF642D0-F66D-461C-A5B0-953E39307B76}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2EF642D0-F66D-461C-A5B0-953E39307B76}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2EF642D0-F66D-461C-A5B0-953E39307B76}.Release|Any CPU.Build.0 = Release|Any CPU - {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Release|Any CPU.Build.0 = Release|Any CPU - {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Release|Any CPU.Build.0 = Release|Any CPU - {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Release|Any CPU.Build.0 = Release|Any CPU - {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Release|Any CPU.Build.0 = Release|Any CPU + {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {42FA2F7B-A595-44E8-8CD5-A9C30B80A667}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.Release|Any CPU.ActiveCfg = Release|Any CPU {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.Release|Any CPU.Build.0 = Release|Any CPU + {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {E8F2ACB8-0F86-4558-9B78-BCD8261D2310}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Release|Any CPU.Build.0 = Release|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {E5E27976-8A2F-4DA8-A459-7D98268E7C40}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU {66BA4E01-8521-42EB-9D7D-8EB653757177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {66BA4E01-8521-42EB-9D7D-8EB653757177}.Debug|Any CPU.Build.0 = Debug|Any CPU {66BA4E01-8521-42EB-9D7D-8EB653757177}.Release|Any CPU.ActiveCfg = Release|Any CPU {66BA4E01-8521-42EB-9D7D-8EB653757177}.Release|Any CPU.Build.0 = Release|Any CPU + {66BA4E01-8521-42EB-9D7D-8EB653757177}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {66BA4E01-8521-42EB-9D7D-8EB653757177}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {66BA4E01-8521-42EB-9D7D-8EB653757177}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {66BA4E01-8521-42EB-9D7D-8EB653757177}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Release|Any CPU.Build.0 = Release|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {BA439A24-7EA3-4E79-A44C-1FA303B9331C}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Release|Any CPU.Build.0 = Release|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {CB131B63-51E6-4ED7-A47C-28B1EB65B8D7}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Release|Any CPU.Build.0 = Release|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {6B76C415-5BC2-4AB0-8862-760D9DC8F485}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.Release|Any CPU.Build.0 = Release|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {2EF642D0-F66D-461C-A5B0-953E39307B76}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {CC049660-EA3D-47B2-91B0-F4B89244F3BE} + {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {8DB42693-9177-40B9-AC6A-B6D7A4823FAD}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU EndGlobalSection EndGlobal + diff --git a/SpaceWarp/SpaceWarp.csproj b/SpaceWarp/SpaceWarp.csproj deleted file mode 100644 index 392179d5..00000000 --- a/SpaceWarp/SpaceWarp.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - $(SpaceWarpVersion) - - - - - ..\ThirdParty\ConfigurationManager\ConfigurationManager.dll - - - - - - - - - - - - - - - all - true - SpaceWarpPatcher.dll - - - \ No newline at end of file diff --git a/SpaceWarpBuildTemplate/assets/images/oabTrayButton.png b/SpaceWarpBuildTemplate/assets/images/oabTrayButton.png deleted file mode 100644 index ca651e77..00000000 Binary files a/SpaceWarpBuildTemplate/assets/images/oabTrayButton.png and /dev/null differ diff --git a/build.bat b/build.bat deleted file mode 100644 index a967e11c..00000000 --- a/build.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off - -python3 builder.py %* diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 6fdc9987..00000000 --- a/build.ps1 +++ /dev/null @@ -1 +0,0 @@ -python3 builder.py $args diff --git a/build.sh b/build.sh deleted file mode 100644 index da6f1558..00000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -python3 builder.py "$@" diff --git a/builder.py b/builder.py deleted file mode 100644 index dd4e31d5..00000000 --- a/builder.py +++ /dev/null @@ -1,273 +0,0 @@ -import argparse -import os -import platform -import shutil -import subprocess -import zipfile - -TEMPLATE_DIR = os.path.abspath("SpaceWarpBuildTemplate") -SPACEWARP_DIR = os.path.abspath("SpaceWarp") -SPACEWARP_CORE_DIR = os.path.abspath("SpaceWarp.Core") -PATCHER_DIR = os.path.abspath("SpaceWarpPatcher") -PATCHER_LIB_DIR = os.path.abspath("SpaceWarpPatcherLibraries") -BUILD_DIR = os.path.abspath("build") -THIRD_PARTY = os.path.abspath("ThirdParty") - -MODULES = ["Game", "Sound", "UI", "VersionChecking", "Messaging"] - -parser = argparse.ArgumentParser() -parser.add_argument("-r", "--release", help="Build a release version", action="store_true") - - -def clean(): - # Need to add modules and such to this - if os.path.exists(BUILD_DIR): - shutil.rmtree(BUILD_DIR) - - if os.path.exists(os.path.join(SPACEWARP_DIR, "bin")): - shutil.rmtree(os.path.join(SPACEWARP_DIR, "bin")) - - if os.path.exists(os.path.join(SPACEWARP_DIR, "obj")): - shutil.rmtree(os.path.join(SPACEWARP_DIR, "obj")) - - if os.path.exists(os.path.join(PATCHER_DIR, "bin")): - shutil.rmtree(os.path.join(PATCHER_DIR, "bin")) - - if os.path.exists(os.path.join(PATCHER_DIR, "obj")): - shutil.rmtree(os.path.join(PATCHER_DIR, "obj")) - - -def build(release=False): - dotnet_args = ["dotnet", "build", os.path.join(SPACEWARP_DIR, "SpaceWarp.csproj"), "-c", - "Release" if release else "Debug"] - dotnet_core_args = ["dotnet", "build", os.path.join(SPACEWARP_CORE_DIR, "SpaceWarp.Core.csproj"), "-c", - "Release" if release else "Debug"] - build_output_dir = os.path.join(SPACEWARP_DIR, "bin", "Release" if release else "Debug") - build_output_dir_core = os.path.join(SPACEWARP_CORE_DIR, "bin", "Release" if release else "Debug") - output_dir = os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "plugins", "SpaceWarp") - nuget_temp_dir = os.path.join(BUILD_DIR, "nuget_temp") - # copy over the internals of the template - print("=> Creating build directory...") - os.makedirs(os.path.join(BUILD_DIR, "SpaceWarp"), True) - os.makedirs(nuget_temp_dir, True) - print("=> Copying BepInEx") - os.makedirs(os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "plugins"), True) - os.makedirs(os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "patchers", "SpaceWarp"), True) - shutil.copytree(os.path.join(THIRD_PARTY, "BepInEx 5.4.21"), os.path.join(BUILD_DIR, "SpaceWarp"), - dirs_exist_ok=True) - print("=> Copying BepInEx.ConfigurationManager") - os.makedirs(os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "plugins", "ConfigurationManager"), True) - shutil.copytree(os.path.join(THIRD_PARTY, "ConfigurationManager"), - os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "plugins", "ConfigurationManager"), - dirs_exist_ok=True) - - print("=> Copying output template") - shutil.copytree(TEMPLATE_DIR, output_dir) - - print(f"=> Executing: {' '.join(dotnet_args)}") - - output = subprocess.run(args=dotnet_args, capture_output=True) - print(" |=>| STDOUT") - - for line in str(output.stdout, "utf-8").splitlines(): - print(f" {line}") - - print(" |=>| STDERR") - - for line in str(output.stderr, "utf-8").splitlines(): - print(f" {line}") - - print(f"=> Executing: {' '.join(dotnet_core_args)}") - - output = subprocess.run(args=dotnet_core_args, capture_output=True) - print(" |=>| STDOUT") - - for line in str(output.stdout, "utf-8").splitlines(): - print(f" {line}") - - print(" |=>| STDERR") - - for line in str(output.stderr, "utf-8").splitlines(): - print(f" {line}") - - print("=> Compiling Modules") - os.makedirs(os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "plugins", "SpaceWarp", "modules"), True) - for module in MODULES: - path = os.path.abspath("SpaceWarp." + module) - csproj = os.path.join(path, "SpaceWarp." + module + ".csproj") - module_args = ["dotnet", "build", csproj, "-c", "Release" if release else "Debug"] - module_build_output_dir = os.path.join(path, "bin", "Release" if release else "Debug") - module_output_dir = os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "plugins", "SpaceWarp", "modules") - - print(f"=> Executing: {' '.join(module_args)}") - - output = subprocess.run(args=module_args, capture_output=True) - print(" |=>| STDOUT") - - for line in str(output.stdout, "utf-8").splitlines(): - print(f" {line}") - - print(" |=>| STDERR") - - for line in str(output.stderr, "utf-8").splitlines(): - print(f" {line}") - - print("=> Copying module") - - def shutil_copy_module(file): - shutil.copyfile(os.path.join(module_build_output_dir, file), os.path.join(module_output_dir, file)) - - def shutil_copy_nuget_module(file): - shutil.copyfile(os.path.join(module_build_output_dir, file), os.path.join(nuget_temp_dir, file)) - - if not release and os.path.exists(os.path.join(module_build_output_dir, "SpaceWarp." + module + ".pdb")): - shutil_copy_module("SpaceWarp." + module + ".pdb") - - shutil_copy_module("SpaceWarp." + module + ".dll") - shutil_copy_nuget_module("SpaceWarp." + module + ".dll") - shutil_copy_nuget_module("SpaceWarp." + module + ".xml") - - # patcher libraries - patcher_library_dir = os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "patchers", "SpaceWarp", "lib") - print(f"=> Copying Patcher Libraries") - shutil.copytree(PATCHER_LIB_DIR, patcher_library_dir) - - # patcher build - patcher_dotnet_args = ["dotnet", "build", os.path.join(PATCHER_DIR, "SpaceWarpPatcher.csproj"), "-c", - "Release" if release else "Debug"] - patcher_build_output_dir = os.path.join(PATCHER_DIR, "bin", "Release" if release else "Debug") - patcher_output_dir = os.path.join(BUILD_DIR, "SpaceWarp", "BepInEx", "patchers", "SpaceWarp") - - print(f"=> Executing: {' '.join(patcher_dotnet_args)}") - - patcher_output = subprocess.run(args=patcher_dotnet_args, capture_output=True) - print(" |=>| STDOUT") - - for line in str(patcher_output.stdout, "utf-8").splitlines(): - print(f" {line}") - - print(" |=>| STDERR") - - for line in str(patcher_output.stderr, "utf-8").splitlines(): - print(f" {line}") - - print("=> Copying build outputs...") - - def shutil_copy(file): - shutil.copyfile(os.path.join(build_output_dir, file), os.path.join(output_dir, file)) - - def shutil_copy_core(file): - shutil.copyfile(os.path.join(build_output_dir_core, file), os.path.join(output_dir, file)) - - def shutil_copy_patcher(file): - shutil.copyfile(os.path.join(patcher_build_output_dir, file), os.path.join(patcher_output_dir, file)) - - def shutil_nuget_copy(file): - shutil.copyfile(os.path.join(build_output_dir, file), os.path.join(nuget_temp_dir, file)) - - def shutil_nuget_copy_core(file): - shutil.copyfile(os.path.join(build_output_dir_core, file), os.path.join(nuget_temp_dir, file)) - - def shutil_nuget_copy_patcher(file): - shutil.copyfile(os.path.join(patcher_build_output_dir, file), os.path.join(nuget_temp_dir, file)) - - if not release and os.path.exists(os.path.join(build_output_dir_core, "SpaceWarp.Core.pdb")): - shutil_copy_core("SpaceWarp.Core.pdb") - if not release and os.path.exists(os.path.join(build_output_dir, "SpaceWarp.pdb")): - shutil_copy("SpaceWarp.pdb") - if not release and os.path.exists(os.path.join(patcher_build_output_dir, "SpaceWarpPatcher.pdb")): - shutil_copy_patcher("SpaceWarpPatcher.pdb") - - shutil_copy("SpaceWarp.dll") - shutil_nuget_copy("SpaceWarp.dll") - shutil_nuget_copy("SpaceWarp.xml") - - shutil_copy_core("SpaceWarp.Core.dll") - shutil_nuget_copy_core("SpaceWarp.Core.dll") - shutil_nuget_copy_core("SpaceWarp.Core.xml") - - shutil_copy_patcher("SpaceWarpPatcher.dll") - shutil_nuget_copy_patcher("SpaceWarpPatcher.dll") - shutil_nuget_copy_patcher("SpaceWarpPatcher.xml") - - -def get_console_encoding(): - command = 'powershell -command "[Console]::OutputEncoding.WebName"' - result = subprocess.run(command, shell=True, capture_output=True, text=True) - if result.returncode == 0: - encoding_name = result.stdout.strip() - return encoding_name - else: - raise RuntimeError(f'Failed to get console encoding: {result.stderr}') - - -def nuget_pack(): - if platform.system() == "Windows": - nuget_args = [ - "nuget", - "pack", - os.path.abspath("SpaceWarp.nuspec"), - "-OutputDirectory", - BUILD_DIR - ] - command_str = subprocess.list2cmdline(nuget_args) - print(f"=> Executing: {command_str}") - - encoding = get_console_encoding() - - output = subprocess.run(args=command_str, capture_output=True) - print(" |=>| STDOUT") - - for line in str(output.stdout, encoding).splitlines(): - print(f" {line}") - - print(" |=>| STDERR") - - for line in str(output.stderr, encoding).splitlines(): - print(f" {line}") - - shutil.rmtree(os.path.join(BUILD_DIR, "nuget_temp")) - - -def create_zip_name(prefix): - git_output = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True) - commit_full = str(git_output.stdout, "utf-8") - commit = commit_full[:7] - - return os.path.join(BUILD_DIR, f"{prefix}-{commit}.zip") - - -def mkzip(in_dir, out_zip): - with zipfile.ZipFile(out_zip, "w", zipfile.ZIP_DEFLATED) as handle: - for root, dirs, files in os.walk(in_dir): - for file in files: - handle.write(os.path.join(root, file), os.path.relpath(os.path.join(root, file), in_dir)) - handle.close() - - -def compress(release=False): - release_target = "Release" if release else "Debug" - mkzip(os.path.join(BUILD_DIR, "SpaceWarp"), create_zip_name(f"SpaceWarp-{release_target}")) - - -def main(): - args = parser.parse_args() - total_steps = 4 - print(f"====> [1/{total_steps}] Cleaning...") - - clean() - - print(f"====> [2/{total_steps}] Building...") - - build(args.release) - - print(f"====> [3/{total_steps}] Packing NuGet...") - - nuget_pack() - - print(f"====> [4/{total_steps}] Compressing...") - - compress(args.release) - - -main() diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony.dll b/plugin_template/BepInEx/core/0Harmony.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony.dll rename to plugin_template/BepInEx/core/0Harmony.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony.xml b/plugin_template/BepInEx/core/0Harmony.xml similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony.xml rename to plugin_template/BepInEx/core/0Harmony.xml diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony20.dll b/plugin_template/BepInEx/core/0Harmony20.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony20.dll rename to plugin_template/BepInEx/core/0Harmony20.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Harmony.dll b/plugin_template/BepInEx/core/BepInEx.Harmony.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Harmony.dll rename to plugin_template/BepInEx/core/BepInEx.Harmony.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Harmony.xml b/plugin_template/BepInEx/core/BepInEx.Harmony.xml similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Harmony.xml rename to plugin_template/BepInEx/core/BepInEx.Harmony.xml diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Preloader.dll b/plugin_template/BepInEx/core/BepInEx.Preloader.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Preloader.dll rename to plugin_template/BepInEx/core/BepInEx.Preloader.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Preloader.xml b/plugin_template/BepInEx/core/BepInEx.Preloader.xml similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Preloader.xml rename to plugin_template/BepInEx/core/BepInEx.Preloader.xml diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.dll b/plugin_template/BepInEx/core/BepInEx.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.dll rename to plugin_template/BepInEx/core/BepInEx.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.xml b/plugin_template/BepInEx/core/BepInEx.xml similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.xml rename to plugin_template/BepInEx/core/BepInEx.xml diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/HarmonyXInterop.dll b/plugin_template/BepInEx/core/HarmonyXInterop.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/HarmonyXInterop.dll rename to plugin_template/BepInEx/core/HarmonyXInterop.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.Mdb.dll b/plugin_template/BepInEx/core/Mono.Cecil.Mdb.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.Mdb.dll rename to plugin_template/BepInEx/core/Mono.Cecil.Mdb.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.Pdb.dll b/plugin_template/BepInEx/core/Mono.Cecil.Pdb.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.Pdb.dll rename to plugin_template/BepInEx/core/Mono.Cecil.Pdb.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.Rocks.dll b/plugin_template/BepInEx/core/Mono.Cecil.Rocks.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.Rocks.dll rename to plugin_template/BepInEx/core/Mono.Cecil.Rocks.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.dll b/plugin_template/BepInEx/core/Mono.Cecil.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/Mono.Cecil.dll rename to plugin_template/BepInEx/core/Mono.Cecil.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.RuntimeDetour.dll b/plugin_template/BepInEx/core/MonoMod.RuntimeDetour.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.RuntimeDetour.dll rename to plugin_template/BepInEx/core/MonoMod.RuntimeDetour.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.RuntimeDetour.xml b/plugin_template/BepInEx/core/MonoMod.RuntimeDetour.xml similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.RuntimeDetour.xml rename to plugin_template/BepInEx/core/MonoMod.RuntimeDetour.xml diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.Utils.dll b/plugin_template/BepInEx/core/MonoMod.Utils.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.Utils.dll rename to plugin_template/BepInEx/core/MonoMod.Utils.dll diff --git a/ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.Utils.xml b/plugin_template/BepInEx/core/MonoMod.Utils.xml similarity index 100% rename from ThirdParty/BepInEx 5.4.21/BepInEx/core/MonoMod.Utils.xml rename to plugin_template/BepInEx/core/MonoMod.Utils.xml diff --git a/SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.CSharp.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.CSharp.dll similarity index 100% rename from SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.CSharp.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.CSharp.dll diff --git a/SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.CSharp.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.CSharp.xml similarity index 100% rename from SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.CSharp.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.CSharp.xml diff --git a/SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.dll similarity index 100% rename from SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.dll diff --git a/SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.xml similarity index 100% rename from SpaceWarpPatcherLibraries/Microsoft.CodeAnalysis.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/Microsoft.CodeAnalysis.xml diff --git a/SpaceWarpPatcherLibraries/System.Collections.Immutable.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Collections.Immutable.dll similarity index 100% rename from SpaceWarpPatcherLibraries/System.Collections.Immutable.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Collections.Immutable.dll diff --git a/SpaceWarpPatcherLibraries/System.Collections.Immutable.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Collections.Immutable.xml similarity index 100% rename from SpaceWarpPatcherLibraries/System.Collections.Immutable.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Collections.Immutable.xml diff --git a/SpaceWarpPatcherLibraries/System.Memory.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Memory.dll similarity index 100% rename from SpaceWarpPatcherLibraries/System.Memory.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Memory.dll diff --git a/SpaceWarpPatcherLibraries/System.Memory.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Memory.xml similarity index 100% rename from SpaceWarpPatcherLibraries/System.Memory.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Memory.xml diff --git a/SpaceWarpPatcherLibraries/System.Numerics.Vectors.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Numerics.Vectors.dll similarity index 100% rename from SpaceWarpPatcherLibraries/System.Numerics.Vectors.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Numerics.Vectors.dll diff --git a/SpaceWarpPatcherLibraries/System.Numerics.Vectors.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Numerics.Vectors.xml similarity index 100% rename from SpaceWarpPatcherLibraries/System.Numerics.Vectors.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Numerics.Vectors.xml diff --git a/SpaceWarpPatcherLibraries/System.Reflection.Metadata.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Reflection.Metadata.dll similarity index 100% rename from SpaceWarpPatcherLibraries/System.Reflection.Metadata.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Reflection.Metadata.dll diff --git a/SpaceWarpPatcherLibraries/System.Reflection.Metadata.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Reflection.Metadata.xml similarity index 100% rename from SpaceWarpPatcherLibraries/System.Reflection.Metadata.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Reflection.Metadata.xml diff --git a/SpaceWarpPatcherLibraries/System.Runtime.CompilerServices.Unsafe.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Runtime.CompilerServices.Unsafe.dll similarity index 100% rename from SpaceWarpPatcherLibraries/System.Runtime.CompilerServices.Unsafe.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Runtime.CompilerServices.Unsafe.dll diff --git a/SpaceWarpPatcherLibraries/System.Runtime.CompilerServices.Unsafe.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Runtime.CompilerServices.Unsafe.xml similarity index 100% rename from SpaceWarpPatcherLibraries/System.Runtime.CompilerServices.Unsafe.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Runtime.CompilerServices.Unsafe.xml diff --git a/SpaceWarpPatcherLibraries/System.Threading.Tasks.Extensions.dll b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Threading.Tasks.Extensions.dll similarity index 100% rename from SpaceWarpPatcherLibraries/System.Threading.Tasks.Extensions.dll rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Threading.Tasks.Extensions.dll diff --git a/SpaceWarpPatcherLibraries/System.Threading.Tasks.Extensions.xml b/plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Threading.Tasks.Extensions.xml similarity index 100% rename from SpaceWarpPatcherLibraries/System.Threading.Tasks.Extensions.xml rename to plugin_template/BepInEx/patchers/SpaceWarp/lib/System.Threading.Tasks.Extensions.xml diff --git a/ThirdParty/ConfigurationManager/ConfigurationManager.dll b/plugin_template/BepInEx/plugins/ConfigurationManager/ConfigurationManager.dll similarity index 100% rename from ThirdParty/ConfigurationManager/ConfigurationManager.dll rename to plugin_template/BepInEx/plugins/ConfigurationManager/ConfigurationManager.dll diff --git a/ThirdParty/ConfigurationManager/ConfigurationManager.xml b/plugin_template/BepInEx/plugins/ConfigurationManager/ConfigurationManager.xml similarity index 100% rename from ThirdParty/ConfigurationManager/ConfigurationManager.xml rename to plugin_template/BepInEx/plugins/ConfigurationManager/ConfigurationManager.xml diff --git a/ThirdParty/BepInEx 5.4.21/LICENSE b/plugin_template/BepInEx/plugins/ConfigurationManager/LICENSE similarity index 83% rename from ThirdParty/BepInEx 5.4.21/LICENSE rename to plugin_template/BepInEx/plugins/ConfigurationManager/LICENSE index 6e409d03..afdc2c38 100644 --- a/ThirdParty/BepInEx 5.4.21/LICENSE +++ b/plugin_template/BepInEx/plugins/ConfigurationManager/LICENSE @@ -1,55 +1,4 @@ -Skip to content -Search or jump to… -Pull requests -Issues -Codespaces -Marketplace -Explore - -@cheese3660 -BepInEx -/ -BepInEx.ConfigurationManager -Public -Fork your own copy of BepInEx/BepInEx.ConfigurationManager -Code -Issues -7 -Pull requests -1 -Actions -Projects -Security -Insights -Beta Try the new code view -BepInEx.ConfigurationManager/LICENSE -BepInEx/BepInEx.ConfigurationManager is licensed under the - -GNU Lesser General Public License v3.0 -Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications under the same license or the GNU GPLv3. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work through interfaces provided by the licensed work may be distributed under different terms and without source code for the larger work. - -Permissions - Commercial use - Modification - Distribution - Patent use - Private use -Limitations - Liability - Warranty -Conditions - License and copyright notice - Disclose source - State changes - Same license (library) -This is not legal advice. Learn more about repository licenses. -@ghorsington -ghorsington Changle GPL to LGPL -Latest commit 209602a on Jul 28, 2020 - History - 2 contributors -@ghorsington@ManlyMarco -165 lines (128 sloc) 7.47 KB +BepInEx.ConfigurationManager is licensed under the LGPL v3 license. The full text of the license is included below. GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -216,18 +165,3 @@ whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. -Footer -© 2023 GitHub, Inc. -Footer navigation -Terms -Privacy -Security -Status -Docs -Contact GitHub -Pricing -API -Training -Blog -About -BepInEx.ConfigurationManager/LICENSE at master · BepInEx/BepInEx.ConfigurationManager \ No newline at end of file diff --git a/ThirdParty/ConfigurationManager/README b/plugin_template/BepInEx/plugins/ConfigurationManager/README similarity index 100% rename from ThirdParty/ConfigurationManager/README rename to plugin_template/BepInEx/plugins/ConfigurationManager/README diff --git a/SpaceWarpBuildTemplate/assets/bundles/README.md b/plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/README.md similarity index 100% rename from SpaceWarpBuildTemplate/assets/bundles/README.md rename to plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/README.md diff --git a/SpaceWarpBuildTemplate/assets/bundles/avcdialog.bundle b/plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/avcdialog.bundle similarity index 100% rename from SpaceWarpBuildTemplate/assets/bundles/avcdialog.bundle rename to plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/avcdialog.bundle diff --git a/SpaceWarpBuildTemplate/assets/bundles/modlist.bundle b/plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/modlist.bundle similarity index 100% rename from SpaceWarpBuildTemplate/assets/bundles/modlist.bundle rename to plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/modlist.bundle diff --git a/SpaceWarpBuildTemplate/assets/bundles/swconsole.bundle b/plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/swconsole.bundle similarity index 100% rename from SpaceWarpBuildTemplate/assets/bundles/swconsole.bundle rename to plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/swconsole.bundle diff --git a/SpaceWarpBuildTemplate/assets/bundles/swconsoleui.bundle b/plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/swconsoleui.bundle similarity index 100% rename from SpaceWarpBuildTemplate/assets/bundles/swconsoleui.bundle rename to plugin_template/BepInEx/plugins/SpaceWarp/assets/bundles/swconsoleui.bundle diff --git a/SpaceWarpBuildTemplate/assets/images/console.png b/plugin_template/BepInEx/plugins/SpaceWarp/assets/images/console.png similarity index 100% rename from SpaceWarpBuildTemplate/assets/images/console.png rename to plugin_template/BepInEx/plugins/SpaceWarp/assets/images/console.png diff --git a/plugin_template/BepInEx/plugins/SpaceWarp/assets/images/oabTrayButton.png b/plugin_template/BepInEx/plugins/SpaceWarp/assets/images/oabTrayButton.png new file mode 100644 index 00000000..98a02919 Binary files /dev/null and b/plugin_template/BepInEx/plugins/SpaceWarp/assets/images/oabTrayButton.png differ diff --git a/SpaceWarpBuildTemplate/localizations/space_warp_localizations.csv b/plugin_template/BepInEx/plugins/SpaceWarp/localizations/space_warp_localizations.csv similarity index 100% rename from SpaceWarpBuildTemplate/localizations/space_warp_localizations.csv rename to plugin_template/BepInEx/plugins/SpaceWarp/localizations/space_warp_localizations.csv diff --git a/SpaceWarpBuildTemplate/swinfo.json b/plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json similarity index 62% rename from SpaceWarpBuildTemplate/swinfo.json rename to plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json index 683d2a97..67c244b5 100644 --- a/SpaceWarpBuildTemplate/swinfo.json +++ b/plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json @@ -1,17 +1,21 @@ { "spec": "2.0", "mod_id": "com.github.x606.spacewarp", + "author": "Space Warp Team", "name": "Space Warp", - "author": "Space-Warp Team", - "description": "Space-Warp is an API for KSP2 mod developers.", + "description": "Space Warp is an API for KSP 2 mod developers.", "source": "https://github.com/SpaceWarpDev/SpaceWarp", - "version_check": "https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/SpaceWarpBuildTemplate/swinfo.json", - "version": "1.6.0", + "version": "1.7.0", + "version_check": "https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json", + "ksp2_version": { + "min": "0.2.0", + "max": "*" + }, "dependencies": [ { - "id": "UitkForKsp2", + "id": "UitkForKsp2", "version": { - "min": "2.0.0", + "min": "2.4.0", "max": "*" } }, @@ -22,9 +26,5 @@ "max": "*" } } - ], - "ksp2_version": { - "min": "0.1.5.0", - "max": "*" - } + ] } diff --git a/ThirdParty/ConfigurationManager/LICENSE b/plugin_template/LICENSE similarity index 83% rename from ThirdParty/ConfigurationManager/LICENSE rename to plugin_template/LICENSE index 6e409d03..35117d6b 100644 --- a/ThirdParty/ConfigurationManager/LICENSE +++ b/plugin_template/LICENSE @@ -1,55 +1,4 @@ -Skip to content -Search or jump to… -Pull requests -Issues -Codespaces -Marketplace -Explore - -@cheese3660 -BepInEx -/ -BepInEx.ConfigurationManager -Public -Fork your own copy of BepInEx/BepInEx.ConfigurationManager -Code -Issues -7 -Pull requests -1 -Actions -Projects -Security -Insights -Beta Try the new code view -BepInEx.ConfigurationManager/LICENSE -BepInEx/BepInEx.ConfigurationManager is licensed under the - -GNU Lesser General Public License v3.0 -Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications under the same license or the GNU GPLv3. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work through interfaces provided by the licensed work may be distributed under different terms and without source code for the larger work. - -Permissions - Commercial use - Modification - Distribution - Patent use - Private use -Limitations - Liability - Warranty -Conditions - License and copyright notice - Disclose source - State changes - Same license (library) -This is not legal advice. Learn more about repository licenses. -@ghorsington -ghorsington Changle GPL to LGPL -Latest commit 209602a on Jul 28, 2020 - History - 2 contributors -@ghorsington@ManlyMarco -165 lines (128 sloc) 7.47 KB +BepInEx is licensed under the LGPL v3 license. The full text of the license is included below. GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -215,19 +164,4 @@ General Public License ever published by the Free Software Foundation. whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the -Library. -Footer -© 2023 GitHub, Inc. -Footer navigation -Terms -Privacy -Security -Status -Docs -Contact GitHub -Pricing -API -Training -Blog -About -BepInEx.ConfigurationManager/LICENSE at master · BepInEx/BepInEx.ConfigurationManager \ No newline at end of file +Library. \ No newline at end of file diff --git a/ThirdParty/BepInEx 5.4.21/README b/plugin_template/README similarity index 100% rename from ThirdParty/BepInEx 5.4.21/README rename to plugin_template/README diff --git a/ThirdParty/BepInEx 5.4.21/changelog.txt b/plugin_template/changelog.txt similarity index 100% rename from ThirdParty/BepInEx 5.4.21/changelog.txt rename to plugin_template/changelog.txt diff --git a/ThirdParty/BepInEx 5.4.21/doorstop_config.ini b/plugin_template/doorstop_config.ini similarity index 100% rename from ThirdParty/BepInEx 5.4.21/doorstop_config.ini rename to plugin_template/doorstop_config.ini diff --git a/ThirdParty/BepInEx 5.4.21/winhttp.dll b/plugin_template/winhttp.dll similarity index 100% rename from ThirdParty/BepInEx 5.4.21/winhttp.dll rename to plugin_template/winhttp.dll diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index bf7c6fd6..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -argparse == 1.4.0 diff --git a/scripts/build-debug.bat b/scripts/build-debug.bat new file mode 100644 index 00000000..29806136 --- /dev/null +++ b/scripts/build-debug.bat @@ -0,0 +1,2 @@ +@echo off +dotnet build "../SpaceWarp.sln" -c Debug diff --git a/scripts/build-deploy.bat b/scripts/build-deploy.bat new file mode 100644 index 00000000..d1e69c3d --- /dev/null +++ b/scripts/build-deploy.bat @@ -0,0 +1,2 @@ +@echo off +dotnet build "../SpaceWarp.sln" -c Deploy diff --git a/scripts/build-release.bat b/scripts/build-release.bat new file mode 100644 index 00000000..bbff4464 --- /dev/null +++ b/scripts/build-release.bat @@ -0,0 +1,2 @@ +@echo off +dotnet build "../SpaceWarp.sln" -c Release diff --git a/scripts/build-run.bat b/scripts/build-run.bat new file mode 100644 index 00000000..42dc1bb9 --- /dev/null +++ b/scripts/build-run.bat @@ -0,0 +1,2 @@ +@echo off +dotnet build "../SpaceWarp.sln" -c DeployAndRun diff --git a/SpaceWarp.Core/API/Assets/AssetManager.cs b/src/SpaceWarp.Core/API/Assets/AssetManager.cs similarity index 100% rename from SpaceWarp.Core/API/Assets/AssetManager.cs rename to src/SpaceWarp.Core/API/Assets/AssetManager.cs diff --git a/SpaceWarp.Core/API/Configuration/BepInExConfigEntry.cs b/src/SpaceWarp.Core/API/Configuration/BepInExConfigEntry.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/BepInExConfigEntry.cs rename to src/SpaceWarp.Core/API/Configuration/BepInExConfigEntry.cs diff --git a/SpaceWarp.Core/API/Configuration/BepInExConfigFile.cs b/src/SpaceWarp.Core/API/Configuration/BepInExConfigFile.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/BepInExConfigFile.cs rename to src/SpaceWarp.Core/API/Configuration/BepInExConfigFile.cs diff --git a/SpaceWarp.Core/API/Configuration/ConfigValue.cs b/src/SpaceWarp.Core/API/Configuration/ConfigValue.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/ConfigValue.cs rename to src/SpaceWarp.Core/API/Configuration/ConfigValue.cs diff --git a/SpaceWarp.Core/API/Configuration/EmptyConfigFile.cs b/src/SpaceWarp.Core/API/Configuration/EmptyConfigFile.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/EmptyConfigFile.cs rename to src/SpaceWarp.Core/API/Configuration/EmptyConfigFile.cs diff --git a/SpaceWarp.Core/API/Configuration/IConfigEntry.cs b/src/SpaceWarp.Core/API/Configuration/IConfigEntry.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/IConfigEntry.cs rename to src/SpaceWarp.Core/API/Configuration/IConfigEntry.cs diff --git a/SpaceWarp.Core/API/Configuration/IConfigFile.cs b/src/SpaceWarp.Core/API/Configuration/IConfigFile.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/IConfigFile.cs rename to src/SpaceWarp.Core/API/Configuration/IConfigFile.cs diff --git a/SpaceWarp.Core/API/Configuration/IValueConstraint.cs b/src/SpaceWarp.Core/API/Configuration/IValueConstraint.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/IValueConstraint.cs rename to src/SpaceWarp.Core/API/Configuration/IValueConstraint.cs diff --git a/SpaceWarp.Core/API/Configuration/JsonConfigEntry.cs b/src/SpaceWarp.Core/API/Configuration/JsonConfigEntry.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/JsonConfigEntry.cs rename to src/SpaceWarp.Core/API/Configuration/JsonConfigEntry.cs diff --git a/SpaceWarp.Core/API/Configuration/JsonConfigFile.cs b/src/SpaceWarp.Core/API/Configuration/JsonConfigFile.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/JsonConfigFile.cs rename to src/SpaceWarp.Core/API/Configuration/JsonConfigFile.cs diff --git a/SpaceWarp.Core/API/Configuration/ListConstraint.cs b/src/SpaceWarp.Core/API/Configuration/ListConstraint.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/ListConstraint.cs rename to src/SpaceWarp.Core/API/Configuration/ListConstraint.cs diff --git a/SpaceWarp.Core/API/Configuration/RangeConstraint.cs b/src/SpaceWarp.Core/API/Configuration/RangeConstraint.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/RangeConstraint.cs rename to src/SpaceWarp.Core/API/Configuration/RangeConstraint.cs diff --git a/SpaceWarp.Core/API/Configuration/ValueConstraint.cs b/src/SpaceWarp.Core/API/Configuration/ValueConstraint.cs similarity index 100% rename from SpaceWarp.Core/API/Configuration/ValueConstraint.cs rename to src/SpaceWarp.Core/API/Configuration/ValueConstraint.cs diff --git a/SpaceWarp.Core/API/Loading/Loading.cs b/src/SpaceWarp.Core/API/Loading/Loading.cs similarity index 100% rename from SpaceWarp.Core/API/Loading/Loading.cs rename to src/SpaceWarp.Core/API/Loading/Loading.cs diff --git a/SpaceWarp.Core/API/Loading/SaveLoad.cs b/src/SpaceWarp.Core/API/Loading/SaveLoad.cs similarity index 100% rename from SpaceWarp.Core/API/Loading/SaveLoad.cs rename to src/SpaceWarp.Core/API/Loading/SaveLoad.cs diff --git a/SpaceWarp.Core/API/Logging/BaseLogger.cs b/src/SpaceWarp.Core/API/Logging/BaseLogger.cs similarity index 100% rename from SpaceWarp.Core/API/Logging/BaseLogger.cs rename to src/SpaceWarp.Core/API/Logging/BaseLogger.cs diff --git a/SpaceWarp.Core/API/Logging/BepInExLogger.cs b/src/SpaceWarp.Core/API/Logging/BepInExLogger.cs similarity index 100% rename from SpaceWarp.Core/API/Logging/BepInExLogger.cs rename to src/SpaceWarp.Core/API/Logging/BepInExLogger.cs diff --git a/SpaceWarp.Core/API/Logging/ILogger.cs b/src/SpaceWarp.Core/API/Logging/ILogger.cs similarity index 100% rename from SpaceWarp.Core/API/Logging/ILogger.cs rename to src/SpaceWarp.Core/API/Logging/ILogger.cs diff --git a/SpaceWarp.Core/API/Logging/LogLevel.cs b/src/SpaceWarp.Core/API/Logging/LogLevel.cs similarity index 100% rename from SpaceWarp.Core/API/Logging/LogLevel.cs rename to src/SpaceWarp.Core/API/Logging/LogLevel.cs diff --git a/SpaceWarp.Core/API/Logging/UnityLogSource.cs b/src/SpaceWarp.Core/API/Logging/UnityLogSource.cs similarity index 100% rename from SpaceWarp.Core/API/Logging/UnityLogSource.cs rename to src/SpaceWarp.Core/API/Logging/UnityLogSource.cs diff --git a/SpaceWarp.Core/API/Lua/LuaMod.cs b/src/SpaceWarp.Core/API/Lua/LuaMod.cs similarity index 100% rename from SpaceWarp.Core/API/Lua/LuaMod.cs rename to src/SpaceWarp.Core/API/Lua/LuaMod.cs diff --git a/SpaceWarp.Core/API/Lua/SpaceWarpInterop.cs b/src/SpaceWarp.Core/API/Lua/SpaceWarpInterop.cs similarity index 100% rename from SpaceWarp.Core/API/Lua/SpaceWarpInterop.cs rename to src/SpaceWarp.Core/API/Lua/SpaceWarpInterop.cs diff --git a/SpaceWarp.Core/API/Lua/SpaceWarpLuaAPIAttribute.cs b/src/SpaceWarp.Core/API/Lua/SpaceWarpLuaAPIAttribute.cs similarity index 100% rename from SpaceWarp.Core/API/Lua/SpaceWarpLuaAPIAttribute.cs rename to src/SpaceWarp.Core/API/Lua/SpaceWarpLuaAPIAttribute.cs diff --git a/SpaceWarp.Core/API/Lua/UI/LuaUITK.cs b/src/SpaceWarp.Core/API/Lua/UI/LuaUITK.cs similarity index 100% rename from SpaceWarp.Core/API/Lua/UI/LuaUITK.cs rename to src/SpaceWarp.Core/API/Lua/UI/LuaUITK.cs diff --git a/SpaceWarp.Core/API/Mods/BaseKspLoaderSpaceWarpMod.cs b/src/SpaceWarp.Core/API/Mods/BaseKspLoaderSpaceWarpMod.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/BaseKspLoaderSpaceWarpMod.cs rename to src/SpaceWarp.Core/API/Mods/BaseKspLoaderSpaceWarpMod.cs diff --git a/SpaceWarp.Core/API/Mods/BaseSpaceWarpPlugin.cs b/src/SpaceWarp.Core/API/Mods/BaseSpaceWarpPlugin.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/BaseSpaceWarpPlugin.cs rename to src/SpaceWarp.Core/API/Mods/BaseSpaceWarpPlugin.cs diff --git a/SpaceWarp.Core/API/Mods/GlobalModDefines.cs b/src/SpaceWarp.Core/API/Mods/GlobalModDefines.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/GlobalModDefines.cs rename to src/SpaceWarp.Core/API/Mods/GlobalModDefines.cs diff --git a/SpaceWarp.Core/API/Mods/ISpaceWarpMod.cs b/src/SpaceWarp.Core/API/Mods/ISpaceWarpMod.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/ISpaceWarpMod.cs rename to src/SpaceWarp.Core/API/Mods/ISpaceWarpMod.cs diff --git a/SpaceWarp.Core/API/Mods/JSON/Converters/SpecVersionConverter.cs b/src/SpaceWarp.Core/API/Mods/JSON/Converters/SpecVersionConverter.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/JSON/Converters/SpecVersionConverter.cs rename to src/SpaceWarp.Core/API/Mods/JSON/Converters/SpecVersionConverter.cs diff --git a/SpaceWarp.Core/API/Mods/JSON/DependencyInfo.cs b/src/SpaceWarp.Core/API/Mods/JSON/DependencyInfo.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/JSON/DependencyInfo.cs rename to src/SpaceWarp.Core/API/Mods/JSON/DependencyInfo.cs diff --git a/SpaceWarp.Core/API/Mods/JSON/ModInfo.cs b/src/SpaceWarp.Core/API/Mods/JSON/ModInfo.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/JSON/ModInfo.cs rename to src/SpaceWarp.Core/API/Mods/JSON/ModInfo.cs diff --git a/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs b/src/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs rename to src/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs diff --git a/SpaceWarp.Core/API/Mods/JSON/SupportedVersionsInfo.cs b/src/SpaceWarp.Core/API/Mods/JSON/SupportedVersionsInfo.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/JSON/SupportedVersionsInfo.cs rename to src/SpaceWarp.Core/API/Mods/JSON/SupportedVersionsInfo.cs diff --git a/SpaceWarp.Core/API/Mods/JSON/VersionCheckType.cs b/src/SpaceWarp.Core/API/Mods/JSON/VersionCheckType.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/JSON/VersionCheckType.cs rename to src/SpaceWarp.Core/API/Mods/JSON/VersionCheckType.cs diff --git a/SpaceWarp.Core/API/Mods/PluginList.cs b/src/SpaceWarp.Core/API/Mods/PluginList.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/PluginList.cs rename to src/SpaceWarp.Core/API/Mods/PluginList.cs diff --git a/SpaceWarp.Core/API/Mods/SpaceWarpErrorDescription.cs b/src/SpaceWarp.Core/API/Mods/SpaceWarpErrorDescription.cs similarity index 96% rename from SpaceWarp.Core/API/Mods/SpaceWarpErrorDescription.cs rename to src/SpaceWarp.Core/API/Mods/SpaceWarpErrorDescription.cs index 9753a4e3..22456c09 100644 --- a/SpaceWarp.Core/API/Mods/SpaceWarpErrorDescription.cs +++ b/src/SpaceWarp.Core/API/Mods/SpaceWarpErrorDescription.cs @@ -37,7 +37,7 @@ public SpaceWarpErrorDescription(SpaceWarpPluginDescriptor plugin) BootstrapPatch.ErroredSWPluginDescriptor = plugin; return; case BaseUnityPlugin unityPlugin: - Object.Destroy(unityPlugin); + UnityObject.Destroy(unityPlugin); break; } } diff --git a/SpaceWarp.Core/API/Mods/SpaceWarpPluginDescriptor.cs b/src/SpaceWarp.Core/API/Mods/SpaceWarpPluginDescriptor.cs similarity index 100% rename from SpaceWarp.Core/API/Mods/SpaceWarpPluginDescriptor.cs rename to src/SpaceWarp.Core/API/Mods/SpaceWarpPluginDescriptor.cs diff --git a/SpaceWarp.Core/API/Parts/Colors.cs b/src/SpaceWarp.Core/API/Parts/Colors.cs similarity index 100% rename from SpaceWarp.Core/API/Parts/Colors.cs rename to src/SpaceWarp.Core/API/Parts/Colors.cs diff --git a/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs b/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs new file mode 100644 index 00000000..5cfb02d6 --- /dev/null +++ b/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs @@ -0,0 +1,43 @@ +using JetBrains.Annotations; +using KSP.Sim.impl; +using SpaceWarp.API.Logging; + +namespace SpaceWarp.API.Parts; + +[PublicAPI] +public static class PartComponentModuleOverride +{ + private static readonly ILogger _LOGGER = new UnityLogSource("SpaceWarp.PartComponentModuleOverride"); + + internal static List RegisteredPartComponentOverrides = new(); + + /// + /// Registers your custom module for background resource processing. + /// + /// Your Custom Module class that inherits from PartComponentModule + public static void RegisterModuleForBackgroundResourceProcessing() where T : PartComponentModule + { + var moduleName = typeof(T).Name; + + // Check if this Module is already registered + if (RegisteredPartComponentOverrides.Contains(typeof(T))) + { + throw new ArgumentException($"Module '{moduleName}' is already registered. Skipping.", nameof(T)); + } + + RegisteredPartComponentOverrides.Add(typeof(T)); + _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); + } + + /// + /// Unregisters your custom module from background resource processing. + /// + /// Your Custom Module class that inherits from PartComponentModule + public static void UnRegisterModuleForBackgroundResourceProcessing() where T : PartComponentModule + { + if (!RegisteredPartComponentOverrides.Contains(typeof(T))) return; + + RegisteredPartComponentOverrides.Remove(typeof(T)); + _LOGGER.LogInfo($"Unregistered '{typeof(T).Name}' from background resources processing."); + } +} \ No newline at end of file diff --git a/SpaceWarp.Core/API/SaveGameManager/ModSaves.cs b/src/SpaceWarp.Core/API/SaveGameManager/ModSaves.cs similarity index 100% rename from SpaceWarp.Core/API/SaveGameManager/ModSaves.cs rename to src/SpaceWarp.Core/API/SaveGameManager/ModSaves.cs diff --git a/SpaceWarp.Core/API/Versions/SemanticVersion.cs b/src/SpaceWarp.Core/API/Versions/SemanticVersion.cs similarity index 100% rename from SpaceWarp.Core/API/Versions/SemanticVersion.cs rename to src/SpaceWarp.Core/API/Versions/SemanticVersion.cs diff --git a/SpaceWarp.Core/API/Versions/VersionUtility.cs b/src/SpaceWarp.Core/API/Versions/VersionUtility.cs similarity index 100% rename from SpaceWarp.Core/API/Versions/VersionUtility.cs rename to src/SpaceWarp.Core/API/Versions/VersionUtility.cs diff --git a/SpaceWarp.Core/AssemblyInfo.cs b/src/SpaceWarp.Core/AssemblyInfo.cs similarity index 100% rename from SpaceWarp.Core/AssemblyInfo.cs rename to src/SpaceWarp.Core/AssemblyInfo.cs diff --git a/SpaceWarp.Core/Backend/Modding/AssetOnlyMod.cs b/src/SpaceWarp.Core/Backend/Modding/AssetOnlyMod.cs similarity index 100% rename from SpaceWarp.Core/Backend/Modding/AssetOnlyMod.cs rename to src/SpaceWarp.Core/Backend/Modding/AssetOnlyMod.cs diff --git a/SpaceWarp.Core/Backend/Modding/BepInExModAdapter.cs b/src/SpaceWarp.Core/Backend/Modding/BepInExModAdapter.cs similarity index 100% rename from SpaceWarp.Core/Backend/Modding/BepInExModAdapter.cs rename to src/SpaceWarp.Core/Backend/Modding/BepInExModAdapter.cs diff --git a/SpaceWarp.Core/Backend/Modding/Ksp2ModInfo.cs b/src/SpaceWarp.Core/Backend/Modding/Ksp2ModInfo.cs similarity index 100% rename from SpaceWarp.Core/Backend/Modding/Ksp2ModInfo.cs rename to src/SpaceWarp.Core/Backend/Modding/Ksp2ModInfo.cs diff --git a/SpaceWarp.Core/Backend/Modding/KspModAdapter.cs b/src/SpaceWarp.Core/Backend/Modding/KspModAdapter.cs similarity index 100% rename from SpaceWarp.Core/Backend/Modding/KspModAdapter.cs rename to src/SpaceWarp.Core/Backend/Modding/KspModAdapter.cs diff --git a/SpaceWarp.Core/Backend/Modding/PluginRegister.cs b/src/SpaceWarp.Core/Backend/Modding/PluginRegister.cs similarity index 100% rename from SpaceWarp.Core/Backend/Modding/PluginRegister.cs rename to src/SpaceWarp.Core/Backend/Modding/PluginRegister.cs diff --git a/SpaceWarp.Core/Backend/SaveGameManager/PluginSaveData.cs b/src/SpaceWarp.Core/Backend/SaveGameManager/PluginSaveData.cs similarity index 100% rename from SpaceWarp.Core/Backend/SaveGameManager/PluginSaveData.cs rename to src/SpaceWarp.Core/Backend/SaveGameManager/PluginSaveData.cs diff --git a/SpaceWarp.Core/Backend/SaveGameManager/SpaceWarpSerializedSavedGame.cs b/src/SpaceWarp.Core/Backend/SaveGameManager/SpaceWarpSerializedSavedGame.cs similarity index 100% rename from SpaceWarp.Core/Backend/SaveGameManager/SpaceWarpSerializedSavedGame.cs rename to src/SpaceWarp.Core/Backend/SaveGameManager/SpaceWarpSerializedSavedGame.cs diff --git a/src/SpaceWarp.Core/Directory.Build.props b/src/SpaceWarp.Core/Directory.Build.props new file mode 100644 index 00000000..33f5d0b0 --- /dev/null +++ b/src/SpaceWarp.Core/Directory.Build.props @@ -0,0 +1,10 @@ + + + + + + + $(PluginBinPath)/$(MSBuildProjectName) + $(PluginObjPath)/$(MSBuildProjectName) + + diff --git a/SpaceWarp.Core/InternalUtilities/AssetHelpers.cs b/src/SpaceWarp.Core/InternalUtilities/AssetHelpers.cs similarity index 100% rename from SpaceWarp.Core/InternalUtilities/AssetHelpers.cs rename to src/SpaceWarp.Core/InternalUtilities/AssetHelpers.cs diff --git a/SpaceWarp.Core/InternalUtilities/InternalExtensions.cs b/src/SpaceWarp.Core/InternalUtilities/InternalExtensions.cs similarity index 100% rename from SpaceWarp.Core/InternalUtilities/InternalExtensions.cs rename to src/SpaceWarp.Core/InternalUtilities/InternalExtensions.cs diff --git a/SpaceWarp.Core/InternalUtilities/PathHelpers.cs b/src/SpaceWarp.Core/InternalUtilities/PathHelpers.cs similarity index 100% rename from SpaceWarp.Core/InternalUtilities/PathHelpers.cs rename to src/SpaceWarp.Core/InternalUtilities/PathHelpers.cs diff --git a/SpaceWarp.Core/Modules/ModuleManager.cs b/src/SpaceWarp.Core/Modules/ModuleManager.cs similarity index 100% rename from SpaceWarp.Core/Modules/ModuleManager.cs rename to src/SpaceWarp.Core/Modules/ModuleManager.cs diff --git a/SpaceWarp.Core/Modules/SpaceWarpModule.cs b/src/SpaceWarp.Core/Modules/SpaceWarpModule.cs similarity index 100% rename from SpaceWarp.Core/Modules/SpaceWarpModule.cs rename to src/SpaceWarp.Core/Modules/SpaceWarpModule.cs diff --git a/SpaceWarp.Core/Patching/BootstrapPatch.cs b/src/SpaceWarp.Core/Patching/BootstrapPatch.cs similarity index 100% rename from SpaceWarp.Core/Patching/BootstrapPatch.cs rename to src/SpaceWarp.Core/Patching/BootstrapPatch.cs diff --git a/SpaceWarp.Core/Patching/CodeGenerationUtilities.cs b/src/SpaceWarp.Core/Patching/CodeGenerationUtilities.cs similarity index 100% rename from SpaceWarp.Core/Patching/CodeGenerationUtilities.cs rename to src/SpaceWarp.Core/Patching/CodeGenerationUtilities.cs diff --git a/SpaceWarp.Core/Patching/ColorsPatch.cs b/src/SpaceWarp.Core/Patching/ColorsPatch.cs similarity index 100% rename from SpaceWarp.Core/Patching/ColorsPatch.cs rename to src/SpaceWarp.Core/Patching/ColorsPatch.cs diff --git a/SpaceWarp.Core/Patching/FixGetTypes.cs b/src/SpaceWarp.Core/Patching/FixGetTypes.cs similarity index 100% rename from SpaceWarp.Core/Patching/FixGetTypes.cs rename to src/SpaceWarp.Core/Patching/FixGetTypes.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/AddressableAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/AddressableAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/AddressableAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/AddressableAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/DescriptorLoadingAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/DescriptorLoadingAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/DescriptorLoadingAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/DescriptorLoadingAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs b/src/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/InitializeModAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/InitializeModAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/InitializeModAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/InitializeModAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/LoadAddressablesAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/LoadAddressablesAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/LoadAddressablesAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/LoadAddressablesAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/LoadLocalizationAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/LoadLocalizationAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/LoadLocalizationAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/LoadLocalizationAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/LoadLuaAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/LoadLuaAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/LoadLuaAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/LoadLuaAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/LoadingAddressablesLocalizationsAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/LoadingAddressablesLocalizationsAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/LoadingAddressablesLocalizationsAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/LoadingAddressablesLocalizationsAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/ModLoadingAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/ModLoadingAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/ModLoadingAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/ModLoadingAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/PostInitializeModAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/PostInitializeModAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/PostInitializeModAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/PostInitializeModAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/PreInitializeModAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/PreInitializeModAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/PreInitializeModAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/PreInitializeModAction.cs diff --git a/SpaceWarp.Core/Patching/LoadingActions/ResolvingPatchOrderAction.cs b/src/SpaceWarp.Core/Patching/LoadingActions/ResolvingPatchOrderAction.cs similarity index 100% rename from SpaceWarp.Core/Patching/LoadingActions/ResolvingPatchOrderAction.cs rename to src/SpaceWarp.Core/Patching/LoadingActions/ResolvingPatchOrderAction.cs diff --git a/SpaceWarp.Core/Patching/ModLoaderPatch.cs b/src/SpaceWarp.Core/Patching/ModLoaderPatch.cs similarity index 100% rename from SpaceWarp.Core/Patching/ModLoaderPatch.cs rename to src/SpaceWarp.Core/Patching/ModLoaderPatch.cs diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs new file mode 100644 index 00000000..f9c7da1f --- /dev/null +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs @@ -0,0 +1,32 @@ +using System.Reflection; +using HarmonyLib; +using JetBrains.Annotations; +using KSP.Sim.impl; +using SpaceWarp.API.Parts; + +namespace SpaceWarp.Patching; + + +[HarmonyPatch(typeof(PartOwnerComponent))] +public static class PartOwnerComponentConstructor +{ + private static FieldInfo AddedField = + typeof(PartOwnerComponent).GetField("HasRegisteredPartComponentsForFixedUpdate"); + + [HarmonyPatch(MethodType.Constructor)] + public static void SetFalse(PartOwnerComponent __instance) + { + + AddedField.SetValue(__instance, false); + } + + [HarmonyPatch(nameof(PartOwnerComponent.Add)), HarmonyPrefix, UsedImplicitly] + public static void CheckForModule(PartOwnerComponent __instance, PartComponent part) + { + var currentValue = (Boolean)AddedField.GetValue(__instance); + if (currentValue) return; + var hasModule = PartComponentModuleOverride.RegisteredPartComponentOverrides.Any(type => part.TryGetModule(type, out _)); + + AddedField.SetValue(__instance, hasModule); + } +} \ No newline at end of file diff --git a/SpaceWarp.Core/Patching/SaveGameManager/SaveGamePatches.cs b/src/SpaceWarp.Core/Patching/SaveGameManager/SaveGamePatches.cs similarity index 100% rename from SpaceWarp.Core/Patching/SaveGameManager/SaveGamePatches.cs rename to src/SpaceWarp.Core/Patching/SaveGameManager/SaveGamePatches.cs diff --git a/SpaceWarp.Core/Patching/SequentialFlowLoadersPatcher.cs b/src/SpaceWarp.Core/Patching/SequentialFlowLoadersPatcher.cs similarity index 100% rename from SpaceWarp.Core/Patching/SequentialFlowLoadersPatcher.cs rename to src/SpaceWarp.Core/Patching/SequentialFlowLoadersPatcher.cs diff --git a/SpaceWarp.Core/Patching/SettingsManagerPatcher.cs b/src/SpaceWarp.Core/Patching/SettingsManagerPatcher.cs similarity index 100% rename from SpaceWarp.Core/Patching/SettingsManagerPatcher.cs rename to src/SpaceWarp.Core/Patching/SettingsManagerPatcher.cs diff --git a/src/SpaceWarp.Core/SpaceWarp.Core.csproj b/src/SpaceWarp.Core/SpaceWarp.Core.csproj new file mode 100644 index 00000000..b3662049 --- /dev/null +++ b/src/SpaceWarp.Core/SpaceWarp.Core.csproj @@ -0,0 +1,26 @@ + + + + SpaceWarp + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + diff --git a/SpaceWarp.Core/SpaceWarpPlugin.cs b/src/SpaceWarp.Core/SpaceWarpPlugin.cs similarity index 99% rename from SpaceWarp.Core/SpaceWarpPlugin.cs rename to src/SpaceWarp.Core/SpaceWarpPlugin.cs index 3aede271..87186335 100644 --- a/SpaceWarp.Core/SpaceWarpPlugin.cs +++ b/src/SpaceWarp.Core/SpaceWarpPlugin.cs @@ -8,7 +8,6 @@ using HarmonyLib; using I2.Loc; using JetBrains.Annotations; -using KSP.IO; using KSP.ScriptInterop.impl.moonsharp; using MoonSharp.Interpreter; using MoonSharp.Interpreter.Interop; diff --git a/SpaceWarp.Game/API/Game/Extensions/PartProviderExtensions.cs b/src/SpaceWarp.Game/API/Game/Extensions/PartProviderExtensions.cs similarity index 100% rename from SpaceWarp.Game/API/Game/Extensions/PartProviderExtensions.cs rename to src/SpaceWarp.Game/API/Game/Extensions/PartProviderExtensions.cs diff --git a/SpaceWarp.Game/API/Game/Extensions/VesselVehicleExtensions.cs b/src/SpaceWarp.Game/API/Game/Extensions/VesselVehicleExtensions.cs similarity index 100% rename from SpaceWarp.Game/API/Game/Extensions/VesselVehicleExtensions.cs rename to src/SpaceWarp.Game/API/Game/Extensions/VesselVehicleExtensions.cs diff --git a/SpaceWarp.Game/API/Game/Messages/StateChanges.cs b/src/SpaceWarp.Game/API/Game/Messages/StateChanges.cs similarity index 100% rename from SpaceWarp.Game/API/Game/Messages/StateChanges.cs rename to src/SpaceWarp.Game/API/Game/Messages/StateChanges.cs diff --git a/SpaceWarp.Game/API/Game/Messages/StateLoadings.cs b/src/SpaceWarp.Game/API/Game/Messages/StateLoadings.cs similarity index 100% rename from SpaceWarp.Game/API/Game/Messages/StateLoadings.cs rename to src/SpaceWarp.Game/API/Game/Messages/StateLoadings.cs diff --git a/SpaceWarp.Game/API/Game/Vehicle.cs b/src/SpaceWarp.Game/API/Game/Vehicle.cs similarity index 100% rename from SpaceWarp.Game/API/Game/Vehicle.cs rename to src/SpaceWarp.Game/API/Game/Vehicle.cs diff --git a/SpaceWarp.Game/Modules/Game.cs b/src/SpaceWarp.Game/Modules/Game.cs similarity index 100% rename from SpaceWarp.Game/Modules/Game.cs rename to src/SpaceWarp.Game/Modules/Game.cs diff --git a/src/SpaceWarp.Game/SpaceWarp.Game.csproj b/src/SpaceWarp.Game/SpaceWarp.Game.csproj new file mode 100644 index 00000000..d90289f6 --- /dev/null +++ b/src/SpaceWarp.Game/SpaceWarp.Game.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/SpaceWarp.Messaging/API/Messaging/MessageBus.cs b/src/SpaceWarp.Messaging/API/Messaging/MessageBus.cs similarity index 100% rename from SpaceWarp.Messaging/API/Messaging/MessageBus.cs rename to src/SpaceWarp.Messaging/API/Messaging/MessageBus.cs diff --git a/SpaceWarp.Messaging/API/Messaging/MessageBusBase.cs b/src/SpaceWarp.Messaging/API/Messaging/MessageBusBase.cs similarity index 100% rename from SpaceWarp.Messaging/API/Messaging/MessageBusBase.cs rename to src/SpaceWarp.Messaging/API/Messaging/MessageBusBase.cs diff --git a/SpaceWarp.Messaging/API/Messaging/MessageBusManager.cs b/src/SpaceWarp.Messaging/API/Messaging/MessageBusManager.cs similarity index 100% rename from SpaceWarp.Messaging/API/Messaging/MessageBusManager.cs rename to src/SpaceWarp.Messaging/API/Messaging/MessageBusManager.cs diff --git a/SpaceWarp.Messaging/Modules/Messaging.cs b/src/SpaceWarp.Messaging/Modules/Messaging.cs similarity index 100% rename from SpaceWarp.Messaging/Modules/Messaging.cs rename to src/SpaceWarp.Messaging/Modules/Messaging.cs diff --git a/src/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj b/src/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj new file mode 100644 index 00000000..67f08be0 --- /dev/null +++ b/src/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj @@ -0,0 +1,6 @@ + + + + + + diff --git a/SpaceWarp.Sound/API/Sound/Soundbank.cs b/src/SpaceWarp.Sound/API/Sound/Soundbank.cs similarity index 100% rename from SpaceWarp.Sound/API/Sound/Soundbank.cs rename to src/SpaceWarp.Sound/API/Sound/Soundbank.cs diff --git a/SpaceWarp.Sound/API/Sound/SoundbankManager.cs b/src/SpaceWarp.Sound/API/Sound/SoundbankManager.cs similarity index 100% rename from SpaceWarp.Sound/API/Sound/SoundbankManager.cs rename to src/SpaceWarp.Sound/API/Sound/SoundbankManager.cs diff --git a/SpaceWarp.Sound/Modules/Sound.cs b/src/SpaceWarp.Sound/Modules/Sound.cs similarity index 100% rename from SpaceWarp.Sound/Modules/Sound.cs rename to src/SpaceWarp.Sound/Modules/Sound.cs diff --git a/src/SpaceWarp.Sound/SpaceWarp.Sound.csproj b/src/SpaceWarp.Sound/SpaceWarp.Sound.csproj new file mode 100644 index 00000000..5ad2709d --- /dev/null +++ b/src/SpaceWarp.Sound/SpaceWarp.Sound.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/SpaceWarp.UI/API/Lua/AppBarInterop.cs b/src/SpaceWarp.UI/API/Lua/AppBarInterop.cs similarity index 100% rename from SpaceWarp.UI/API/Lua/AppBarInterop.cs rename to src/SpaceWarp.UI/API/Lua/AppBarInterop.cs diff --git a/SpaceWarp.UI/API/UI/Appbar/Appbar.cs b/src/SpaceWarp.UI/API/UI/Appbar/Appbar.cs similarity index 100% rename from SpaceWarp.UI/API/UI/Appbar/Appbar.cs rename to src/SpaceWarp.UI/API/UI/Appbar/Appbar.cs diff --git a/SpaceWarp.UI/API/UI/Appbar/AppbarMenu.cs b/src/SpaceWarp.UI/API/UI/Appbar/AppbarMenu.cs similarity index 100% rename from SpaceWarp.UI/API/UI/Appbar/AppbarMenu.cs rename to src/SpaceWarp.UI/API/UI/Appbar/AppbarMenu.cs diff --git a/SpaceWarp.UI/API/UI/MainMenu.cs b/src/SpaceWarp.UI/API/UI/MainMenu.cs similarity index 100% rename from SpaceWarp.UI/API/UI/MainMenu.cs rename to src/SpaceWarp.UI/API/UI/MainMenu.cs diff --git a/SpaceWarp.UI/API/UI/ModList.cs b/src/SpaceWarp.UI/API/UI/ModList.cs similarity index 100% rename from SpaceWarp.UI/API/UI/ModList.cs rename to src/SpaceWarp.UI/API/UI/ModList.cs diff --git a/SpaceWarp.UI/API/UI/Settings/ModsPropertyDrawers.cs b/src/SpaceWarp.UI/API/UI/Settings/ModsPropertyDrawers.cs similarity index 100% rename from SpaceWarp.UI/API/UI/Settings/ModsPropertyDrawers.cs rename to src/SpaceWarp.UI/API/UI/Settings/ModsPropertyDrawers.cs diff --git a/SpaceWarp.UI/API/UI/Skins.cs b/src/SpaceWarp.UI/API/UI/Skins.cs similarity index 100% rename from SpaceWarp.UI/API/UI/Skins.cs rename to src/SpaceWarp.UI/API/UI/Skins.cs diff --git a/SpaceWarp.UI/Backend/Extensions/ErrorDescriptionExtensions.cs b/src/SpaceWarp.UI/Backend/Extensions/ErrorDescriptionExtensions.cs similarity index 100% rename from SpaceWarp.UI/Backend/Extensions/ErrorDescriptionExtensions.cs rename to src/SpaceWarp.UI/Backend/Extensions/ErrorDescriptionExtensions.cs diff --git a/SpaceWarp.UI/Backend/UI/Appbar/AppbarBackend.cs b/src/SpaceWarp.UI/Backend/UI/Appbar/AppbarBackend.cs similarity index 100% rename from SpaceWarp.UI/Backend/UI/Appbar/AppbarBackend.cs rename to src/SpaceWarp.UI/Backend/UI/Appbar/AppbarBackend.cs diff --git a/SpaceWarp.UI/Backend/UI/Loading/LoadingScreenManager.cs b/src/SpaceWarp.UI/Backend/UI/Loading/LoadingScreenManager.cs similarity index 99% rename from SpaceWarp.UI/Backend/UI/Loading/LoadingScreenManager.cs rename to src/SpaceWarp.UI/Backend/UI/Loading/LoadingScreenManager.cs index 21559161..f3178504 100644 --- a/SpaceWarp.UI/Backend/UI/Loading/LoadingScreenManager.cs +++ b/src/SpaceWarp.UI/Backend/UI/Loading/LoadingScreenManager.cs @@ -2,7 +2,6 @@ using System.IO; using KSP.Game; using SpaceWarp.API.Mods; -using UniLinq; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; diff --git a/SpaceWarp.UI/Backend/UI/Settings/CustomSettingsElementDescriptionController.cs b/src/SpaceWarp.UI/Backend/UI/Settings/CustomSettingsElementDescriptionController.cs similarity index 100% rename from SpaceWarp.UI/Backend/UI/Settings/CustomSettingsElementDescriptionController.cs rename to src/SpaceWarp.UI/Backend/UI/Settings/CustomSettingsElementDescriptionController.cs diff --git a/SpaceWarp.UI/Modules/UI.cs b/src/SpaceWarp.UI/Modules/UI.cs similarity index 100% rename from SpaceWarp.UI/Modules/UI.cs rename to src/SpaceWarp.UI/Modules/UI.cs diff --git a/SpaceWarp.UI/Patching/ConfigurationPatch.cs b/src/SpaceWarp.UI/Patching/ConfigurationPatch.cs similarity index 100% rename from SpaceWarp.UI/Patching/ConfigurationPatch.cs rename to src/SpaceWarp.UI/Patching/ConfigurationPatch.cs diff --git a/SpaceWarp.UI/Patching/CurtainPatch.cs b/src/SpaceWarp.UI/Patching/CurtainPatch.cs similarity index 100% rename from SpaceWarp.UI/Patching/CurtainPatch.cs rename to src/SpaceWarp.UI/Patching/CurtainPatch.cs diff --git a/SpaceWarp.UI/Patching/LoadingFlowPatch.cs b/src/SpaceWarp.UI/Patching/LoadingFlowPatch.cs similarity index 100% rename from SpaceWarp.UI/Patching/LoadingFlowPatch.cs rename to src/SpaceWarp.UI/Patching/LoadingFlowPatch.cs diff --git a/SpaceWarp.UI/Patching/LoadingScreenDeserializationPatch.cs b/src/SpaceWarp.UI/Patching/LoadingScreenDeserializationPatch.cs similarity index 100% rename from SpaceWarp.UI/Patching/LoadingScreenDeserializationPatch.cs rename to src/SpaceWarp.UI/Patching/LoadingScreenDeserializationPatch.cs diff --git a/SpaceWarp.UI/Patching/MainMenuPatcher.cs b/src/SpaceWarp.UI/Patching/MainMenuPatcher.cs similarity index 100% rename from SpaceWarp.UI/Patching/MainMenuPatcher.cs rename to src/SpaceWarp.UI/Patching/MainMenuPatcher.cs diff --git a/src/SpaceWarp.UI/SpaceWarp.UI.csproj b/src/SpaceWarp.UI/SpaceWarp.UI.csproj new file mode 100644 index 00000000..ea456a29 --- /dev/null +++ b/src/SpaceWarp.UI/SpaceWarp.UI.csproj @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/SpaceWarp.UI/UI/AvcDialog/AvcDialogController.cs b/src/SpaceWarp.UI/UI/AvcDialog/AvcDialogController.cs similarity index 100% rename from SpaceWarp.UI/UI/AvcDialog/AvcDialogController.cs rename to src/SpaceWarp.UI/UI/AvcDialog/AvcDialogController.cs diff --git a/SpaceWarp.UI/UI/Console/LogEntry.cs b/src/SpaceWarp.UI/UI/Console/LogEntry.cs similarity index 100% rename from SpaceWarp.UI/UI/Console/LogEntry.cs rename to src/SpaceWarp.UI/UI/Console/LogEntry.cs diff --git a/SpaceWarp.UI/UI/Console/SpaceWarpConsole.cs b/src/SpaceWarp.UI/UI/Console/SpaceWarpConsole.cs similarity index 100% rename from SpaceWarp.UI/UI/Console/SpaceWarpConsole.cs rename to src/SpaceWarp.UI/UI/Console/SpaceWarpConsole.cs diff --git a/SpaceWarp.UI/UI/Console/SpaceWarpConsoleLogListener.cs b/src/SpaceWarp.UI/UI/Console/SpaceWarpConsoleLogListener.cs similarity index 100% rename from SpaceWarp.UI/UI/Console/SpaceWarpConsoleLogListener.cs rename to src/SpaceWarp.UI/UI/Console/SpaceWarpConsoleLogListener.cs diff --git a/SpaceWarp.UI/UI/ModList/ModListController.cs b/src/SpaceWarp.UI/UI/ModList/ModListController.cs similarity index 99% rename from SpaceWarp.UI/UI/ModList/ModListController.cs rename to src/SpaceWarp.UI/UI/ModList/ModListController.cs index f6b633be..c57f5a7a 100644 --- a/SpaceWarp.UI/UI/ModList/ModListController.cs +++ b/src/SpaceWarp.UI/UI/ModList/ModListController.cs @@ -10,7 +10,6 @@ using SpaceWarpPatcher; using UitkForKsp2; using UitkForKsp2.API; -using UniLinq; using UnityEngine; using UnityEngine.UIElements; using SpaceWarp.Backend.Extensions; diff --git a/SpaceWarp.UI/UI/ModList/ModListItemController.cs b/src/SpaceWarp.UI/UI/ModList/ModListItemController.cs similarity index 100% rename from SpaceWarp.UI/UI/ModList/ModListItemController.cs rename to src/SpaceWarp.UI/UI/ModList/ModListItemController.cs diff --git a/SpaceWarp.UI/UI/Settings/ModsSubMenu.cs b/src/SpaceWarp.UI/UI/Settings/ModsSubMenu.cs similarity index 100% rename from SpaceWarp.UI/UI/Settings/ModsSubMenu.cs rename to src/SpaceWarp.UI/UI/Settings/ModsSubMenu.cs diff --git a/SpaceWarp.UI/UI/Settings/SettingsMenuController.cs b/src/SpaceWarp.UI/UI/Settings/SettingsMenuController.cs similarity index 100% rename from SpaceWarp.UI/UI/Settings/SettingsMenuController.cs rename to src/SpaceWarp.UI/UI/Settings/SettingsMenuController.cs diff --git a/SpaceWarp.VersionChecking/Modules/VersionChecking.cs b/src/SpaceWarp.VersionChecking/Modules/VersionChecking.cs similarity index 100% rename from SpaceWarp.VersionChecking/Modules/VersionChecking.cs rename to src/SpaceWarp.VersionChecking/Modules/VersionChecking.cs diff --git a/src/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj b/src/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj new file mode 100644 index 00000000..2b679b04 --- /dev/null +++ b/src/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/SpaceWarp/Directory.Build.props b/src/SpaceWarp/Directory.Build.props new file mode 100644 index 00000000..33f5d0b0 --- /dev/null +++ b/src/SpaceWarp/Directory.Build.props @@ -0,0 +1,10 @@ + + + + + + + $(PluginBinPath)/$(MSBuildProjectName) + $(PluginObjPath)/$(MSBuildProjectName) + + diff --git a/src/SpaceWarp/Directory.Build.targets b/src/SpaceWarp/Directory.Build.targets new file mode 100644 index 00000000..6c8a1ef0 --- /dev/null +++ b/src/SpaceWarp/Directory.Build.targets @@ -0,0 +1,152 @@ + + + + nuget + mono /usr/local/bin/nuget.exe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SpaceWarp/SpaceWarp.csproj b/src/SpaceWarp/SpaceWarp.csproj new file mode 100644 index 00000000..9cd2cccc --- /dev/null +++ b/src/SpaceWarp/SpaceWarp.csproj @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/SpaceWarp/TypeForwarders.cs b/src/SpaceWarp/TypeForwarders.cs similarity index 100% rename from SpaceWarp/TypeForwarders.cs rename to src/SpaceWarp/TypeForwarders.cs diff --git a/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs b/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs new file mode 100644 index 00000000..91318da2 --- /dev/null +++ b/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs @@ -0,0 +1,116 @@ +using BepInEx; +using BepInEx.Logging; +using JetBrains.Annotations; +using Mono.Cecil; +using Mono.Cecil.Cil; +using Mono.Collections.Generic; +using MonoMod.Cil; +using MonoMod.Utils; + +namespace SpaceWarpPatcher; + + +[UsedImplicitly] +public class AssemblyCSharpPatcher +{ + [UsedImplicitly] + public static IEnumerable TargetDLLs => new[] { "Assembly-CSharp.dll"}; + + + [UsedImplicitly] + public static void Patch(ref AssemblyDefinition assemblyDefinition) + { + // AssemblyDefinition coreAssembly = null; + // var dir = new DirectoryInfo(Paths.PluginPath); + // foreach (var file in dir.EnumerateFiles("SpaceWarp.Core.dll", SearchOption.AllDirectories)) + // { + // coreAssembly = AssemblyDefinition.ReadAssembly(file.FullName); + // } + // + // if (coreAssembly == null) + // { + // throw new Exception("Could not find SpaceWarp Core"); + // } + + var firstTargetType = assemblyDefinition.MainModule.Types.First(t => t.Name == "PartOwnerComponent"); + var boolType = firstTargetType.Fields + .Select(x => x.FieldType).First(x => x.MetadataType == MetadataType.Boolean)!; + firstTargetType.Fields.Add(new FieldDefinition("HasRegisteredPartComponentsForFixedUpdate",FieldAttributes.Public,boolType)); + var field = firstTargetType.Fields.First(x => x.Name == "HasRegisteredPartComponentsForFixedUpdate"); + // Now later we harmony patch the initializer for partownercomponent + + var targetMethod = firstTargetType.Methods.First(method => method.Name == "OnFixedUpdate"); + var methodCallA = assemblyDefinition.MainModule.Types.First(t => t.Name == "ResourceFlowRequestManager").Methods + .First(m => m.Name == "UpdateFlowRequests"); + var methodCallB = firstTargetType.Properties + .First(definition => definition.Name == "ResourceFlowRequestManager").GetMethod; + // var context = new ILContext(targetMethod); + // var cursor = new ILCursor(context); + // var elseEndLabel = cursor.DefineLabel(); + // var elseBeginLabel = cursor.DefineLabel(); + // cursor.GotoNext(MoveType.Before) + // cursor.GotoNext(MoveType.After, instruction => instruction.MatchCallOrCallvirt(methodCallA)); + var insts = targetMethod.Body.Instructions; + Collection newInstructions = new Collection(); + var nextIsTarget = false; + Instruction done = null; + Instruction @else = null; + foreach (var currentInstruction in insts) + { + if (nextIsTarget) + { + done = currentInstruction; + nextIsTarget = false; + } + newInstructions.Add(currentInstruction); + if (!currentInstruction.MatchCallOrCallvirt(methodCallA)) continue; + nextIsTarget = true; + newInstructions.Add(Instruction.Create(OpCodes.Nop)); + newInstructions.Add(Instruction.Create(OpCodes.Ldarg_0)); + @else = newInstructions.Last(); + newInstructions.Add(Instruction.Create(OpCodes.Ldfld,field)); + newInstructions.Add(Instruction.Create(OpCodes.Ldarg_3)); + newInstructions.Add(Instruction.Create(OpCodes.Ldarg_0)); + newInstructions.Add(Instruction.Create(OpCodes.Call, methodCallB)); + newInstructions.Add(Instruction.Create(OpCodes.Ldarg_1)); + newInstructions.Add(Instruction.Create(OpCodes.Ldarg_2)); + newInstructions.Add(Instruction.Create(OpCodes.Callvirt, methodCallA)); + } + + var isFirstJump = true; + for (var i = 0; i < newInstructions.Count; i++) + { + var currentInstruction = newInstructions[i]; + if (currentInstruction.OpCode == OpCodes.Brfalse_S) + { + if (isFirstJump) + { + isFirstJump = false; + } + else + { + newInstructions[i] = Instruction.Create(OpCodes.Brfalse_S, @else); + } + } + + if (currentInstruction.OpCode == OpCodes.Bne_Un_S) + { + newInstructions[i] = Instruction.Create(OpCodes.Bne_Un_S, @else); + } + + if (currentInstruction.OpCode == OpCodes.Nop) + { + newInstructions[i] = Instruction.Create(OpCodes.Br_S, done); + } + + if (currentInstruction.OpCode == OpCodes.Ldarg_3) + { + newInstructions[i] = Instruction.Create(OpCodes.Brfalse_S, done); + } + } + + + insts.Clear(); + insts.AddRange(newInstructions); + } +} \ No newline at end of file diff --git a/src/SpaceWarpPatcher/Directory.Build.props b/src/SpaceWarpPatcher/Directory.Build.props new file mode 100644 index 00000000..735845f2 --- /dev/null +++ b/src/SpaceWarpPatcher/Directory.Build.props @@ -0,0 +1,10 @@ + + + + + + + $(PatcherBinPath)/$(MSBuildProjectName) + $(PatcherObjPath)/$(MSBuildProjectName) + + diff --git a/SpaceWarpPatcher/Patcher.cs b/src/SpaceWarpPatcher/Patcher.cs similarity index 100% rename from SpaceWarpPatcher/Patcher.cs rename to src/SpaceWarpPatcher/Patcher.cs diff --git a/SpaceWarpPatcher/PathsGenerator.cs b/src/SpaceWarpPatcher/PathsGenerator.cs similarity index 100% rename from SpaceWarpPatcher/PathsGenerator.cs rename to src/SpaceWarpPatcher/PathsGenerator.cs diff --git a/SpaceWarpPatcher/SpaceWarpPatcher.csproj b/src/SpaceWarpPatcher/SpaceWarpPatcher.csproj similarity index 55% rename from SpaceWarpPatcher/SpaceWarpPatcher.csproj rename to src/SpaceWarpPatcher/SpaceWarpPatcher.csproj index c4f49825..c304ba38 100644 --- a/SpaceWarpPatcher/SpaceWarpPatcher.csproj +++ b/src/SpaceWarpPatcher/SpaceWarpPatcher.csproj @@ -1,16 +1,12 @@ - - $(SpaceWarpVersion) - SpaceWarpPatcher - - - - - - - - - + + + + + + + + - \ No newline at end of file + diff --git a/SpaceWarpPatcher/SwinfoTransformer.cs b/src/SpaceWarpPatcher/SwinfoTransformer.cs similarity index 100% rename from SpaceWarpPatcher/SwinfoTransformer.cs rename to src/SpaceWarpPatcher/SwinfoTransformer.cs diff --git a/SpaceWarpTest/API/Versions/SemanticVersionTests.cs b/src/SpaceWarpTest/API/Versions/SemanticVersionTests.cs similarity index 100% rename from SpaceWarpTest/API/Versions/SemanticVersionTests.cs rename to src/SpaceWarpTest/API/Versions/SemanticVersionTests.cs diff --git a/src/SpaceWarpTest/Directory.Build.props b/src/SpaceWarpTest/Directory.Build.props new file mode 100644 index 00000000..f56fa7d2 --- /dev/null +++ b/src/SpaceWarpTest/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + + + false + $(SolutionDir)/build/bin/test/$(MSBuildProjectName) + $(SolutionDir)/build/obj/test/$(MSBuildProjectName) + + diff --git a/SpaceWarpTest/GlobalUsings.cs b/src/SpaceWarpTest/GlobalUsings.cs similarity index 100% rename from SpaceWarpTest/GlobalUsings.cs rename to src/SpaceWarpTest/GlobalUsings.cs diff --git a/SpaceWarpTest/SpaceWarpTest.csproj b/src/SpaceWarpTest/SpaceWarpTest.csproj similarity index 68% rename from SpaceWarpTest/SpaceWarpTest.csproj rename to src/SpaceWarpTest/SpaceWarpTest.csproj index 6a06e74d..7b4d8082 100644 --- a/SpaceWarpTest/SpaceWarpTest.csproj +++ b/src/SpaceWarpTest/SpaceWarpTest.csproj @@ -1,24 +1,23 @@ + net7.0 enable enable - false true false true - - - - - - - + + + + + + + - - - + +