From 2970f79339a87db6ac1d68361ad15460656127cd Mon Sep 17 00:00:00 2001 From: Robin Sonneveld <6283731+rtsonneveld@users.noreply.github.com> Date: Sat, 27 Jan 2024 21:05:14 +0100 Subject: [PATCH] Added a load screen remover extra for rayman 2 Reverted the reload engine mode change from last commit because it didn't work --- .../Games/Rayman2/Rayman2GameManager.cs | 1 + .../Rayman2/Rayman2LoadingScreenRemover.cs | 28 +++++++++++++++++++ .../GameManager/OpenspaceGameManager.cs | 5 ++-- OpenSpaceToolbox/OpenSpaceToolbox.csproj | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2LoadingScreenRemover.cs diff --git a/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2GameManager.cs b/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2GameManager.cs index f23f39a..aed2153 100644 --- a/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2GameManager.cs +++ b/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2GameManager.cs @@ -41,6 +41,7 @@ public Rayman2GameManager() new Rayman2CheckpointExtra(this, Rayman2CheckpointExtra.CheckpointMode.CurrentPosition), new Rayman2CheckpointExtra(this, Rayman2CheckpointExtra.CheckpointMode.SavedPosition), new Rayman2RespawnAnimRemover(this), + new Rayman2LoadingScreenRemover(this), }; //Levels diff --git a/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2LoadingScreenRemover.cs b/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2LoadingScreenRemover.cs new file mode 100644 index 0000000..6241c77 --- /dev/null +++ b/OpenSpaceToolbox/GameManager/Games/Rayman2/Rayman2LoadingScreenRemover.cs @@ -0,0 +1,28 @@ +using System; +using System.Threading; + +namespace OpenSpaceToolbox +{ + public class Rayman2LoadingScreenRemover : OpenspaceExtraAction { + + public Rayman2LoadingScreenRemover(Rayman2GameManager gameManager) : base(gameManager) + { + Name = ShortName = $"⚠ Remove loading screens"; + + Tooltip = "⚠ Warning: these actions require a game restart to undo!"; + } + + public override void Action() + { + int processHandle = GameManager.GetProcessHandle(); + if (processHandle < 0) + return; + + byte[] nopInstructions = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90}; + + GameManager.WriteBytes(nopInstructions, 0x45F85E); + GameManager.WriteBytes(nopInstructions, 0x4508F0); + GameManager.WriteBytes(nopInstructions, 0x4043D6); + } + } +} \ No newline at end of file diff --git a/OpenSpaceToolbox/GameManager/OpenspaceGameManager.cs b/OpenSpaceToolbox/GameManager/OpenspaceGameManager.cs index bf77185..989d236 100644 --- a/OpenSpaceToolbox/GameManager/OpenspaceGameManager.cs +++ b/OpenSpaceToolbox/GameManager/OpenspaceGameManager.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Linq; using System.Text; +using System.Threading; using System.Windows; namespace OpenSpaceToolbox @@ -247,8 +248,8 @@ public override void ReloadLevel() currentBufferLevelName.Length, ref bytesReadOrWritten); if (currentBufferLevelName[0] == 0) return; - - WriteEngineMode(EnumEngineMode.EnterLevel); + + WriteEngineMode(EnumEngineMode.ChangeLevel); } public override void LoadOffsetLevel(int offset) diff --git a/OpenSpaceToolbox/OpenSpaceToolbox.csproj b/OpenSpaceToolbox/OpenSpaceToolbox.csproj index 9c126cd..a8da4ed 100644 --- a/OpenSpaceToolbox/OpenSpaceToolbox.csproj +++ b/OpenSpaceToolbox/OpenSpaceToolbox.csproj @@ -99,6 +99,7 @@ +