From f277377c14e74e6e773b93957949804d000a3c25 Mon Sep 17 00:00:00 2001 From: Rushaway Date: Sun, 20 Sep 2026 11:44:26 +0200 Subject: [PATCH 1/4] fix: free the GameConfig handle after resolving detour addresses hGameConf from LoadGameConfigFile() was never closed on either exit path of OnPluginStart(). Fixes #26 Co-Authored-By: Claude Sonnet 5 --- addons/sourcemod/scripting/FixFuncRotating.sp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/FixFuncRotating.sp b/addons/sourcemod/scripting/FixFuncRotating.sp index d6a42eb..cc35017 100644 --- a/addons/sourcemod/scripting/FixFuncRotating.sp +++ b/addons/sourcemod/scripting/FixFuncRotating.sp @@ -95,14 +95,17 @@ public void OnPluginStart() if(!pUpdateSpeed) { LogError("Could not find CFuncRotating::UpdateSpeed address"); + delete hGameConf; return; } g_CFuncRotating_UpdateSpeed = DHookCreateDetour(pUpdateSpeed, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity); DHookAddParam(g_CFuncRotating_UpdateSpeed, HookParamType_Float); - + if(!DHookEnableDetour(g_CFuncRotating_UpdateSpeed, false, CFuncRotating_UpdateSpeed)) { LogError("Could not enable detour for CFuncRotating::UpdateSpeed"); } + + delete hGameConf; } From 98c175c69c59a78cbb1b8653ab2247863d85776d Mon Sep 17 00:00:00 2001 From: Rushaway Date: Mon, 21 Sep 2026 15:04:59 +0200 Subject: [PATCH 2/4] Bump version to 1.0.3 in FixFuncRotating --- addons/sourcemod/scripting/FixFuncRotating.sp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/FixFuncRotating.sp b/addons/sourcemod/scripting/FixFuncRotating.sp index cc35017..f55a95a 100644 --- a/addons/sourcemod/scripting/FixFuncRotating.sp +++ b/addons/sourcemod/scripting/FixFuncRotating.sp @@ -11,7 +11,7 @@ public Plugin myinfo = name = "FixFuncRotating", author = "Cloud Strife", description = "Fixes func_rotating`s StartForward and StopAtStartPos inputs", - version = "1.0.2", + version = "1.0.3", url = "" }; From a46120f6cfa2440b68a623d1cd2ea9682e0cb076 Mon Sep 17 00:00:00 2001 From: Rushaway Date: Mon, 21 Sep 2026 15:08:37 +0200 Subject: [PATCH 3/4] Fix formatting issues in FixFuncRotating.sp --- addons/sourcemod/scripting/FixFuncRotating.sp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/addons/sourcemod/scripting/FixFuncRotating.sp b/addons/sourcemod/scripting/FixFuncRotating.sp index f55a95a..20d73e8 100644 --- a/addons/sourcemod/scripting/FixFuncRotating.sp +++ b/addons/sourcemod/scripting/FixFuncRotating.sp @@ -6,7 +6,7 @@ #pragma newdecls required -public Plugin myinfo = +public Plugin myinfo = { name = "FixFuncRotating", author = "Cloud Strife", @@ -45,20 +45,20 @@ public MRESReturn CFuncRotating_UpdateSpeed(int entity, Handle hParams) if(flNewSpeed <= 25) { float vecMoveAng[3], angStart[3], angRotation[3], avelpertick[3]; - + GetEntPropVector(entity, Prop_Data, "m_vecMoveAng", vecMoveAng); GetEntPropVector(entity, Prop_Data, "m_angStart", angStart); GetEntPropVector(entity, Prop_Data, "m_angRotation", angRotation); GetEntPropVector(entity, Prop_Data, "m_vecAngVelocity", avelpertick); ScaleVector(avelpertick, GetTickInterval()); - + int checkAxis = 2; if (vecMoveAng[0] != 0) checkAxis = 0; else if ( vecMoveAng[1] != 0 ) checkAxis = 1; - + float angDelta = ( angRotation[ checkAxis ] - angStart[ checkAxis ] )%360.0; if ( angDelta > 180.0 ) angDelta -= 360.0; - + if(FloatAbs(angDelta) < FloatAbs(avelpertick[ checkAxis ])) { SetEntPropVector(entity, Prop_Data, "m_angRotation", angStart); @@ -77,20 +77,19 @@ public void OnPluginStart() LogError("Couldn't load FixFuncRotating.games game config!"); return; } - + Address pStartForward = GameConfGetAddress(hGameConf, "CFuncRotating::InputStartForward"); if(pStartForward) { g_CFuncRotating_StartForward = DHookCreateDetour(pStartForward, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity); - + if(!DHookEnableDetour(g_CFuncRotating_StartForward, false, CFuncRotating_InputStartForward)) { LogError("Could not enable detour for CFuncRotating::InputStartForward"); } } else LogError("Could not find CFuncRotating::InputStartForward address"); - - + Address pUpdateSpeed = GameConfGetAddress(hGameConf, "CFuncRotating::UpdateSpeed"); if(!pUpdateSpeed) { From 24263b52d7e6b6b4375e0ca878a58c6bc8ab97e8 Mon Sep 17 00:00:00 2001 From: Rushaway Date: Mon, 21 Sep 2026 15:09:09 +0200 Subject: [PATCH 4/4] Refactor FloatMod and operator% functions --- addons/sourcemod/scripting/FixFuncRotating.sp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/sourcemod/scripting/FixFuncRotating.sp b/addons/sourcemod/scripting/FixFuncRotating.sp index 20d73e8..6fc05ff 100644 --- a/addons/sourcemod/scripting/FixFuncRotating.sp +++ b/addons/sourcemod/scripting/FixFuncRotating.sp @@ -21,12 +21,12 @@ Handle g_CFuncRotating_UpdateSpeed = null; #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR < 12 stock float FloatMod(float num, float denom) { - return num - denom * RoundToFloor(num / denom); + return num - denom * RoundToFloor(num / denom); } stock float operator%(float oper1, float oper2) { - return FloatMod(oper1, oper2); + return FloatMod(oper1, oper2); } #endif @@ -60,11 +60,11 @@ public MRESReturn CFuncRotating_UpdateSpeed(int entity, Handle hParams) if ( angDelta > 180.0 ) angDelta -= 360.0; if(FloatAbs(angDelta) < FloatAbs(avelpertick[ checkAxis ])) - { - SetEntPropVector(entity, Prop_Data, "m_angRotation", angStart); - return MRES_Ignored; - } - } + { + SetEntPropVector(entity, Prop_Data, "m_angRotation", angStart); + return MRES_Ignored; + } + } } return MRES_Ignored; }