Commit 26bdca89 authored by SR_team's avatar SR_team 💬

Add compatible with MSVC

parent 7a34b8e7
#include "methods.h"
#define _USE_MATH_DEFINES
#include <cmath>
#define M_PI 3.14159
CU IS_LINE_OF_SIGHT_CLEAR_FUNC = 0x56A490;
CU FIND_PLAYER_PED_FUNC = 0x56E210;
......
......@@ -46,4 +46,8 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_EXTENSIONS NO
)
target_link_libraries(${PROJECT_NAME} d3d9 d3dx9 dxerr9 ${Boost_LIBRARIES})
if ($ENV{DXSDK_DIR} STREQUAL "")
target_link_libraries(${PROJECT_NAME} d3d9 d3dx9 dxerr9 ${Boost_LIBRARIES})
else()
target_link_libraries(${PROJECT_NAME} d3d9 d3dx9 DxErr ${Boost_LIBRARIES})
endif()
#include "texture.h"
#include <assert.h>
#ifndef DXSDK_FOR_VS
#include <dxerr9.h>
#else
#include <DxErr.h>
#endif
template< typename T > bool safe_release( T &d ) {
if ( d != nullptr ) {
......
#include "SRBaseHook.h"
#include <tlhelp32.h>
#include <stdexcept>
SRBaseHook::SRBaseHook(size_t addr, size_t size)
: address(reinterpret_cast<void*>(addr)), hook_size(size)
......
......@@ -851,7 +851,7 @@ void *CShortAsm::myalloc( size_t size ) {
#endif
}
void *CShortAsm::myfree( void *ptr, size_t size ) {
void CShortAsm::myfree( void *ptr, size_t size ) {
#ifdef WIN32
VirtualFree( ptr, size, 0 );
#else
......
......@@ -3,6 +3,7 @@
#include <cstdint>
#include <vector>
#include <string>
#include <map>
#define CALLHOOK void __stdcall
......@@ -103,7 +104,7 @@ protected:
uint32_t getRelativeAddress( uint32_t addr );
void write( uint8_t v );
void *myalloc( size_t size );
void *myfree( void *ptr, size_t size );
void myfree( void *ptr, size_t size );
uint8_t *_code = nullptr;
uint32_t _size = 0;
......
......@@ -8,7 +8,11 @@ template<typename R, typename... Args> void* fn2void( R ( *fn )( Args... ) ) {
return *reinterpret_cast<void**>( &_ );
}
#ifdef WIN32
template<typename R, typename... Args> void* fn2void( R ( __stdcall *fn )( Args... ) ) {
#else
template<typename R, typename... Args> void* fn2void( R ( __attribute__((stdcall)) *fn )( Args... ) ) {
#endif
struct f {
decltype( fn ) fn;
} _{ fn };
......
Subproject commit 4d38641c8b09f370cfe4195856f398bc9189a717
Subproject commit ade412f62e6d95d635884ab37b33cf937068521e
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment