From 80242b42f7e95d34f8a2af2927e8a103278256bb Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 4 Jan 2019 00:47:05 +0100 Subject: [PATCH] Marked some functions as safebuffers since realistically QueryPerformanceCounter won't ever cause a buffer overrun and it's a quite time critical function --- SilentPatchIII/SilentPatchIII.cpp | 2 +- SilentPatchSA/SilentPatchSA.cpp | 4 ++-- SilentPatchVC/SilentPatchVC.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index 69f323b..f7702e5 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -296,7 +296,7 @@ void __declspec(naked) RadarBoundsCheckEntityBlip() extern char** ppUserFilesDir = AddressByVersion(0x580C16, 0x580F66, 0x580E66); static LARGE_INTEGER FrameTime; -int32_t GetTimeSinceLastFrame() +__declspec(safebuffers) int32_t GetTimeSinceLastFrame() { LARGE_INTEGER curTime; QueryPerformanceCounter(&curTime); diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 365fe35..ba2dbe9 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -763,7 +763,7 @@ char* GetMyDocumentsPathSA() } static LARGE_INTEGER FrameTime; -int32_t GetTimeSinceLastFrame() +__declspec(safebuffers) int32_t GetTimeSinceLastFrame() { LARGE_INTEGER curTime; QueryPerformanceCounter(&curTime); @@ -2134,7 +2134,7 @@ DarkVehiclesFix4_MakeItDark: } // 1.0 ONLY ENDS HERE -static int _Timers_ftol_internal( double timer, double& remainder ) +__declspec(safebuffers) static int _Timers_ftol_internal( double timer, double& remainder ) { double integral; remainder = modf( timer + remainder, &integral ); diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 23d9c1d..b9bd144 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -161,7 +161,7 @@ void __declspec(naked) CreateInstance_BikeFix() extern char** ppUserFilesDir = AddressByVersion(0x6022AA, 0x60228A, 0x601ECA); static LARGE_INTEGER FrameTime; -int32_t GetTimeSinceLastFrame() +__declspec(safebuffers) int32_t GetTimeSinceLastFrame() { LARGE_INTEGER curTime; QueryPerformanceCounter(&curTime);