mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-07 19:53:01 +05:00
SilentPatchIII/VC/SA: Add GCC-compatible safebuffers equivalent
And switch to a common define for this attribute (this fixes compile warnings on MinGW GCC)
This commit is contained in:
parent
464a5d729b
commit
e8c1fde97f
4 changed files with 11 additions and 4 deletions
|
@ -6,6 +6,13 @@
|
||||||
|
|
||||||
#include <rwcore.h>
|
#include <rwcore.h>
|
||||||
|
|
||||||
|
// FIXME: Common.h might be a better place for this (but SA doesn't include it)
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define NOBUFFERCHECKS __declspec(safebuffers)
|
||||||
|
#else
|
||||||
|
#define NOBUFFERCHECKS __attribute__((optimize("-fno-stack-protector")))
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr double RAD_TO_DEG (180.0/M_PI);
|
constexpr double RAD_TO_DEG (180.0/M_PI);
|
||||||
constexpr double DEG_TO_RAD (M_PI/180.0);
|
constexpr double DEG_TO_RAD (M_PI/180.0);
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ void __declspec(naked) RadarBoundsCheckEntityBlip()
|
||||||
extern char** ppUserFilesDir = AddressByVersion<char**>(0x580C16, 0x580F66, 0x580E66);
|
extern char** ppUserFilesDir = AddressByVersion<char**>(0x580C16, 0x580F66, 0x580E66);
|
||||||
|
|
||||||
static LARGE_INTEGER FrameTime;
|
static LARGE_INTEGER FrameTime;
|
||||||
__declspec(safebuffers) int32_t GetTimeSinceLastFrame()
|
NOBUFFERCHECKS int32_t GetTimeSinceLastFrame()
|
||||||
{
|
{
|
||||||
LARGE_INTEGER curTime;
|
LARGE_INTEGER curTime;
|
||||||
QueryPerformanceCounter(&curTime);
|
QueryPerformanceCounter(&curTime);
|
||||||
|
|
|
@ -950,7 +950,7 @@ char* GetMyDocumentsPathSA()
|
||||||
}
|
}
|
||||||
|
|
||||||
static LARGE_INTEGER FrameTime;
|
static LARGE_INTEGER FrameTime;
|
||||||
__declspec(safebuffers) int32_t GetTimeSinceLastFrame()
|
NOBUFFERCHECKS int32_t GetTimeSinceLastFrame()
|
||||||
{
|
{
|
||||||
LARGE_INTEGER curTime;
|
LARGE_INTEGER curTime;
|
||||||
QueryPerformanceCounter(&curTime);
|
QueryPerformanceCounter(&curTime);
|
||||||
|
|
|
@ -699,7 +699,7 @@ void __declspec(naked) CreateInstance_BikeFix()
|
||||||
extern char** ppUserFilesDir = AddressByVersion<char**>(0x6022AA, 0x60228A, 0x601ECA);
|
extern char** ppUserFilesDir = AddressByVersion<char**>(0x6022AA, 0x60228A, 0x601ECA);
|
||||||
|
|
||||||
static LARGE_INTEGER FrameTime;
|
static LARGE_INTEGER FrameTime;
|
||||||
__declspec(safebuffers) int32_t GetTimeSinceLastFrame()
|
NOBUFFERCHECKS int32_t GetTimeSinceLastFrame()
|
||||||
{
|
{
|
||||||
LARGE_INTEGER curTime;
|
LARGE_INTEGER curTime;
|
||||||
QueryPerformanceCounter(&curTime);
|
QueryPerformanceCounter(&curTime);
|
||||||
|
|
Loading…
Reference in a new issue