Skip to content

Commit

Permalink
Merge pull request #17 from chilla55/main
Browse files Browse the repository at this point in the history
Docs ,Doorstop and Build script
  • Loading branch information
cheese3660 authored Feb 26, 2023
2 parents 0304e51 + d1ad3a6 commit 85062ca
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,9 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Build script folder
build/

# Idea folder
.idea
1 change: 1 addition & 0 deletions Doorstop/.doorstop_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.0
45 changes: 45 additions & 0 deletions Doorstop/doorstop_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# General options for Unity Doorstop
[General]

# Enable Doorstop?
enabled=true

# Path to the assembly to load and execute
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
target_assembly=SpaceWarp/Core/SpaceWarp.dll

# If true, Unity's output log is redirected to <current folder>\output_log.txt
redirect_output_log=false

# If enabled, DOORSTOP_DISABLE env var value is ignored
# USE THIS ONLY WHEN ASKED TO OR YOU KNOW WHAT THIS MEANS
ignore_disable_switch=false


# Options specific to running under Unity Mono runtime
[UnityMono]

# Overrides default Mono DLL search path
# Sometimes it is needed to instruct Mono to seek its assemblies from a different path
# (e.g. mscorlib is stripped in original game)
# This option causes Mono to seek mscorlib and core libraries from a different folder before Managed
# Original Managed folder is added as a secondary folder in the search path
dll_search_path_override=

# If true, Mono debugger server will be enabled
debug_enabled=false

# When debug_enabled is true, specifies the address to use for the debugger server
debug_address=127.0.0.1:10000

# If true and debug_enabled is true, Mono debugger server will suspend the game execution until a debugger is attached
debug_suspend=false

# Options sepcific to running under Il2Cpp runtime
[Il2Cpp]

# Path to coreclr.dll that contains the CoreCLR runtime
coreclr_path=

# Path to the directory containing the managed core libraries for CoreCLR (mscorlib, System, etc.)
corlib_dir=
Binary file added Doorstop/winhttp.dll
Binary file not shown.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Note: Use at your own risk, this is an early version which is expected to have a
# Compiling
In order to compile this project you need the code from kerbal space program 2, so before you can build anything, copy everything in ``Kerbal Space Program 2\KSP2_x64_Data\Managed`` into ``external_dlls/``

Then compile the `spacewarp` project, then run the `ksp2_mod_loader_patcher` project.

Then run one of the build scripts and copy the contents from build to KSP2 root directory

Then run KSP2, and wait until the title screen, there should then be a mods folder under the `KSP2_X64_data` folder

Expand Down
19 changes: 12 additions & 7 deletions SpaceWarp/StartupManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@
namespace Doorstop {

public class Entrypoint {

public static void Start() {
/// <summary>
/// EntryPoint for Spacewarp, called from Doorstop
/// </summary>
public static void Start()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
}

static bool patched = false;
static void OnSceneLoaded(Scene unused1, LoadSceneMode unused2) {


/// <summary>
/// Add OnGameStarted as postfix to StartGame
/// </summary>
static void OnSceneLoaded(Scene unused1, LoadSceneMode unused2)
{
if (!patched) {

Harmony harmony = new Harmony("com.github.celisium.spacewarp-doorstop");
Expand All @@ -28,9 +35,7 @@ static void OnSceneLoaded(Scene unused1, LoadSceneMode unused2) {

patched = true;
}

}

}
}

Expand Down
7 changes: 7 additions & 0 deletions build_debug.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Remove-Item ./build -Recurse -Force
mkdir build/SpaceWarp/core
Copy-Item ./Doorstop/* ./build
dotnet build SpaceWarp/SpaceWarp.csproj -c Debug
Copy-Item ./SpaceWarp/bin/Debug/SpaceWarp.dll ./build/SpaceWarp/core
Copy-Item ./SpaceWarp/bin/Debug/SpaceWarp.pdb ./build/SpaceWarp/core
Copy-Item ./SpaceWarp/bin/Debug/0Harmony.dll ./build/SpaceWarp/core
6 changes: 6 additions & 0 deletions build_release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Remove-Item ./build -Recurse -Force
mkdir build/SpaceWarp/core
Copy-Item ./Doorstop/* ./build
dotnet build SpaceWarp/SpaceWarp.csproj -c Release
Copy-Item ./SpaceWarp/bin/Release/SpaceWarp.dll ./build/SpaceWarp/core
Copy-Item ./SpaceWarp/bin/Release/0Harmony.dll ./build/SpaceWarp/core

0 comments on commit 85062ca

Please sign in to comment.