Compare commits

..

18 commits

Author SHA1 Message Date
Echo J.
0f30079500
Merge dcde67d8e2 into 202101e4f7 2024-11-07 14:17:05 +02:00
Echo J
dcde67d8e2 SilentPatchVC: Explicitly define _USE_MATH_DEFINES
Not doing that makes M_PI disappear (possibly) due to rwcore.h
secretly including a math header (which breaks Maths.h on MinGW
GCC)
2024-11-07 14:16:06 +02:00
Echo J
00a48ec059 SilentPatchVC: Add GCC/Clang-specific inline assembly statements
This also includes a small wrapper to call a C++ function from inline ASM

(From III: This change also matches the MSVC statements more closely to
the GCC/Clang ones)
2024-11-07 14:16:06 +02:00
Echo J
135ceed86c SilentPatchIII: Add GCC/Clang-specific inline assembly statements
This also matches the MSVC statements more closely to the GCC/Clang
ones
2024-11-07 14:16:06 +02:00
Echo J
75004322ab SilentPatchIII: Add a missing functional header include
MinGW GCC doesn't implicitly include it either
2024-11-07 14:16:06 +02:00
Echo J
b386f216e4 SilentPatch: Add missing cmath header include
It's required for the modf() function (and it isn't implicitly
included on MinGW GCC)
2024-11-07 14:16:06 +02:00
Echo J
37a53c384a SilentPatch: Move a header include in SVF
This makes sure the fixed-width integer types are included in SVF.h
2024-11-07 14:16:06 +02:00
Echo J
52038fdd27 SilentPatch: Define a replacement for _stricmp() if needed
MinGW GCC doesn't have this MSVC-specific function
2024-11-07 14:16:06 +02:00
Echo J
8233e826ec SilentPatch: Simplify RwIm2DRenderLine function pointer declaration
MinGW GCC doesn't seem to unwind the layers of the macro define
properly (which causes it to not find the declaration type)
2024-11-07 14:15:54 +02:00
Echo J
9cf2881779 SilentPatch: Don't define certain Rw* functions if not needed
Redefining them can cause strange compile errors with MinGW GCC
2024-11-07 14:14:51 +02:00
Echo J
96e971e364 DDraw: Cast the memcpy() source argument
This works around the MinGW GCC type strictness
2024-11-07 14:14:51 +02:00
Echo J
f523ea372a DDraw: Change the forwarded name for DirectDrawCreateEx
MinGW GCC exports this function a bit differently (which doesn't
work here)
2024-11-07 14:14:51 +02:00
Echo J
b1a86e8a89 SilentPatchIII/VC/SA: Mark some function pointers as inline
MinGW GCC's linker can't find them otherwise
2024-11-07 14:14:33 +02:00
Echo J
9d988b3396 SilentPatchIII/VC: Remove extern from ppUserFilesDir variable definitions
This fixes compile warnings with MinGW GCC
2024-11-07 13:40:01 +02:00
Echo J
3eab9e4461 SilentPatchIII/VC/SA: Add GCC-compatible safebuffers equivalent
And switch to a common define for this attribute (this fixes
compile warnings on MinGW GCC)
2024-11-07 13:39:54 +02:00
Echo J
743fedfed2 Use reinterpret_cast for function pointer casts
MSVC (wrongly) allows those casts to succeed with static_cast:
https://stackoverflow.com/questions/74002657/why-cant-i-static-cast-a-void-to-a-pointer-to-function
(so adjust those casts for better compiler compatibility including MinGW GCC)
2024-11-07 13:38:07 +02:00
Echo J
a14472a16d Set Windows defines earlier
This avoids compile warnings on MinGW GCC (because standard C++
headers eventually import the Windows stuff)
2024-11-07 13:38:07 +02:00
Echo J
661336ecc9 Use lowercase names for Windows headers
This fixes missing header issues on a case-sensitive filesystem
with MinGW GCC
2024-11-07 13:37:56 +02:00
8 changed files with 33 additions and 25 deletions

View file

@ -2,6 +2,13 @@
#include <cstdint>
// Workaround for old MSVC inline function bugs
#if defined(_MSC_VER) && _MSC_VER < 1930
#define STATIC_INLINE static
#else
#define STATIC_INLINE static inline
#endif
#define RwEngineInstance (*rwengine)
extern "C" void** rwengine;

View file

@ -1254,7 +1254,7 @@ namespace SlidingTextsScalingFixes
static inline float** pHorShadowValue;
template<std::size_t Index>
static inline void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_Slide(float fX, float fY, const wchar_t* pText)
@ -1281,7 +1281,7 @@ namespace SlidingTextsScalingFixes
static inline bool bSlidingEnabled = false;
template<std::size_t Index>
static inline void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_Slide(float fX, float fY, const wchar_t* pText)

View file

@ -2,7 +2,7 @@
#define __AUDIOHARDWARE
// IStream
#include <Objidl.h>
#include <objidl.h>
enum eDecoderType
{
@ -205,4 +205,4 @@ public:
static_assert(sizeof(CAEDataStreamOld) == 0x28, "Wrong size: CAEDataStreamOld");
static_assert(sizeof(CAEDataStreamNew) == 0x2C, "Wrong size: CAEDataStreamNew");
#endif
#endif

View file

@ -3,8 +3,8 @@
#include "AudioHardwareSA.h"
// libflac
#include "FLAC\stream_decoder.h"
#include "FLAC\metadata.h"
#include "FLAC/stream_decoder.h"
#include "FLAC/metadata.h"
class CAEFLACDecoder final : public CAEStreamingDecoder
{
@ -45,4 +45,4 @@ public:
{ return m_streamMeta->data.stream_info.sample_rate; }
virtual uint32_t GetStreamID() const override
{ return GetStream()->GetID(); }
};
};

View file

@ -2,6 +2,7 @@
#define __GENERAL
#include <stdint.h>
#include "Common.h"
#include "TheFLAUtils.h"
class CSimpleTransform
@ -570,4 +571,4 @@ static_assert(sizeof(CPhysical) == 0x138, "Wrong size: CPhysical");
static_assert(sizeof(CObject) == 0x17C, "Wrong size: CObject");
static_assert(sizeof(CEscalator) == 0x150, "Wrong size: CEscalator");
#endif
#endif

View file

@ -3,9 +3,9 @@
#include <algorithm>
#include <array>
#include <d3d9.h>
#include <Shlwapi.h>
#include <ShlObj.h>
#include <ShellAPI.h>
#include <shlwapi.h>
#include <shlobj.h>
#include <shellapi.h>
#include <cinttypes>
#include "ScriptSA.h"
@ -2851,7 +2851,7 @@ namespace CreditsScalingFixes
static const unsigned int FIXED_RES_HEIGHT_SCALE = 448;
template<std::size_t Index>
static void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_ScaleY(float fX, float fY, const wchar_t* pText)
@ -2888,7 +2888,7 @@ namespace SlidingTextsScalingFixes
static inline bool bSlidingEnabled = false;
template<std::size_t Index>
static void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_Slide(float fX, float fY, const wchar_t* pText)
@ -2898,7 +2898,7 @@ namespace SlidingTextsScalingFixes
}
template<std::size_t Index>
static void (*orgSetRightJustifyWrap)(float wrap);
STATIC_INLINE void (*orgSetRightJustifyWrap)(float wrap);
template<std::size_t Index>
static void SetRightJustifyWrap_Slide(float wrap)
@ -2915,7 +2915,7 @@ namespace SlidingTextsScalingFixes
static inline bool bSlidingEnabled = false;
template<std::size_t Index>
static void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_Slide(float fX, float fY, const wchar_t* pText)
@ -3961,7 +3961,7 @@ DarkVehiclesFix4_MakeItDark:
}
// 1.0 ONLY ENDS HERE
__declspec(safebuffers) static int _Timers_ftol_internal( double timer, double& remainder )
NOBUFFERCHECKS static int _Timers_ftol_internal( double timer, double& remainder )
{
double integral;
remainder = modf( timer + remainder, &integral );

View file

@ -302,7 +302,7 @@ public:
private:
template<std::size_t Index>
static void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
STATIC_INLINE void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
template<std::size_t Index>
void DoHeadLightBeam_LightBeamFixSaveObj(int type, CMatrix& m, bool right)
@ -337,7 +337,7 @@ public:
public:
template<std::size_t Index>
static void (CAutomobile::*orgAutomobilePreRender)();
STATIC_INLINE void (CAutomobile::*orgAutomobilePreRender)();
template<std::size_t Index>
void PreRender_SilentPatch()
@ -352,7 +352,7 @@ public:
void HideDestroyedWheels_SilentPatch(void (CAutomobile::*spawnFlyingComponentCB)(int, unsigned int), int nodeID, unsigned int modelID);
template<std::size_t Index>
static void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
STATIC_INLINE void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
template<std::size_t Index>
void SpawnFlyingComponent_HideWheels(int nodeID, unsigned int modelID)
@ -448,7 +448,7 @@ private:
private:
template<std::size_t Index>
static CVehicle* (CStoredCar::*orgRestoreCar)();
STATIC_INLINE CVehicle* (CStoredCar::*orgRestoreCar)();
template<std::size_t Index>
CVehicle* RestoreCar_SilentPatch()
@ -477,4 +477,4 @@ static_assert(sizeof(CVehicle) == 0x5A0, "Wrong size: CVehicle");
static_assert(sizeof(CAutomobile) == 0x988, "Wrong size: CAutomobile");
static_assert(sizeof(CStoredCar) == 0x40, "Wrong size: CStoredCar");
#endif
#endif

View file

@ -356,7 +356,7 @@ namespace RadarTraceOutlineFixes
}
template<std::size_t Index>
static inline void (*orgShowRadarTraceWithHeight)(float, float, unsigned int, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char);
STATIC_INLINE void (*orgShowRadarTraceWithHeight)(float, float, unsigned int, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char);
template<std::size_t Index>
static void ShowRadarTraceWithHeight_RecalculatePositions(float a1, float a2, unsigned int a3, unsigned char a4, unsigned char a5, unsigned char a6, unsigned char a7, unsigned char a8)
@ -456,7 +456,7 @@ namespace SlidingTextsScalingFixes
static inline bool bSlidingEnabled = false;
template<std::size_t Index>
static inline void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_Slide(float fX, float fY, const wchar_t* pText)
@ -466,7 +466,7 @@ namespace SlidingTextsScalingFixes
}
template<std::size_t Index>
static inline void (*orgSetRightJustifyWrap)(float wrap);
STATIC_INLINE void (*orgSetRightJustifyWrap)(float wrap);
template<std::size_t Index>
static void SetRightJustifyWrap_Slide(float wrap)
@ -483,7 +483,7 @@ namespace SlidingTextsScalingFixes
static inline bool bSlidingEnabled = false;
template<std::size_t Index>
static inline void (*orgPrintString)(float,float,const wchar_t*);
STATIC_INLINE void (*orgPrintString)(float,float,const wchar_t*);
template<std::size_t Index>
static void PrintString_Slide(float fX, float fY, const wchar_t* pText)