diff --git a/Cheat Engine/bin/autorun/SpeedhackV3.lua b/Cheat Engine/bin/autorun/SpeedhackV3.lua index 0d911aae..5000b0df 100644 --- a/Cheat Engine/bin/autorun/SpeedhackV3.lua +++ b/Cheat Engine/bin/autorun/SpeedhackV3.lua @@ -38,8 +38,9 @@ end function hookSpeedFunctions() - --print("hookSpeedFunctions") + -- print("hookSpeedFunctions") if getAddressSafe("new_gettickcount")~=nil and getAddressSafe("speedhack_wantedspeed")~=nil then + -- print("already hooked") return true end @@ -65,6 +66,8 @@ function hookSpeedFunctions() return end + -- print("allocated speedhack_wantedspeed") + local gtcaddress=getAddressSafe('kernel32.gettickcount64') if gtcaddress==nil then waitforExports() @@ -94,6 +97,7 @@ label(gtc_returnhere) label(gtchook_exit) {$c} +#include #include #include @@ -170,7 +174,14 @@ jmp new_gettickcount ]],originalcode, filler) - local result, data=autoAssemble(s) + local result, data=autoAssemble(s) + + if not result then + if data==nil then + data=' (no reason)' + end + messageDialog('Failure hooking kernel32.gettickcount64:'..data, mtError, mbOK) + end end; @@ -204,6 +215,7 @@ label(qpc_returnhere) label(qpchook_exit) {$c} +#include #include #include @@ -283,6 +295,14 @@ qpc_returnhere: ]],originalcode, filler) local result2, data2=autoAssemble(s) + + if not result2 then + if data==nil then + data=' (no reason)' + end + messageDialog('Failure hooking ntdll.RtlQueryPerformanceCounter:'..data, mtError, mbOK) + end + end; return result or result2