From 319bac0b5374fe9d1e409ce97362192b8f6f7d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Wed, 20 Dec 2023 03:14:50 +0100 Subject: [PATCH 01/35] Reworked as a SpaceWarp.Template project with better build process --- .github/workflows/build_spacewarp.yml | 38 +-- .gitignore | 6 +- Directory.Build.props | 91 +++--- Directory.Build.targets | 8 - LICENSE | 3 +- NuGet.config | 6 - SpaceWarp.nuspec => Package.nuspec | 22 +- README.md | 2 + SpaceWarp.Core/SpaceWarp.Core.csproj | 41 --- SpaceWarp.Game/SpaceWarp.Game.csproj | 11 - .../SpaceWarp.Messaging.csproj | 5 - SpaceWarp.Sound/SpaceWarp.Sound.csproj | 11 - SpaceWarp.UI/SpaceWarp.UI.csproj | 21 -- .../SpaceWarp.VersionChecking.csproj | 10 - SpaceWarp.sln | 108 ++++--- SpaceWarp/SpaceWarp.csproj | 29 -- .../assets/images/oabTrayButton.png | Bin 257 -> 0 bytes build.bat | 3 - build.ps1 | 1 - build.sh | 3 - builder.py | 273 ------------------ .../BepInEx/core/0Harmony.dll | Bin .../BepInEx/core/0Harmony.xml | 0 .../BepInEx/core/0Harmony20.dll | Bin .../BepInEx/core/BepInEx.Harmony.dll | Bin .../BepInEx/core/BepInEx.Harmony.xml | 0 .../BepInEx/core/BepInEx.Preloader.dll | Bin .../BepInEx/core/BepInEx.Preloader.xml | 0 .../BepInEx/core/BepInEx.dll | Bin .../BepInEx/core/BepInEx.xml | 0 .../BepInEx/core/HarmonyXInterop.dll | Bin .../BepInEx/core/Mono.Cecil.Mdb.dll | Bin .../BepInEx/core/Mono.Cecil.Pdb.dll | Bin .../BepInEx/core/Mono.Cecil.Rocks.dll | Bin .../BepInEx/core/Mono.Cecil.dll | Bin .../BepInEx/core/MonoMod.RuntimeDetour.dll | Bin .../BepInEx/core/MonoMod.RuntimeDetour.xml | 0 .../BepInEx/core/MonoMod.Utils.dll | Bin .../BepInEx/core/MonoMod.Utils.xml | 0 .../lib}/Microsoft.CodeAnalysis.CSharp.dll | Bin .../lib}/Microsoft.CodeAnalysis.CSharp.xml | 0 .../SpaceWarp/lib}/Microsoft.CodeAnalysis.dll | Bin .../SpaceWarp/lib}/Microsoft.CodeAnalysis.xml | 0 .../lib}/System.Collections.Immutable.dll | Bin .../lib}/System.Collections.Immutable.xml | 0 .../patchers/SpaceWarp/lib}/System.Memory.dll | Bin .../patchers/SpaceWarp/lib}/System.Memory.xml | 0 .../lib}/System.Numerics.Vectors.dll | Bin .../lib}/System.Numerics.Vectors.xml | 0 .../lib}/System.Reflection.Metadata.dll | Bin .../lib}/System.Reflection.Metadata.xml | 0 ...System.Runtime.CompilerServices.Unsafe.dll | Bin ...System.Runtime.CompilerServices.Unsafe.xml | 0 .../System.Threading.Tasks.Extensions.dll | Bin .../System.Threading.Tasks.Extensions.xml | 0 .../ConfigurationManager.dll | Bin .../ConfigurationManager.xml | 0 .../plugins/ConfigurationManager}/LICENSE | 68 +---- .../plugins}/ConfigurationManager/README | 0 .../SpaceWarp}/assets/bundles/README.md | 0 .../assets/bundles/avcdialog.bundle | Bin .../SpaceWarp}/assets/bundles/modlist.bundle | Bin .../assets/bundles/swconsole.bundle | Bin .../assets/bundles/swconsoleui.bundle | Bin .../SpaceWarp}/assets/images/console.png | Bin .../SpaceWarp/assets/images/oabTrayButton.png | Bin 0 -> 4115 bytes .../space_warp_localizations.csv | 0 .../BepInEx/plugins/SpaceWarp}/swinfo.json | 22 +- .../LICENSE | 70 +---- .../BepInEx 5.4.21 => plugin_template}/README | 0 .../changelog.txt | 0 .../doorstop_config.ini | 0 .../winhttp.dll | Bin requirements.txt | 1 - scripts/build-debug.bat | 2 + scripts/build-deploy.bat | 2 + scripts/build-release.bat | 2 + scripts/build-run.bat | 2 + .../API/Assets/AssetManager.cs | 0 .../API/Configuration/BepInExConfigEntry.cs | 0 .../API/Configuration/BepInExConfigFile.cs | 0 .../API/Configuration/ConfigValue.cs | 0 .../API/Configuration/EmptyConfigFile.cs | 0 .../API/Configuration/IConfigEntry.cs | 0 .../API/Configuration/IConfigFile.cs | 0 .../API/Configuration/IValueConstraint.cs | 0 .../API/Configuration/JsonConfigEntry.cs | 0 .../API/Configuration/JsonConfigFile.cs | 0 .../API/Configuration/ListConstraint.cs | 0 .../API/Configuration/RangeConstraint.cs | 0 .../API/Configuration/ValueConstraint.cs | 0 .../SpaceWarp.Core}/API/Loading/Loading.cs | 0 .../SpaceWarp.Core}/API/Loading/SaveLoad.cs | 0 .../SpaceWarp.Core}/API/Logging/BaseLogger.cs | 0 .../API/Logging/BepInExLogger.cs | 0 .../SpaceWarp.Core}/API/Logging/ILogger.cs | 0 .../SpaceWarp.Core}/API/Logging/LogLevel.cs | 0 .../API/Logging/UnityLogSource.cs | 0 .../SpaceWarp.Core}/API/Lua/LuaMod.cs | 0 .../API/Lua/SpaceWarpInterop.cs | 0 .../API/Lua/SpaceWarpLuaAPIAttribute.cs | 0 .../SpaceWarp.Core}/API/Lua/UI/LuaUITK.cs | 0 .../API/Mods/BaseKspLoaderSpaceWarpMod.cs | 0 .../API/Mods/BaseSpaceWarpPlugin.cs | 0 .../API/Mods/GlobalModDefines.cs | 0 .../SpaceWarp.Core}/API/Mods/ISpaceWarpMod.cs | 0 .../JSON/Converters/SpecVersionConverter.cs | 0 .../API/Mods/JSON/DependencyInfo.cs | 0 .../SpaceWarp.Core}/API/Mods/JSON/ModInfo.cs | 0 .../API/Mods/JSON/SpecVersion.cs | 0 .../API/Mods/JSON/SupportedVersionsInfo.cs | 0 .../API/Mods/JSON/VersionCheckType.cs | 0 .../SpaceWarp.Core}/API/Mods/PluginList.cs | 0 .../API/Mods/SpaceWarpErrorDescription.cs | 2 +- .../API/Mods/SpaceWarpPluginDescriptor.cs | 0 .../SpaceWarp.Core}/API/Parts/Colors.cs | 0 .../API/SaveGameManager/ModSaves.cs | 0 .../API/Versions/SemanticVersion.cs | 0 .../API/Versions/VersionUtility.cs | 0 .../SpaceWarp.Core}/AssemblyInfo.cs | 0 .../Backend/Modding/AssetOnlyMod.cs | 0 .../Backend/Modding/BepInExModAdapter.cs | 0 .../Backend/Modding/Ksp2ModInfo.cs | 0 .../Backend/Modding/KspModAdapter.cs | 0 .../Backend/Modding/PluginRegister.cs | 0 .../Backend/SaveGameManager/PluginSaveData.cs | 0 .../SpaceWarpSerializedSavedGame.cs | 0 src/SpaceWarp.Core/Directory.Build.props | 10 + .../InternalUtilities/AssetHelpers.cs | 0 .../InternalUtilities/InternalExtensions.cs | 0 .../InternalUtilities/PathHelpers.cs | 0 .../SpaceWarp.Core}/Modules/ModuleManager.cs | 0 .../Modules/SpaceWarpModule.cs | 0 .../Patching/BootstrapPatch.cs | 0 .../Patching/CodeGenerationUtilities.cs | 0 .../SpaceWarp.Core}/Patching/ColorsPatch.cs | 0 .../SpaceWarp.Core}/Patching/FixGetTypes.cs | 0 .../LoadingActions/AddressableAction.cs | 0 .../LoadingActions/DescriptorLoadingAction.cs | 0 .../FunctionalLoadingActions.cs | 0 .../LoadingActions/InitializeModAction.cs | 0 .../LoadingActions/LoadAddressablesAction.cs | 0 .../LoadingActions/LoadLocalizationAction.cs | 0 .../Patching/LoadingActions/LoadLuaAction.cs | 0 .../LoadingAddressablesLocalizationsAction.cs | 0 .../LoadingActions/ModLoadingAction.cs | 0 .../LoadingActions/PostInitializeModAction.cs | 0 .../LoadingActions/PreInitializeModAction.cs | 0 .../ResolvingPatchOrderAction.cs | 0 .../Patching/ModLoaderPatch.cs | 0 .../SaveGameManager/SaveGamePatches.cs | 0 .../Patching/SequentialFlowLoadersPatcher.cs | 0 .../Patching/SettingsManagerPatcher.cs | 0 src/SpaceWarp.Core/SpaceWarp.Core.csproj | 26 ++ .../SpaceWarp.Core}/SpaceWarpPlugin.cs | 1 - .../Game/Extensions/PartProviderExtensions.cs | 0 .../Extensions/VesselVehicleExtensions.cs | 0 .../API/Game/Messages/StateChanges.cs | 0 .../API/Game/Messages/StateLoadings.cs | 0 .../SpaceWarp.Game}/API/Game/Vehicle.cs | 0 .../SpaceWarp.Game}/Modules/Game.cs | 0 src/SpaceWarp.Game/SpaceWarp.Game.csproj | 11 + .../API/Messaging/MessageBus.cs | 0 .../API/Messaging/MessageBusBase.cs | 0 .../API/Messaging/MessageBusManager.cs | 0 .../SpaceWarp.Messaging}/Modules/Messaging.cs | 0 .../SpaceWarp.Messaging.csproj | 6 + .../SpaceWarp.Sound}/API/Sound/Soundbank.cs | 0 .../API/Sound/SoundbankManager.cs | 0 .../SpaceWarp.Sound}/Modules/Sound.cs | 0 src/SpaceWarp.Sound/SpaceWarp.Sound.csproj | 11 + .../SpaceWarp.UI}/API/Lua/AppBarInterop.cs | 0 .../SpaceWarp.UI}/API/UI/Appbar/Appbar.cs | 0 .../SpaceWarp.UI}/API/UI/Appbar/AppbarMenu.cs | 0 .../SpaceWarp.UI}/API/UI/MainMenu.cs | 0 .../SpaceWarp.UI}/API/UI/ModList.cs | 0 .../API/UI/Settings/ModsPropertyDrawers.cs | 0 .../SpaceWarp.UI}/API/UI/Skins.cs | 0 .../Extensions/ErrorDescriptionExtensions.cs | 0 .../Backend/UI/Appbar/AppbarBackend.cs | 0 .../UI/Loading/LoadingScreenManager.cs | 1 - ...tomSettingsElementDescriptionController.cs | 0 .../SpaceWarp.UI}/Modules/UI.cs | 0 .../Patching/ConfigurationPatch.cs | 0 .../SpaceWarp.UI}/Patching/CurtainPatch.cs | 0 .../Patching/LoadingFlowPatch.cs | 0 .../LoadingScreenDeserializationPatch.cs | 0 .../SpaceWarp.UI}/Patching/MainMenuPatcher.cs | 0 src/SpaceWarp.UI/SpaceWarp.UI.csproj | 18 ++ .../UI/AvcDialog/AvcDialogController.cs | 0 .../SpaceWarp.UI}/UI/Console/LogEntry.cs | 0 .../UI/Console/SpaceWarpConsole.cs | 0 .../UI/Console/SpaceWarpConsoleLogListener.cs | 0 .../UI/ModList/ModListController.cs | 1 - .../UI/ModList/ModListItemController.cs | 0 .../SpaceWarp.UI}/UI/Settings/ModsSubMenu.cs | 0 .../UI/Settings/SettingsMenuController.cs | 0 .../Modules/VersionChecking.cs | 0 .../SpaceWarp.VersionChecking.csproj | 10 + src/SpaceWarp/Directory.Build.props | 10 + src/SpaceWarp/Directory.Build.targets | 144 +++++++++ src/SpaceWarp/SpaceWarp.csproj | 19 ++ .../SpaceWarp}/TypeForwarders.cs | 0 src/SpaceWarpPatcher/Directory.Build.props | 10 + .../SpaceWarpPatcher}/Patcher.cs | 0 .../SpaceWarpPatcher}/PathsGenerator.cs | 0 .../SpaceWarpPatcher}/SpaceWarpPatcher.csproj | 22 +- .../SpaceWarpPatcher}/SwinfoTransformer.cs | 0 .../API/Versions/SemanticVersionTests.cs | 0 src/SpaceWarpTest/Directory.Build.props | 11 + .../SpaceWarpTest}/GlobalUsings.cs | 0 .../SpaceWarpTest}/SpaceWarpTest.csproj | 21 +- 212 files changed, 484 insertions(+), 711 deletions(-) delete mode 100644 Directory.Build.targets delete mode 100644 NuGet.config rename SpaceWarp.nuspec => Package.nuspec (53%) create mode 100644 README.md delete mode 100644 SpaceWarp.Core/SpaceWarp.Core.csproj delete mode 100644 SpaceWarp.Game/SpaceWarp.Game.csproj delete mode 100644 SpaceWarp.Messaging/SpaceWarp.Messaging.csproj delete mode 100644 SpaceWarp.Sound/SpaceWarp.Sound.csproj delete mode 100644 SpaceWarp.UI/SpaceWarp.UI.csproj delete mode 100644 SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj delete mode 100644 SpaceWarp/SpaceWarp.csproj delete mode 100644 SpaceWarpBuildTemplate/assets/images/oabTrayButton.png delete mode 100644 build.bat delete mode 100644 build.ps1 delete mode 100644 build.sh delete mode 100644 builder.py rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/0Harmony.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/0Harmony.xml (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/0Harmony20.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/BepInEx.Harmony.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/BepInEx.Harmony.xml (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/BepInEx.Preloader.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/BepInEx.Preloader.xml (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/BepInEx.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/BepInEx.xml (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/HarmonyXInterop.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/Mono.Cecil.Mdb.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/Mono.Cecil.Pdb.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/Mono.Cecil.Rocks.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/Mono.Cecil.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/MonoMod.RuntimeDetour.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/MonoMod.RuntimeDetour.xml (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/MonoMod.Utils.dll (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/BepInEx/core/MonoMod.Utils.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/Microsoft.CodeAnalysis.CSharp.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/Microsoft.CodeAnalysis.CSharp.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/Microsoft.CodeAnalysis.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/Microsoft.CodeAnalysis.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Collections.Immutable.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Collections.Immutable.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Memory.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Memory.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Numerics.Vectors.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Numerics.Vectors.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Reflection.Metadata.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Reflection.Metadata.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Runtime.CompilerServices.Unsafe.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Runtime.CompilerServices.Unsafe.xml (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Threading.Tasks.Extensions.dll (100%) rename {SpaceWarpPatcherLibraries => plugin_template/BepInEx/patchers/SpaceWarp/lib}/System.Threading.Tasks.Extensions.xml (100%) rename {ThirdParty => plugin_template/BepInEx/plugins}/ConfigurationManager/ConfigurationManager.dll (100%) rename {ThirdParty => plugin_template/BepInEx/plugins}/ConfigurationManager/ConfigurationManager.xml (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template/BepInEx/plugins/ConfigurationManager}/LICENSE (83%) rename {ThirdParty => plugin_template/BepInEx/plugins}/ConfigurationManager/README (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/assets/bundles/README.md (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/assets/bundles/avcdialog.bundle (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/assets/bundles/modlist.bundle (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/assets/bundles/swconsole.bundle (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/assets/bundles/swconsoleui.bundle (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/assets/images/console.png (100%) create mode 100644 plugin_template/BepInEx/plugins/SpaceWarp/assets/images/oabTrayButton.png rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/localizations/space_warp_localizations.csv (100%) rename {SpaceWarpBuildTemplate => plugin_template/BepInEx/plugins/SpaceWarp}/swinfo.json (62%) rename {ThirdParty/ConfigurationManager => plugin_template}/LICENSE (83%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/README (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/changelog.txt (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/doorstop_config.ini (100%) rename {ThirdParty/BepInEx 5.4.21 => plugin_template}/winhttp.dll (100%) delete mode 100644 requirements.txt create mode 100644 scripts/build-debug.bat create mode 100644 scripts/build-deploy.bat create mode 100644 scripts/build-release.bat create mode 100644 scripts/build-run.bat rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Assets/AssetManager.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/BepInExConfigEntry.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/BepInExConfigFile.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/ConfigValue.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/EmptyConfigFile.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/IConfigEntry.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/IConfigFile.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/IValueConstraint.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/JsonConfigEntry.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/JsonConfigFile.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/ListConstraint.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/RangeConstraint.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Configuration/ValueConstraint.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Loading/Loading.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Loading/SaveLoad.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Logging/BaseLogger.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Logging/BepInExLogger.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Logging/ILogger.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Logging/LogLevel.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Logging/UnityLogSource.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Lua/LuaMod.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Lua/SpaceWarpInterop.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Lua/SpaceWarpLuaAPIAttribute.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Lua/UI/LuaUITK.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/BaseKspLoaderSpaceWarpMod.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/BaseSpaceWarpPlugin.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/GlobalModDefines.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/ISpaceWarpMod.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/JSON/Converters/SpecVersionConverter.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/JSON/DependencyInfo.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/JSON/ModInfo.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/JSON/SpecVersion.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/JSON/SupportedVersionsInfo.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/JSON/VersionCheckType.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/PluginList.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/SpaceWarpErrorDescription.cs (96%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Mods/SpaceWarpPluginDescriptor.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Parts/Colors.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/SaveGameManager/ModSaves.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Versions/SemanticVersion.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/API/Versions/VersionUtility.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/AssemblyInfo.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/Modding/AssetOnlyMod.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/Modding/BepInExModAdapter.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/Modding/Ksp2ModInfo.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/Modding/KspModAdapter.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/Modding/PluginRegister.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/SaveGameManager/PluginSaveData.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Backend/SaveGameManager/SpaceWarpSerializedSavedGame.cs (100%) create mode 100644 src/SpaceWarp.Core/Directory.Build.props rename {SpaceWarp.Core => src/SpaceWarp.Core}/InternalUtilities/AssetHelpers.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/InternalUtilities/InternalExtensions.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/InternalUtilities/PathHelpers.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Modules/ModuleManager.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Modules/SpaceWarpModule.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/BootstrapPatch.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/CodeGenerationUtilities.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/ColorsPatch.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/FixGetTypes.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/AddressableAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/DescriptorLoadingAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/FunctionalLoadingActions.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/InitializeModAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/LoadAddressablesAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/LoadLocalizationAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/LoadLuaAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/LoadingAddressablesLocalizationsAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/ModLoadingAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/PostInitializeModAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/PreInitializeModAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/LoadingActions/ResolvingPatchOrderAction.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/ModLoaderPatch.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/SaveGameManager/SaveGamePatches.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/SequentialFlowLoadersPatcher.cs (100%) rename {SpaceWarp.Core => src/SpaceWarp.Core}/Patching/SettingsManagerPatcher.cs (100%) create mode 100644 src/SpaceWarp.Core/SpaceWarp.Core.csproj rename {SpaceWarp.Core => src/SpaceWarp.Core}/SpaceWarpPlugin.cs (99%) rename {SpaceWarp.Game => src/SpaceWarp.Game}/API/Game/Extensions/PartProviderExtensions.cs (100%) rename {SpaceWarp.Game => src/SpaceWarp.Game}/API/Game/Extensions/VesselVehicleExtensions.cs (100%) rename {SpaceWarp.Game => src/SpaceWarp.Game}/API/Game/Messages/StateChanges.cs (100%) rename {SpaceWarp.Game => src/SpaceWarp.Game}/API/Game/Messages/StateLoadings.cs (100%) rename {SpaceWarp.Game => src/SpaceWarp.Game}/API/Game/Vehicle.cs (100%) rename {SpaceWarp.Game => src/SpaceWarp.Game}/Modules/Game.cs (100%) create mode 100644 src/SpaceWarp.Game/SpaceWarp.Game.csproj rename {SpaceWarp.Messaging => src/SpaceWarp.Messaging}/API/Messaging/MessageBus.cs (100%) rename {SpaceWarp.Messaging => src/SpaceWarp.Messaging}/API/Messaging/MessageBusBase.cs (100%) rename {SpaceWarp.Messaging => src/SpaceWarp.Messaging}/API/Messaging/MessageBusManager.cs (100%) rename {SpaceWarp.Messaging => src/SpaceWarp.Messaging}/Modules/Messaging.cs (100%) create mode 100644 src/SpaceWarp.Messaging/SpaceWarp.Messaging.csproj rename {SpaceWarp.Sound => src/SpaceWarp.Sound}/API/Sound/Soundbank.cs (100%) rename {SpaceWarp.Sound => src/SpaceWarp.Sound}/API/Sound/SoundbankManager.cs (100%) rename {SpaceWarp.Sound => src/SpaceWarp.Sound}/Modules/Sound.cs (100%) create mode 100644 src/SpaceWarp.Sound/SpaceWarp.Sound.csproj rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/Lua/AppBarInterop.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/UI/Appbar/Appbar.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/UI/Appbar/AppbarMenu.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/UI/MainMenu.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/UI/ModList.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/UI/Settings/ModsPropertyDrawers.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/API/UI/Skins.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Backend/Extensions/ErrorDescriptionExtensions.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Backend/UI/Appbar/AppbarBackend.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Backend/UI/Loading/LoadingScreenManager.cs (99%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Backend/UI/Settings/CustomSettingsElementDescriptionController.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Modules/UI.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Patching/ConfigurationPatch.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Patching/CurtainPatch.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Patching/LoadingFlowPatch.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Patching/LoadingScreenDeserializationPatch.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/Patching/MainMenuPatcher.cs (100%) create mode 100644 src/SpaceWarp.UI/SpaceWarp.UI.csproj rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/AvcDialog/AvcDialogController.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/Console/LogEntry.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/Console/SpaceWarpConsole.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/Console/SpaceWarpConsoleLogListener.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/ModList/ModListController.cs (99%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/ModList/ModListItemController.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/Settings/ModsSubMenu.cs (100%) rename {SpaceWarp.UI => src/SpaceWarp.UI}/UI/Settings/SettingsMenuController.cs (100%) rename {SpaceWarp.VersionChecking => src/SpaceWarp.VersionChecking}/Modules/VersionChecking.cs (100%) create mode 100644 src/SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj create mode 100644 src/SpaceWarp/Directory.Build.props create mode 100644 src/SpaceWarp/Directory.Build.targets create mode 100644 src/SpaceWarp/SpaceWarp.csproj rename {SpaceWarp => src/SpaceWarp}/TypeForwarders.cs (100%) create mode 100644 src/SpaceWarpPatcher/Directory.Build.props rename {SpaceWarpPatcher => src/SpaceWarpPatcher}/Patcher.cs (100%) rename {SpaceWarpPatcher => src/SpaceWarpPatcher}/PathsGenerator.cs (100%) rename {SpaceWarpPatcher => src/SpaceWarpPatcher}/SpaceWarpPatcher.csproj (55%) rename {SpaceWarpPatcher => src/SpaceWarpPatcher}/SwinfoTransformer.cs (100%) rename {SpaceWarpTest => src/SpaceWarpTest}/API/Versions/SemanticVersionTests.cs (100%) create mode 100644 src/SpaceWarpTest/Directory.Build.props rename {SpaceWarpTest => src/SpaceWarpTest}/GlobalUsings.cs (100%) rename {SpaceWarpTest => src/SpaceWarpTest}/SpaceWarpTest.csproj (68%) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index c67e4b6a..5059c59a 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -7,37 +7,31 @@ on: branches: [ "main", "dev" ] jobs: - build: + build-debug: runs-on: ubuntu-latest - - strategy: - matrix: - run_args: ["" , "-r"] - + + steps: + - name: Check Out Repository + uses: actions/checkout@v3 + + - name: Build the solution + run: dotnet build "SpaceWarp.sln" -c ${{ matrix.run_args }} + + build-release: + runs-on: ubuntu-latest + steps: - 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: Build the solution + run: dotnet build "SpaceWarp.sln" -c ${{ matrix.run_args }} - 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. + echo "zip=$(ls -1 dist/SpaceWarp-*.zip | head -n 1)" >> $GITHUB_ENV + echo "artifact_name=SpaceWarpRelease" >> $GITHUB_ENV - name: Upload Artifact uses: actions/upload-artifact@v3 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 ca651e7789eb4c7756091cd2db2b1e46079d50f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCils0(?ST|Ns9FWQHEPTnD6>N`m}?|1&(@Zr}yvaTa()7BevL9R^{> 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 0000000000000000000000000000000000000000..98a02919d757956db34464c60314b6351ffc6896 GIT binary patch literal 4115 zcmbVP2{=@3-#;Wm*;;I2Oi^NX+e|1ijO zlx#^#B~%Y(3y+9+kGAjmzU%$o_j=#Ct~2L8_x=0-{`>zrC)&Zza-D>d1ONc*tO({# z;2pAZtq}$PIUyl4;7x>PYHJDrn9_O(nn~JdT^{)#Tnm2j2s43E~HjyxOnxmLhpSnQdj=KEPQox0%8$6XB*`W> zqUGdgq`%ppZpbdJr)@PEzcAI|iT!LtIwOFWC~LzsY#-*+u3+3Y*9>Hxo>LQB;;D+7 zrUyx7HLk~>jJ|sAv9(O)rREP3x9CQ=i&rVcb!ki;$5KcUiTGAaYG0U9nrWS46@T)hj+LIP4&%WQy@! z-E6weaCKXR^;@M|LX3!oLmO-av_qS2i%QCfkkrxU$KR=MB&_c`-3k$pEnIMYx-4WIT^E_T0=xYqmH9)qcVKq1yRfU*WR|W#&2!kES-Fz z=#I+WjJxXwG>=FIY2DU*BRX+`HpH3Co3l7-u!IW}ZrB~G>AQY(jrz&0_cZrtWGAxX zCIyr6gsp|L*Q1Y{!;fq!j}JN*lxk>k)H+^$B+i4-xmBGmHX<{!c?3S9k!sTe-5H*BBL#`=ZOK{ra#Oc~VcczDr5J%)jwsh^kl20i^yQ3Ls|5V}B2(&!qfz}#)#^4^3 zqrS5eD7c=ucHgCsc-x#!&JDRz4m2v2lH78t#piL)!^|X=Jat`InmjDhW$#Wq<*RiE za{jna7pJw%YFxKImDKtemdLp{^l)QKWy|ZN&~5g~feH3W{TlsR%ML<$m-A%`V)M!l z4&>Zxb^7SkmsgyJx4wX=%U`4YQA<>-WS>z%Z>eGamEw2V7fXnFTvNJ5>ebPL^eY}E zM=gTgBXhh<@9optk1d+I2)7Q*$?wn}she@zhu>$vFZ*!aN5RJvX;tn8?)C1MUYhYv z;LMD@>OAT!kGYuP8|}B)=i-MlHN6tDQwys1->~O+Ss&2$@GEl3@3~l&UX{!*;h&vd zrBZP|qD?77G~+;xg6Anl#kk39<&d(>NUt2Pm^Zv*uKi9~MGf}h9YDaLfIAppqylQI zB2LjqsY>CzV&}P|F;g+Pm`r6q1xv*V^f+e8*P9gY-Q~;fCqC%z)9wGGZzd39j7f5f zc>&{8RM*anPQ$0=AI~HoNg6xIZ$9BYKr4Ti(>xfFm#EQS@r?a)Z{v=h!k)t?O{pTt zy$Z?KJA2xCl#A`%8Y;{GknP=kbN)$BhyIJ%sIhML*!%SNF^`+ax<^y^fAMo?xeKlf zt7dbh3Z-mLi=J*i|M9$kvu3l^HqZR6`MGxO8Mf*3ZDVcIaDDhEkG5)PiE0VHWEBI= z$YwlaTzK{D)%sTlUeSzojCw-Sr_DpZ28~Z`{_Hg69jq7nB;-JF>Gb$t>hmHC#08_- zXVdQ&_zQQ#-h|bDQ!VcBxO<>;M0&AqF>qnm+72n#^^;_XCK6JnIcXJ3ckpsJh}1CD zoFhzrlKC^XD|R6pmwm4z6WLNWT=t=Cp7ngPVzP71P!v!0IdmhmI?mIvx1g-xYC&}( zL;Fi{dQ?>u{G6&+Ufqt+XNk`wikw}t&c~f2JxGtjH=k-&jXu^sL(@n8Ie2^U@Q{xi zytuBI=5NWzhNh95wT5gS^fe_n*=zJ_jM}BxaS6qQ^nn^yQ8gmoDB)xLhlFnl(i-7= z#qH_VO?eNlX1;5gj1R7(Kcc^&M~r+Oi5$uG^Y0mT!#w^nU_jliScI+-A$GPC8yqZe z;SH1MS#AmQn%X*_%&WNih}vD22wG?xr6hFxrk|sqn_uV@aa#X<%yo|Y{svWdwVU;{ zh_9zktXr>atgrgUy!Ybmk^G|xixrFeFEttj%5UH3ucOdESe}>XkP~~*u;Llt@3nrn z{&>~#u@8MkRpC0`@}4k#t&;6w2k-5u{u(o4kl26prECNFa(4xH*{;>@P1}H{RIOC9 zRr33!n2FiG*N%1w#E$UFZ9eUZXQ&%_q2i&Dp_bamv}+4>3;8Z}rFO;jo-b@6q5U0U&EKx`_VSu|6H+YcSJ%E2O!#&jE-;M3rUXw~kzL9CH_tIIUD}X#=90izUldl)M-9exZMuc;MIY1sIvg|M(eUZ8p8s`bZskU`Rm~@xGsDytzD*v< z8ZzFdu+2TZV==obqsyyXi1&`$%Gczd=i~Y7GG|O)JPqi3y_DN|;k4bg%t9Y(}fg*?e)cE@OlK2H-~(}zbb zMdyk#p6itIW)95UT&8?>UJ$(B-OMZc1g-ljq&z?+@#$6W{>8tYGS+U zceN>n&ssk~Ol*_LjLjn26x!(9r`l$u@w4hbbKgIWrj4|3@{tHnT&kR{ZktvM<1Ahe z*Z1ZRu3m1+@3;1P)L=Ao_(f4>wV>Lv)cGKyRlY7RoHGX-3h1w$3`~%8n<$^q-ZdOH zyfi%h`EGu^7$bfUHa3ZYYsq5Ji0k+v)|sxO@o!lpWh*b&Jgeq<~Ky2}J&6odl_ z0;pUPBq+e2!NCO?L%;Ll!1c;D0t)#K;rbavO;;2`Tx}g7W=u8}f`ubtWF!&=F~Gu6 zx>T~aE?NhIMxxOO6dHjNl3<%j7aS zzRdrJ`uFkwQUJ!**7moKe`-rWz;6{CE}jp%@iQR*6wM(9v#1CsDu>Bqlc{(vWZNl|F29r{4yDW)`g=X+xOEM6lNet>u&;7a}t+o3fgyEaXe1Gd z#GwpvdWPCaG!BXU0kvgP=sv-JgQ8ZlOGIOEdSH(AwUMa*fr2$dA#q9n7EB@Ie3_m{jmlgwMm>@RuBe<*Lyrh~0T^8c@S zRvK=lBya>e2TWG*&yH}W9{IWQr$fG10ggmoscvH^c_pn>3iRhT{lAXD586OqDoFY- z()|O*Vft_bNo=Yq4UE>mEhhwMJYuB}fB1p;zb<}1`&-Zcf`fx#W%+vqfe*ij7?lA| zE;cx#=Ba~j;CQpMGB+i + + + + + + $(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/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..78c4f151 --- /dev/null +++ b/src/SpaceWarp.Game/SpaceWarp.Game.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + 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..61d752c9 --- /dev/null +++ b/src/SpaceWarp/Directory.Build.targets @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/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 - - - - - - - + + + + + + + - - - + + From 1f14da3ee40360bb96e0730c8d4410663a012fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Wed, 20 Dec 2023 03:16:16 +0100 Subject: [PATCH 02/35] Fixed workflow (hopefully) --- .github/workflows/build_spacewarp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index 5059c59a..421f9c16 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Build the solution - run: dotnet build "SpaceWarp.sln" -c ${{ matrix.run_args }} + run: dotnet build "SpaceWarp.sln" -c Debug build-release: runs-on: ubuntu-latest @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@v3 - name: Build the solution - run: dotnet build "SpaceWarp.sln" -c ${{ matrix.run_args }} + run: dotnet build "SpaceWarp.sln" -c Release - name: Find Zip id: find-zip From 82dc128e3d8414cd0623bc40cc2f5d6469c8b07d Mon Sep 17 00:00:00 2001 From: Falki-git <72734856+Falki-git@users.noreply.github.com> Date: Wed, 20 Dec 2023 11:59:37 +0100 Subject: [PATCH 03/35] Add API for mods to register their custom module PartComponentModule for background resource processing --- Directory.Build.props | 2 +- .../API/Parts/PartComponentModuleOverride.cs | 45 +++++++++++++++ .../PartOwnerComponentOnFixedUpdate.cs | 55 +++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs create mode 100644 SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs diff --git a/Directory.Build.props b/Directory.Build.props index a2be5c89..e2aa9f15 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 1.5.4 + 1.6.0 netstandard2.1 SpaceWarp 11 diff --git a/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs b/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs new file mode 100644 index 00000000..c549e3d7 --- /dev/null +++ b/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +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/Patching/PartOwnerComponentOnFixedUpdate.cs b/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs new file mode 100644 index 00000000..b7b87cf7 --- /dev/null +++ b/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -0,0 +1,55 @@ +using HarmonyLib; +using KSP.Sim.impl; +using SpaceWarp.API.Parts; + +namespace SpaceWarp.Patching; + +[HarmonyPatch] +internal class PartOwnerComponentOnFixedUpdate +{ + [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] + private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, + double deltaUniversalTime, + PartOwnerComponent __instance) + { + var isModulePresent = false; + + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + { + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); + + if (hasPartModuleMethod != null) + { + var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); + + if ((bool)genericMethod.Invoke(__instance, null)) + { + isModulePresent = true; + break; + } + } + } + + // If registered module is present, run the original 0.1.5 method that runs background resource checks + if (isModulePresent) + { + __instance.RecalculatePhysicsStats(false); + if (__instance.PartAttachmentsDirty) + { + __instance.UpdatePartRelationships(); + } + if (__instance.ResourceFlowRequestManager != null && __instance.FlowGraph != null) + { + __instance.ResourceFlowRequestManager.UpdateFlowRequests(universalTime, deltaUniversalTime); + } + __instance.UpdateInsolation(); + __instance.UpdateHasPanelsStellarExposure(); + + return false; + } + + // No registered modules are present, resume with the current method + return true; + } +} \ No newline at end of file From 0705222b9e5541f4b12c7da517a628d9c9bd5ad6 Mon Sep 17 00:00:00 2001 From: Falki-git <72734856+Falki-git@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:43:44 +0100 Subject: [PATCH 04/35] Add API for mods to register their custom module PartComponentModule for background resource processing --- .../API/Parts/PartComponentModuleOverride.cs | 43 +++++++++++++++ .../PartOwnerComponentOnFixedUpdate.cs | 55 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs create mode 100644 src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.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/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs new file mode 100644 index 00000000..c5ed9721 --- /dev/null +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -0,0 +1,55 @@ +using HarmonyLib; +using KSP.Sim.impl; +using SpaceWarp.API.Parts; + +namespace SpaceWarp.Patching; + +[HarmonyPatch] +internal class PartOwnerComponentOnFixedUpdate +{ + [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] + private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, + double deltaUniversalTime, + PartOwnerComponent __instance) + { + var isModulePresent = false; + + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + { + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); + + if (hasPartModuleMethod != null) + { + var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); + + if ((bool)genericMethod.Invoke(__instance, null)) + { + isModulePresent = true; + break; + } + } + } + + // If registered module is present, run the original 0.1.5 method that runs background resource checks + if (isModulePresent) + { + __instance.RecalculatePhysicsStats(false); + if (__instance.PartAttachmentsDirty) + { + __instance.UpdatePartRelationships(); + } + if (__instance.ResourceFlowRequestManager != null && __instance.FlowGraph != null) + { + __instance.ResourceFlowRequestManager.UpdateFlowRequests(universalTime, deltaUniversalTime); + } + __instance.UpdateInsolation(); + __instance.UpdateHasPanelsStellarExposure(); + + return false; + } + + // No registered modules are present, resume with the current method + return true; + } +} \ No newline at end of file From 2f9458e6b75a1d45772e3da7e99040fdc84a248c Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 16:25:50 -0500 Subject: [PATCH 05/35] Move reflection method outside of loop --- .../PartOwnerComponentOnFixedUpdate.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index c5ed9721..caf852d1 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -13,21 +13,20 @@ private static bool PerformBackgroundCalculationsForRegisteredModules(double uni PartOwnerComponent __instance) { var isModulePresent = false; + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - // Go through each registered module and check if it's present in PartOwnerComponent modules - foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + if (hasPartModuleMethod != null) { - var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - - if (hasPartModuleMethod != null) + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) { - var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); + var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); - if ((bool)genericMethod.Invoke(__instance, null)) - { - isModulePresent = true; - break; - } + if ((bool)genericMethod.Invoke(__instance, null)) + { + isModulePresent = true; + break; + } } } From ca4b2cf366bd6723497e8fbb4119f8156934df58 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 16:28:34 -0500 Subject: [PATCH 06/35] Cache part component owners we already checked. --- .../PartOwnerComponentOnFixedUpdate.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index caf852d1..24a05a4c 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -7,27 +7,32 @@ namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate { + private static Dictionary AlreadyCachedOwners = new(); [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, double deltaUniversalTime, PartOwnerComponent __instance) { - var isModulePresent = false; - var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - - if (hasPartModuleMethod != null) + if (!AlreadyCachedOwners.TryGetValue(__instance, out var isModulePresent)) { - // Go through each registered module and check if it's present in PartOwnerComponent modules - foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + isModulePresent = false; + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); + + if (hasPartModuleMethod != null) { + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + { var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); - if ((bool)genericMethod.Invoke(__instance, null)) { isModulePresent = true; break; } + } } + + AlreadyCachedOwners.Add(__instance, isModulePresent); } // If registered module is present, run the original 0.1.5 method that runs background resource checks From b6edd30e92b8bc2fd32f2c39133e31d879c36097 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 16:35:35 -0500 Subject: [PATCH 07/35] Use conditionalweaktable --- .../Patching/PartOwnerComponentOnFixedUpdate.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index 24a05a4c..ce937cff 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -1,4 +1,5 @@ -using HarmonyLib; +using System.Runtime.CompilerServices; +using HarmonyLib; using KSP.Sim.impl; using SpaceWarp.API.Parts; @@ -7,7 +8,15 @@ namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate { - private static Dictionary AlreadyCachedOwners = new(); + private class ReferenceBoolean + { + internal static ReferenceBoolean TRUE = new(); + internal static ReferenceBoolean FALSE = new(); + public static implicit operator ReferenceBoolean(bool b) => b ? TRUE : FALSE; + public static implicit operator bool(ReferenceBoolean b) => b == TRUE; + } + + private static ConditionalWeakTable AlreadyCachedOwners = new(); [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, double deltaUniversalTime, From c9412610d1d6c7a13d74095780a52df05c62ccb2 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 16:40:50 -0500 Subject: [PATCH 08/35] undo caching --- .../PartOwnerComponentOnFixedUpdate.cs | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index ce937cff..6878e225 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -8,42 +8,27 @@ namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate { - private class ReferenceBoolean - { - internal static ReferenceBoolean TRUE = new(); - internal static ReferenceBoolean FALSE = new(); - public static implicit operator ReferenceBoolean(bool b) => b ? TRUE : FALSE; - public static implicit operator bool(ReferenceBoolean b) => b == TRUE; - } - - private static ConditionalWeakTable AlreadyCachedOwners = new(); [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, double deltaUniversalTime, PartOwnerComponent __instance) { - if (!AlreadyCachedOwners.TryGetValue(__instance, out var isModulePresent)) - { - isModulePresent = false; - var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); + var isModulePresent = false; + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - if (hasPartModuleMethod != null) + if (hasPartModuleMethod != null) + { + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) { - // Go through each registered module and check if it's present in PartOwnerComponent modules - foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); + if ((bool)genericMethod.Invoke(__instance, null)) { - var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); - if ((bool)genericMethod.Invoke(__instance, null)) - { - isModulePresent = true; - break; - } + isModulePresent = true; + break; } } - - AlreadyCachedOwners.Add(__instance, isModulePresent); } - // If registered module is present, run the original 0.1.5 method that runs background resource checks if (isModulePresent) { From 3b7ea7d27b40c768178bf139566f238e58f88f19 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 17:00:46 -0500 Subject: [PATCH 09/35] Possible conditional patching --- SpaceWarp.sln | 10 +++++++ src/SpaceWarp.Core/Modules/ModuleManager.cs | 1 - src/SpaceWarp.Game/Modules/Game.cs | 4 ++- .../API}/PartComponentModuleOverride.cs | 13 +++++++-- .../Modules/ResourceFix.cs | 27 +++++++++++++++++++ .../PartOwnerComponentOnFixedUpdate.cs | 2 ++ .../SpaceWarp.ResourceFix.csproj | 16 +++++++++++ src/SpaceWarp.UI/Modules/UI.cs | 2 ++ 8 files changed, 71 insertions(+), 4 deletions(-) rename src/{SpaceWarp.Core/API/Parts => SpaceWarp.ResourceFix/API}/PartComponentModuleOverride.cs (81%) create mode 100644 src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs rename src/{SpaceWarp.Core/Patching => SpaceWarp.ResourceFix/Patches}/PartOwnerComponentOnFixedUpdate.cs (97%) create mode 100644 src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj diff --git a/SpaceWarp.sln b/SpaceWarp.sln index c19f2bbb..237d54e6 100644 --- a/SpaceWarp.sln +++ b/SpaceWarp.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpPatcher", "src/Spa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpTest", "src/SpaceWarpTest/SpaceWarpTest.csproj", "{8DB42693-9177-40B9-AC6A-B6D7A4823FAD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.ResourceFix", "src\SpaceWarp.ResourceFix\SpaceWarp.ResourceFix.csproj", "{0C3A5074-3F79-4B81-8390-F98B3D876F0D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -98,6 +100,14 @@ Global {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 + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Release|Any CPU.Build.0 = Release|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU + {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU EndGlobalSection EndGlobal diff --git a/src/SpaceWarp.Core/Modules/ModuleManager.cs b/src/SpaceWarp.Core/Modules/ModuleManager.cs index 29876ccd..c81c1a99 100644 --- a/src/SpaceWarp.Core/Modules/ModuleManager.cs +++ b/src/SpaceWarp.Core/Modules/ModuleManager.cs @@ -43,7 +43,6 @@ internal static void LoadAllModules() AllSpaceWarpModules.Add(mod); } - Harmony.CreateAndPatchAll(assembly); } catch (Exception e) { diff --git a/src/SpaceWarp.Game/Modules/Game.cs b/src/SpaceWarp.Game/Modules/Game.cs index 461156ff..c78e3a20 100644 --- a/src/SpaceWarp.Game/Modules/Game.cs +++ b/src/SpaceWarp.Game/Modules/Game.cs @@ -1,4 +1,5 @@ -using JetBrains.Annotations; +using HarmonyLib; +using JetBrains.Annotations; using KSP.Game; using KSP.Messages; using SpaceWarp.API.Game.Messages; @@ -11,6 +12,7 @@ public class Game : SpaceWarpModule public override string Name => "SpaceWarp.Game"; public override void LoadModule() + { } diff --git a/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs similarity index 81% rename from src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs rename to src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs index 5cfb02d6..f73353a2 100644 --- a/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs +++ b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs @@ -1,8 +1,9 @@ -using JetBrains.Annotations; +using HarmonyLib; +using JetBrains.Annotations; using KSP.Sim.impl; using SpaceWarp.API.Logging; -namespace SpaceWarp.API.Parts; +namespace SpaceWarp.ResourceFix.API; [PublicAPI] public static class PartComponentModuleOverride @@ -27,6 +28,10 @@ public static void RegisterModuleForBackgroundResourceProcessing() where T : RegisteredPartComponentOverrides.Add(typeof(T)); _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); + if (RegisteredPartComponentOverrides.Count > 0) + { + Harmony.CreateAndPatchAll(typeof(Modules.ResourceFix).Assembly,"ResourceFix"); + } } /// @@ -39,5 +44,9 @@ public static void UnRegisterModuleForBackgroundResourceProcessing() where T RegisteredPartComponentOverrides.Remove(typeof(T)); _LOGGER.LogInfo($"Unregistered '{typeof(T).Name}' from background resources processing."); + if (RegisteredPartComponentOverrides.Count == 0) + { + Harmony.UnpatchID("ResourceFix"); + } } } \ No newline at end of file diff --git a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs new file mode 100644 index 00000000..4b7067ae --- /dev/null +++ b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs @@ -0,0 +1,27 @@ +using SpaceWarp.Modules; + +namespace SpaceWarp.ResourceFix.Modules; + +public class ResourceFix : SpaceWarpModule +{ + public override string Name { get; } + public override void LoadModule() + { + throw new NotImplementedException(); + } + + public override void PreInitializeModule() + { + throw new NotImplementedException(); + } + + public override void InitializeModule() + { + throw new NotImplementedException(); + } + + public override void PostInitializeModule() + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs similarity index 97% rename from src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs rename to src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs index 6878e225..eceb25f6 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs @@ -2,6 +2,7 @@ using HarmonyLib; using KSP.Sim.impl; using SpaceWarp.API.Parts; +using SpaceWarp.ResourceFix.API; namespace SpaceWarp.Patching; @@ -13,6 +14,7 @@ private static bool PerformBackgroundCalculationsForRegisteredModules(double uni double deltaUniversalTime, PartOwnerComponent __instance) { + var isModulePresent = false; var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); diff --git a/src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj b/src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj new file mode 100644 index 00000000..3170054d --- /dev/null +++ b/src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj @@ -0,0 +1,16 @@ + + + + netstandard2.1 + enable + + + + + + + + + + + diff --git a/src/SpaceWarp.UI/Modules/UI.cs b/src/SpaceWarp.UI/Modules/UI.cs index 9ec81c5e..15e677b4 100644 --- a/src/SpaceWarp.UI/Modules/UI.cs +++ b/src/SpaceWarp.UI/Modules/UI.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using BepInEx.Bootstrap; +using HarmonyLib; using JetBrains.Annotations; using KSP.Assets; using KSP.Game; @@ -51,6 +52,7 @@ public class UI : SpaceWarpModule public override void LoadModule() { + Harmony.CreateAndPatchAll(GetType().Assembly); AppbarBackend.AppBarInFlightSubscriber.AddListener(Appbar.LoadAllButtons); AppbarBackend.AppBarOABSubscriber.AddListener(Appbar.LoadOABButtons); AppbarBackend.AppBarKSCSubscriber.AddListener(Appbar.LoadKSCButtons); From 57b103149422ac4fa8ec27e1744b9bee092a8e82 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 17:02:45 -0500 Subject: [PATCH 10/35] Fix some dumbassery --- src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs index 4b7067ae..277a6391 100644 --- a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs +++ b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs @@ -4,24 +4,20 @@ namespace SpaceWarp.ResourceFix.Modules; public class ResourceFix : SpaceWarpModule { - public override string Name { get; } + public override string Name => "SpaceWarp.ResourceFix"; public override void LoadModule() { - throw new NotImplementedException(); } public override void PreInitializeModule() { - throw new NotImplementedException(); } public override void InitializeModule() { - throw new NotImplementedException(); } public override void PostInitializeModule() { - throw new NotImplementedException(); } } \ No newline at end of file From 4377c961959930fe90a097b5cb848b7bd047c385 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 17:17:45 -0500 Subject: [PATCH 11/35] Fix possible multi patch --- .../API/PartComponentModuleOverride.cs | 7 +++---- .../Patches/PartOwnerComponentOnFixedUpdate.cs | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs index f73353a2..2b71440d 100644 --- a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs +++ b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs @@ -25,13 +25,12 @@ public static void RegisterModuleForBackgroundResourceProcessing() where T : { throw new ArgumentException($"Module '{moduleName}' is already registered. Skipping.", nameof(T)); } - - RegisteredPartComponentOverrides.Add(typeof(T)); - _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); - if (RegisteredPartComponentOverrides.Count > 0) + if (RegisteredPartComponentOverrides.Count == 0) { Harmony.CreateAndPatchAll(typeof(Modules.ResourceFix).Assembly,"ResourceFix"); } + RegisteredPartComponentOverrides.Add(typeof(T)); + _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); } /// diff --git a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs index eceb25f6..8153d2cb 100644 --- a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs @@ -1,10 +1,8 @@ -using System.Runtime.CompilerServices; -using HarmonyLib; +using HarmonyLib; using KSP.Sim.impl; -using SpaceWarp.API.Parts; using SpaceWarp.ResourceFix.API; -namespace SpaceWarp.Patching; +namespace SpaceWarp.ResourceFix.Patches; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate From d57351b67a7d017a2af116d478c66c77fd782c94 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 17:24:28 -0500 Subject: [PATCH 12/35] Run specifically the patch on the one type aaaaaa --- src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs index 2b71440d..168c2af4 100644 --- a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs +++ b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs @@ -2,6 +2,7 @@ using JetBrains.Annotations; using KSP.Sim.impl; using SpaceWarp.API.Logging; +using SpaceWarp.ResourceFix.Patches; namespace SpaceWarp.ResourceFix.API; @@ -27,7 +28,7 @@ public static void RegisterModuleForBackgroundResourceProcessing() where T : } if (RegisteredPartComponentOverrides.Count == 0) { - Harmony.CreateAndPatchAll(typeof(Modules.ResourceFix).Assembly,"ResourceFix"); + Harmony.CreateAndPatchAll(typeof(PartOwnerComponent),"ResourceFix"); } RegisteredPartComponentOverrides.Add(typeof(T)); _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); From 00df2e93236bae5b1535c81ab7d62bbb27b7e5c1 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 17:33:38 -0500 Subject: [PATCH 13/35] Log for testing - safarte --- .../Patches/PartOwnerComponentOnFixedUpdate.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs index 8153d2cb..3391f326 100644 --- a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs @@ -1,6 +1,7 @@ using HarmonyLib; using KSP.Sim.impl; using SpaceWarp.ResourceFix.API; +using UnityEngine; namespace SpaceWarp.ResourceFix.Patches; @@ -12,7 +13,7 @@ private static bool PerformBackgroundCalculationsForRegisteredModules(double uni double deltaUniversalTime, PartOwnerComponent __instance) { - + Debug.Log("WE RAN THE BACKGROUND CALCULATION FIX!"); var isModulePresent = false; var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); From 858e4d47de2d74f1f7a58e1b18413504b7b278b3 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:27 -0500 Subject: [PATCH 14/35] Revert "Log for testing - safarte" This reverts commit 00df2e93236bae5b1535c81ab7d62bbb27b7e5c1. --- .../Patches/PartOwnerComponentOnFixedUpdate.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs index 3391f326..8153d2cb 100644 --- a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs @@ -1,7 +1,6 @@ using HarmonyLib; using KSP.Sim.impl; using SpaceWarp.ResourceFix.API; -using UnityEngine; namespace SpaceWarp.ResourceFix.Patches; @@ -13,7 +12,7 @@ private static bool PerformBackgroundCalculationsForRegisteredModules(double uni double deltaUniversalTime, PartOwnerComponent __instance) { - Debug.Log("WE RAN THE BACKGROUND CALCULATION FIX!"); + var isModulePresent = false; var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); From f21977eb3e24633f1e2b828a993479c11de6344b Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:28 -0500 Subject: [PATCH 15/35] Revert "Run specifically the patch on the one type aaaaaa" This reverts commit d57351b67a7d017a2af116d478c66c77fd782c94. --- src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs index 168c2af4..2b71440d 100644 --- a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs +++ b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs @@ -2,7 +2,6 @@ using JetBrains.Annotations; using KSP.Sim.impl; using SpaceWarp.API.Logging; -using SpaceWarp.ResourceFix.Patches; namespace SpaceWarp.ResourceFix.API; @@ -28,7 +27,7 @@ public static void RegisterModuleForBackgroundResourceProcessing() where T : } if (RegisteredPartComponentOverrides.Count == 0) { - Harmony.CreateAndPatchAll(typeof(PartOwnerComponent),"ResourceFix"); + Harmony.CreateAndPatchAll(typeof(Modules.ResourceFix).Assembly,"ResourceFix"); } RegisteredPartComponentOverrides.Add(typeof(T)); _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); From 016ba572681d988317981ac9a869fa90e95cbd57 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:28 -0500 Subject: [PATCH 16/35] Revert "Fix possible multi patch" This reverts commit 4377c961959930fe90a097b5cb848b7bd047c385. --- .../API/PartComponentModuleOverride.cs | 7 ++++--- .../Patches/PartOwnerComponentOnFixedUpdate.cs | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs index 2b71440d..f73353a2 100644 --- a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs +++ b/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs @@ -25,12 +25,13 @@ public static void RegisterModuleForBackgroundResourceProcessing() where T : { throw new ArgumentException($"Module '{moduleName}' is already registered. Skipping.", nameof(T)); } - if (RegisteredPartComponentOverrides.Count == 0) + + RegisteredPartComponentOverrides.Add(typeof(T)); + _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); + if (RegisteredPartComponentOverrides.Count > 0) { Harmony.CreateAndPatchAll(typeof(Modules.ResourceFix).Assembly,"ResourceFix"); } - RegisteredPartComponentOverrides.Add(typeof(T)); - _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); } /// diff --git a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs index 8153d2cb..eceb25f6 100644 --- a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs @@ -1,8 +1,10 @@ -using HarmonyLib; +using System.Runtime.CompilerServices; +using HarmonyLib; using KSP.Sim.impl; +using SpaceWarp.API.Parts; using SpaceWarp.ResourceFix.API; -namespace SpaceWarp.ResourceFix.Patches; +namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate From f2871af4335cb2ff7c33913ca36800365bb9c8f3 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:28 -0500 Subject: [PATCH 17/35] Revert "Fix some dumbassery" This reverts commit 57b103149422ac4fa8ec27e1744b9bee092a8e82. --- src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs index 277a6391..4b7067ae 100644 --- a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs +++ b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs @@ -4,20 +4,24 @@ namespace SpaceWarp.ResourceFix.Modules; public class ResourceFix : SpaceWarpModule { - public override string Name => "SpaceWarp.ResourceFix"; + public override string Name { get; } public override void LoadModule() { + throw new NotImplementedException(); } public override void PreInitializeModule() { + throw new NotImplementedException(); } public override void InitializeModule() { + throw new NotImplementedException(); } public override void PostInitializeModule() { + throw new NotImplementedException(); } } \ No newline at end of file From f12825b9b80b25c26fcbf2675a034f314abeb709 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:29 -0500 Subject: [PATCH 18/35] Revert "Possible conditional patching" This reverts commit 3b7ea7d27b40c768178bf139566f238e58f88f19. --- SpaceWarp.sln | 10 ------- .../API/Parts}/PartComponentModuleOverride.cs | 13 ++------- src/SpaceWarp.Core/Modules/ModuleManager.cs | 1 + .../PartOwnerComponentOnFixedUpdate.cs | 2 -- src/SpaceWarp.Game/Modules/Game.cs | 4 +-- .../Modules/ResourceFix.cs | 27 ------------------- .../SpaceWarp.ResourceFix.csproj | 16 ----------- src/SpaceWarp.UI/Modules/UI.cs | 2 -- 8 files changed, 4 insertions(+), 71 deletions(-) rename src/{SpaceWarp.ResourceFix/API => SpaceWarp.Core/API/Parts}/PartComponentModuleOverride.cs (81%) rename src/{SpaceWarp.ResourceFix/Patches => SpaceWarp.Core/Patching}/PartOwnerComponentOnFixedUpdate.cs (97%) delete mode 100644 src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs delete mode 100644 src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj diff --git a/SpaceWarp.sln b/SpaceWarp.sln index 237d54e6..c19f2bbb 100644 --- a/SpaceWarp.sln +++ b/SpaceWarp.sln @@ -18,8 +18,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpPatcher", "src/Spa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarpTest", "src/SpaceWarpTest/SpaceWarpTest.csproj", "{8DB42693-9177-40B9-AC6A-B6D7A4823FAD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWarp.ResourceFix", "src\SpaceWarp.ResourceFix\SpaceWarp.ResourceFix.csproj", "{0C3A5074-3F79-4B81-8390-F98B3D876F0D}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -100,14 +98,6 @@ Global {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 - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Release|Any CPU.Build.0 = Release|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.Deploy|Any CPU.Build.0 = Deploy|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU - {0C3A5074-3F79-4B81-8390-F98B3D876F0D}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU EndGlobalSection EndGlobal diff --git a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs b/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs similarity index 81% rename from src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs rename to src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs index f73353a2..5cfb02d6 100644 --- a/src/SpaceWarp.ResourceFix/API/PartComponentModuleOverride.cs +++ b/src/SpaceWarp.Core/API/Parts/PartComponentModuleOverride.cs @@ -1,9 +1,8 @@ -using HarmonyLib; -using JetBrains.Annotations; +using JetBrains.Annotations; using KSP.Sim.impl; using SpaceWarp.API.Logging; -namespace SpaceWarp.ResourceFix.API; +namespace SpaceWarp.API.Parts; [PublicAPI] public static class PartComponentModuleOverride @@ -28,10 +27,6 @@ public static void RegisterModuleForBackgroundResourceProcessing() where T : RegisteredPartComponentOverrides.Add(typeof(T)); _LOGGER.LogInfo($"Registered '{moduleName}' for background resources processing."); - if (RegisteredPartComponentOverrides.Count > 0) - { - Harmony.CreateAndPatchAll(typeof(Modules.ResourceFix).Assembly,"ResourceFix"); - } } /// @@ -44,9 +39,5 @@ public static void UnRegisterModuleForBackgroundResourceProcessing() where T RegisteredPartComponentOverrides.Remove(typeof(T)); _LOGGER.LogInfo($"Unregistered '{typeof(T).Name}' from background resources processing."); - if (RegisteredPartComponentOverrides.Count == 0) - { - Harmony.UnpatchID("ResourceFix"); - } } } \ No newline at end of file diff --git a/src/SpaceWarp.Core/Modules/ModuleManager.cs b/src/SpaceWarp.Core/Modules/ModuleManager.cs index c81c1a99..29876ccd 100644 --- a/src/SpaceWarp.Core/Modules/ModuleManager.cs +++ b/src/SpaceWarp.Core/Modules/ModuleManager.cs @@ -43,6 +43,7 @@ internal static void LoadAllModules() AllSpaceWarpModules.Add(mod); } + Harmony.CreateAndPatchAll(assembly); } catch (Exception e) { diff --git a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs similarity index 97% rename from src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs rename to src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index eceb25f6..6878e225 100644 --- a/src/SpaceWarp.ResourceFix/Patches/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -2,7 +2,6 @@ using HarmonyLib; using KSP.Sim.impl; using SpaceWarp.API.Parts; -using SpaceWarp.ResourceFix.API; namespace SpaceWarp.Patching; @@ -14,7 +13,6 @@ private static bool PerformBackgroundCalculationsForRegisteredModules(double uni double deltaUniversalTime, PartOwnerComponent __instance) { - var isModulePresent = false; var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); diff --git a/src/SpaceWarp.Game/Modules/Game.cs b/src/SpaceWarp.Game/Modules/Game.cs index c78e3a20..461156ff 100644 --- a/src/SpaceWarp.Game/Modules/Game.cs +++ b/src/SpaceWarp.Game/Modules/Game.cs @@ -1,5 +1,4 @@ -using HarmonyLib; -using JetBrains.Annotations; +using JetBrains.Annotations; using KSP.Game; using KSP.Messages; using SpaceWarp.API.Game.Messages; @@ -12,7 +11,6 @@ public class Game : SpaceWarpModule public override string Name => "SpaceWarp.Game"; public override void LoadModule() - { } diff --git a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs b/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs deleted file mode 100644 index 4b7067ae..00000000 --- a/src/SpaceWarp.ResourceFix/Modules/ResourceFix.cs +++ /dev/null @@ -1,27 +0,0 @@ -using SpaceWarp.Modules; - -namespace SpaceWarp.ResourceFix.Modules; - -public class ResourceFix : SpaceWarpModule -{ - public override string Name { get; } - public override void LoadModule() - { - throw new NotImplementedException(); - } - - public override void PreInitializeModule() - { - throw new NotImplementedException(); - } - - public override void InitializeModule() - { - throw new NotImplementedException(); - } - - public override void PostInitializeModule() - { - throw new NotImplementedException(); - } -} \ No newline at end of file diff --git a/src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj b/src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj deleted file mode 100644 index 3170054d..00000000 --- a/src/SpaceWarp.ResourceFix/SpaceWarp.ResourceFix.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - netstandard2.1 - enable - - - - - - - - - - - diff --git a/src/SpaceWarp.UI/Modules/UI.cs b/src/SpaceWarp.UI/Modules/UI.cs index 15e677b4..9ec81c5e 100644 --- a/src/SpaceWarp.UI/Modules/UI.cs +++ b/src/SpaceWarp.UI/Modules/UI.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using BepInEx.Bootstrap; -using HarmonyLib; using JetBrains.Annotations; using KSP.Assets; using KSP.Game; @@ -52,7 +51,6 @@ public class UI : SpaceWarpModule public override void LoadModule() { - Harmony.CreateAndPatchAll(GetType().Assembly); AppbarBackend.AppBarInFlightSubscriber.AddListener(Appbar.LoadAllButtons); AppbarBackend.AppBarOABSubscriber.AddListener(Appbar.LoadOABButtons); AppbarBackend.AppBarKSCSubscriber.AddListener(Appbar.LoadKSCButtons); From 35edb5d065fe55d7bbf5c5f849d8fc834748ee77 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:29 -0500 Subject: [PATCH 19/35] Revert "undo caching" This reverts commit c9412610d1d6c7a13d74095780a52df05c62ccb2. --- .../PartOwnerComponentOnFixedUpdate.cs | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index 6878e225..ce937cff 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -8,27 +8,42 @@ namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate { + private class ReferenceBoolean + { + internal static ReferenceBoolean TRUE = new(); + internal static ReferenceBoolean FALSE = new(); + public static implicit operator ReferenceBoolean(bool b) => b ? TRUE : FALSE; + public static implicit operator bool(ReferenceBoolean b) => b == TRUE; + } + + private static ConditionalWeakTable AlreadyCachedOwners = new(); [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, double deltaUniversalTime, PartOwnerComponent __instance) { - var isModulePresent = false; - var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - - if (hasPartModuleMethod != null) + if (!AlreadyCachedOwners.TryGetValue(__instance, out var isModulePresent)) { - // Go through each registered module and check if it's present in PartOwnerComponent modules - foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) + isModulePresent = false; + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); + + if (hasPartModuleMethod != null) { - var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); - if ((bool)genericMethod.Invoke(__instance, null)) + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) { - isModulePresent = true; - break; + var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); + if ((bool)genericMethod.Invoke(__instance, null)) + { + isModulePresent = true; + break; + } } } + + AlreadyCachedOwners.Add(__instance, isModulePresent); } + // If registered module is present, run the original 0.1.5 method that runs background resource checks if (isModulePresent) { From f42756e712a90fd170c1b7986750052dce99524f Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:30 -0500 Subject: [PATCH 20/35] Revert "Use conditionalweaktable" This reverts commit b6edd30e92b8bc2fd32f2c39133e31d879c36097. --- .../Patching/PartOwnerComponentOnFixedUpdate.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index ce937cff..24a05a4c 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -1,5 +1,4 @@ -using System.Runtime.CompilerServices; -using HarmonyLib; +using HarmonyLib; using KSP.Sim.impl; using SpaceWarp.API.Parts; @@ -8,15 +7,7 @@ namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate { - private class ReferenceBoolean - { - internal static ReferenceBoolean TRUE = new(); - internal static ReferenceBoolean FALSE = new(); - public static implicit operator ReferenceBoolean(bool b) => b ? TRUE : FALSE; - public static implicit operator bool(ReferenceBoolean b) => b == TRUE; - } - - private static ConditionalWeakTable AlreadyCachedOwners = new(); + private static Dictionary AlreadyCachedOwners = new(); [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, double deltaUniversalTime, From e0964b3bbd9c2c0d503c0291ded9a168659701eb Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 20:07:31 -0500 Subject: [PATCH 21/35] Revert "Cache part component owners we already checked." This reverts commit ca4b2cf366bd6723497e8fbb4119f8156934df58. --- .../PartOwnerComponentOnFixedUpdate.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs index 24a05a4c..caf852d1 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs @@ -7,32 +7,27 @@ namespace SpaceWarp.Patching; [HarmonyPatch] internal class PartOwnerComponentOnFixedUpdate { - private static Dictionary AlreadyCachedOwners = new(); [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, double deltaUniversalTime, PartOwnerComponent __instance) { - if (!AlreadyCachedOwners.TryGetValue(__instance, out var isModulePresent)) - { - isModulePresent = false; - var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); + var isModulePresent = false; + var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - if (hasPartModuleMethod != null) + if (hasPartModuleMethod != null) + { + // Go through each registered module and check if it's present in PartOwnerComponent modules + foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) { - // Go through each registered module and check if it's present in PartOwnerComponent modules - foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) - { var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); + if ((bool)genericMethod.Invoke(__instance, null)) { isModulePresent = true; break; } - } } - - AlreadyCachedOwners.Add(__instance, isModulePresent); } // If registered module is present, run the original 0.1.5 method that runs background resource checks From e1fab4a81e364683a0b100df9c64340baebfa0c8 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 21:55:07 -0500 Subject: [PATCH 22/35] Actual acts of the IL god --- .../Patching/PartOwnerComponentConstructor.cs | 25 ++++ src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs | 117 ++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs create mode 100644 src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs new file mode 100644 index 00000000..d8c1b7d4 --- /dev/null +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs @@ -0,0 +1,25 @@ +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(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/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs b/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs new file mode 100644 index 00000000..dd63ffe0 --- /dev/null +++ b/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs @@ -0,0 +1,117 @@ +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); + assemblyDefinition.Write("TestOutput.dll"); + } +} \ No newline at end of file From 8b2d0778e38638b59007bbf471d7ffb9280e52a6 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 22:05:01 -0500 Subject: [PATCH 23/35] Remove bad patch --- .../PartOwnerComponentOnFixedUpdate.cs | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs deleted file mode 100644 index caf852d1..00000000 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentOnFixedUpdate.cs +++ /dev/null @@ -1,54 +0,0 @@ -using HarmonyLib; -using KSP.Sim.impl; -using SpaceWarp.API.Parts; - -namespace SpaceWarp.Patching; - -[HarmonyPatch] -internal class PartOwnerComponentOnFixedUpdate -{ - [HarmonyPatch(typeof(PartOwnerComponent), "OnFixedUpdate"), HarmonyPrefix] - private static bool PerformBackgroundCalculationsForRegisteredModules(double universalTime, - double deltaUniversalTime, - PartOwnerComponent __instance) - { - var isModulePresent = false; - var hasPartModuleMethod = __instance.GetType().GetMethod("HasPartModule"); - - if (hasPartModuleMethod != null) - { - // Go through each registered module and check if it's present in PartOwnerComponent modules - foreach (var moduleType in PartComponentModuleOverride.RegisteredPartComponentOverrides) - { - var genericMethod = hasPartModuleMethod.MakeGenericMethod(moduleType); - - if ((bool)genericMethod.Invoke(__instance, null)) - { - isModulePresent = true; - break; - } - } - } - - // If registered module is present, run the original 0.1.5 method that runs background resource checks - if (isModulePresent) - { - __instance.RecalculatePhysicsStats(false); - if (__instance.PartAttachmentsDirty) - { - __instance.UpdatePartRelationships(); - } - if (__instance.ResourceFlowRequestManager != null && __instance.FlowGraph != null) - { - __instance.ResourceFlowRequestManager.UpdateFlowRequests(universalTime, deltaUniversalTime); - } - __instance.UpdateInsolation(); - __instance.UpdateHasPanelsStellarExposure(); - - return false; - } - - // No registered modules are present, resume with the current method - return true; - } -} \ No newline at end of file From 10c1b6c8e2393e9a92a5481468e857596290c494 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 22:19:46 -0500 Subject: [PATCH 24/35] Just making sure the field is set to false by default --- .../Patching/PartOwnerComponentConstructor.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs b/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs index d8c1b7d4..f9c7da1f 100644 --- a/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs +++ b/src/SpaceWarp.Core/Patching/PartOwnerComponentConstructor.cs @@ -13,6 +13,13 @@ 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) { From c4e754e8c556927680264ef151afb2e9b2483f43 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 21 Dec 2023 22:38:00 -0500 Subject: [PATCH 25/35] Don't output test dll anymore --- src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs b/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs index dd63ffe0..91318da2 100644 --- a/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs +++ b/src/SpaceWarpPatcher/AssemblyCSharpPatcher.cs @@ -112,6 +112,5 @@ public static void Patch(ref AssemblyDefinition assemblyDefinition) insts.Clear(); insts.AddRange(newInstructions); - assemblyDefinition.Write("TestOutput.dll"); } } \ No newline at end of file From 9c52e7a2e9f621bd1d784a7ab59151add5bdc58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 10:13:29 +0100 Subject: [PATCH 26/35] Updated the outdated README.md --- .github/README.md | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) 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 From cf5e9551efedcf222b54c0378d6baf363498ca59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 10:26:26 +0100 Subject: [PATCH 27/35] Attempt #2 to fix GH Action building of release zip --- src/SpaceWarp/Directory.Build.targets | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SpaceWarp/Directory.Build.targets b/src/SpaceWarp/Directory.Build.targets index 61d752c9..ac0160e5 100644 --- a/src/SpaceWarp/Directory.Build.targets +++ b/src/SpaceWarp/Directory.Build.targets @@ -78,8 +78,12 @@ - + + + From bdd9bab2d7f4c65bcd38c86c3c0c2bbfefaf498f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 11:09:24 +0100 Subject: [PATCH 28/35] Realized it doesn't make much sense to build in Debug configuration if we're not doing anything with the results --- .github/workflows/build_spacewarp.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index 421f9c16..dfc3e3c8 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -7,16 +7,6 @@ on: branches: [ "main", "dev" ] jobs: - build-debug: - runs-on: ubuntu-latest - - steps: - - name: Check Out Repository - uses: actions/checkout@v3 - - - name: Build the solution - run: dotnet build "SpaceWarp.sln" -c Debug - build-release: runs-on: ubuntu-latest From 44e1cde3d277e731c49623d1dbdd45ce960bd6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 11:10:04 +0100 Subject: [PATCH 29/35] Add actions to upload NuGet package as artifact --- .github/workflows/build_spacewarp.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index dfc3e3c8..83d31046 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -7,24 +7,36 @@ on: branches: [ "main", "dev" ] jobs: - build-release: + build: runs-on: ubuntu-latest steps: - - name: Check Out Repository + - name: Check out repository uses: actions/checkout@v3 - + - name: Build the solution run: dotnet build "SpaceWarp.sln" -c Release - - - name: Find Zip + + - name: Find zip id: find-zip run: | echo "zip=$(ls -1 dist/SpaceWarp-*.zip | head -n 1)" >> $GITHUB_ENV echo "artifact_name=SpaceWarpRelease" >> $GITHUB_ENV - - name: Upload Artifact + - 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 }} From 4bbb92c4486258c7a7858f68cac301e7af4eab4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 11:41:16 +0100 Subject: [PATCH 30/35] Automatic publishing of NuGet package on release --- .github/workflows/release_nuget.yml | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/release_nuget.yml diff --git a/.github/workflows/release_nuget.yml b/.github/workflows/release_nuget.yml new file mode 100644 index 00000000..b5df2ce6 --- /dev/null +++ b/.github/workflows/release_nuget.yml @@ -0,0 +1,46 @@ +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: 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 From e53c994a6b5ecbe8fd0c686653ca50fba54dbea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 12:35:09 +0100 Subject: [PATCH 31/35] Remove duplicate reference --- src/SpaceWarp.Game/SpaceWarp.Game.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SpaceWarp.Game/SpaceWarp.Game.csproj b/src/SpaceWarp.Game/SpaceWarp.Game.csproj index 78c4f151..d90289f6 100644 --- a/src/SpaceWarp.Game/SpaceWarp.Game.csproj +++ b/src/SpaceWarp.Game/SpaceWarp.Game.csproj @@ -2,7 +2,6 @@ - From 9017362ed89921e2711b59feec0d52845e8cac8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 12:35:30 +0100 Subject: [PATCH 32/35] NuGet packing with Mono and nuget.exe --- .github/workflows/build_spacewarp.yml | 14 ++++++++++++++ .github/workflows/release_nuget.yml | 14 ++++++++++++++ src/SpaceWarp/Directory.Build.targets | 6 +++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index 83d31046..c3d04929 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -14,6 +14,20 @@ jobs: - name: Check out repository uses: actions/checkout@v3 + - name: Install Mono + id: install-mono + run: | + apt-get install ca-certificates gnupg + gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list + apt-get update + apt install mono-devel -y + + - name: Download NuGet + id: download-nuget + run: | + 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 diff --git a/.github/workflows/release_nuget.yml b/.github/workflows/release_nuget.yml index b5df2ce6..339d57c7 100644 --- a/.github/workflows/release_nuget.yml +++ b/.github/workflows/release_nuget.yml @@ -15,6 +15,20 @@ jobs: - name: Install jq uses: dcarbone/install-jq-action@v2.1.0 + - name: Install Mono + id: install-mono + run: | + apt-get install ca-certificates gnupg + gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list + apt-get update + apt install mono-devel -y + + - name: Download NuGet + id: download-nuget + run: | + 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 diff --git a/src/SpaceWarp/Directory.Build.targets b/src/SpaceWarp/Directory.Build.targets index ac0160e5..6c8a1ef0 100644 --- a/src/SpaceWarp/Directory.Build.targets +++ b/src/SpaceWarp/Directory.Build.targets @@ -1,5 +1,9 @@ + + nuget + mono /usr/local/bin/nuget.exe + @@ -109,7 +113,7 @@ + Command="$(NuGetExecutable) pack "$(SolutionDir)/Package.nuspec" -OutputDirectory "$(SolutionDir)/nuget" -Properties "NoWarn=NU5125;id=$(ProjectName);version=$(Version);authors=$(Authors);description=$(Description);repositoryType=$(RepositoryType);repositoryUrl=$(RepositoryUrl)"" /> Date: Fri, 22 Dec 2023 12:38:58 +0100 Subject: [PATCH 33/35] sudo you dummy --- .github/workflows/release_nuget.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release_nuget.yml b/.github/workflows/release_nuget.yml index 339d57c7..700224a8 100644 --- a/.github/workflows/release_nuget.yml +++ b/.github/workflows/release_nuget.yml @@ -18,16 +18,16 @@ jobs: - name: Install Mono id: install-mono run: | - apt-get install ca-certificates gnupg - gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list - apt-get update - apt install mono-devel -y + sudo apt-get install ca-certificates gnupg + sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list + sudo apt-get update + sudo apt-get install mono-devel -y - name: Download NuGet id: download-nuget run: | - curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + 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 From 452cf050df86e6b29e88e77abd499e7013a6922f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 12:40:30 +0100 Subject: [PATCH 34/35] sudo in *both* actions, stupid --- .github/workflows/build_spacewarp.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index c3d04929..feb73114 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -17,16 +17,16 @@ jobs: - name: Install Mono id: install-mono run: | - apt-get install ca-certificates gnupg - gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list - apt-get update - apt install mono-devel -y + sudo apt-get install ca-certificates gnupg + sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list + sudo apt-get update + sudo apt-get install mono-devel -y - name: Download NuGet id: download-nuget run: | - curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + 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 From 01bbc1a713a7be1c56339704fd1fbb7a16577135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bure=C5=A1?= Date: Fri, 22 Dec 2023 12:45:11 +0100 Subject: [PATCH 35/35] Remove mono installation, it's preinstalled in the runner image --- .github/workflows/build_spacewarp.yml | 9 --------- .github/workflows/release_nuget.yml | 9 --------- 2 files changed, 18 deletions(-) diff --git a/.github/workflows/build_spacewarp.yml b/.github/workflows/build_spacewarp.yml index feb73114..78309260 100644 --- a/.github/workflows/build_spacewarp.yml +++ b/.github/workflows/build_spacewarp.yml @@ -14,15 +14,6 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - - name: Install Mono - id: install-mono - run: | - sudo apt-get install ca-certificates gnupg - sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list - sudo apt-get update - sudo apt-get install mono-devel -y - - name: Download NuGet id: download-nuget run: | diff --git a/.github/workflows/release_nuget.yml b/.github/workflows/release_nuget.yml index 700224a8..11a70575 100644 --- a/.github/workflows/release_nuget.yml +++ b/.github/workflows/release_nuget.yml @@ -15,15 +15,6 @@ jobs: - name: Install jq uses: dcarbone/install-jq-action@v2.1.0 - - name: Install Mono - id: install-mono - run: | - sudo apt-get install ca-certificates gnupg - sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list - sudo apt-get update - sudo apt-get install mono-devel -y - - name: Download NuGet id: download-nuget run: |