Kawe Mazidjatari 092b7e9d43 Start of migration to IDetour interface
Migrating to this to initialize all patterns and prototypes in Systems_Init() instead.
This should make debugging missing/not found patterns easier and allow for opting out variable/constant search (some of these require other patterns to be found, thus resulting in seg faults..).

Also added check to detect if user has a eligible CPU to run this SDK.
The game requires SSE and SSE2 instruction sets. Our SDK requires this too due to the use of SSE intrinsics, so we cannot let the game handle this. We have to check it ourselves.
2022-04-11 01:44:30 +02:00

45 lines
964 B
C++

#ifndef IDETOUR_H
#define IDETOUR_H
#define ADDDETOUR(x,y) static std::size_t dummy_reg_##y = AddDetour( new x() );
#define XREGISTER(x,y) ADDDETOUR(x, y)
#define REGISTER(x) XREGISTER(x, __COUNTER__)
class IDetour
{
public:
virtual ~IDetour() { ; }
virtual void GetAdr(void) const = 0;
virtual void GetFun(void) const = 0;
virtual void GetVar(void) const = 0;
virtual void GetCon(void) const = 0;
virtual void Attach(void) const = 0;
virtual void Detach(void) const = 0;
};
class HDetour : public IDetour
{
virtual void GetAdr(void) const { }
virtual void GetFun(void) const { }
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
namespace
{
std::int32_t nPad = 9;
std::vector<IDetour*> vDetour;
std::size_t AddDetour(IDetour* pDetour)
{
vDetour.push_back(pDetour);
return vDetour.size();
}
}
REGISTER(HDetour);
#endif // IDETOUR_H