From 46a42d977e587f3ee815d2013563af3ea9e092bc Mon Sep 17 00:00:00 2001 From: Redline <> Date: Sat, 4 Oct 2025 18:26:46 +0200 Subject: [PATCH] Max velocity override --- mc2hook/mc2hook/handlers/MaxVelocityHandler.cpp | 7 +++++++ mc2hook/mc2hook/handlers/MaxVelocityHandler.h | 8 ++++++++ mc2hook/mc2hook/handlers/handlers.h | 2 ++ mc2hook/mc2hook/mc2hook.vcxproj | 2 ++ 4 files changed, 19 insertions(+) create mode 100644 mc2hook/mc2hook/handlers/MaxVelocityHandler.cpp create mode 100644 mc2hook/mc2hook/handlers/MaxVelocityHandler.h diff --git a/mc2hook/mc2hook/handlers/MaxVelocityHandler.cpp b/mc2hook/mc2hook/handlers/MaxVelocityHandler.cpp new file mode 100644 index 0000000..9854038 --- /dev/null +++ b/mc2hook/mc2hook/handlers/MaxVelocityHandler.cpp @@ -0,0 +1,7 @@ +#include "MaxVelocityHandler.h" + +void MaxVelocityHandler::Install() +{ + float maxVelocity = HookConfig::GetFloat("Physics", "MaxVelocity", 111.75 * 2.237); // In mph format + mem::write(0x569195 + 3, static_cast(maxVelocity / 2.237)); // mph to ms +} diff --git a/mc2hook/mc2hook/handlers/MaxVelocityHandler.h b/mc2hook/mc2hook/handlers/MaxVelocityHandler.h new file mode 100644 index 0000000..ae08dc3 --- /dev/null +++ b/mc2hook/mc2hook/handlers/MaxVelocityHandler.h @@ -0,0 +1,8 @@ +#pragma once +#include + +class MaxVelocityHandler +{ +public: + static void Install(); +}; diff --git a/mc2hook/mc2hook/handlers/handlers.h b/mc2hook/mc2hook/handlers/handlers.h index ea7a661..6106760 100644 --- a/mc2hook/mc2hook/handlers/handlers.h +++ b/mc2hook/mc2hook/handlers/handlers.h @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -35,6 +36,7 @@ static void InstallHandlersPostEngineInit() InstallHandler("Path Handler"); InstallHandler("Panel Handler (Keyboard input test really)"); InstallHandler("Transmission Handler"); + InstallHandler("Max Velocity Handler"); } // Installed at game launch diff --git a/mc2hook/mc2hook/mc2hook.vcxproj b/mc2hook/mc2hook/mc2hook.vcxproj index 056702b..d01f690 100644 --- a/mc2hook/mc2hook/mc2hook.vcxproj +++ b/mc2hook/mc2hook/mc2hook.vcxproj @@ -195,6 +195,7 @@ + @@ -247,6 +248,7 @@ +