Merge branch 'master' of github.com:GTAmodding/re3

This commit is contained in:
aap 2019-06-11 08:58:14 +02:00
commit a600fa9976
10 changed files with 1147 additions and 111 deletions

View File

@ -34,6 +34,7 @@ project "re3"
targetdir "bin/%{cfg.buildcfg}" targetdir "bin/%{cfg.buildcfg}"
targetextension ".dll" targetextension ".dll"
characterset ("MBCS") characterset ("MBCS")
linkoptions "/SAFESEH:NO"
filter "configurations:Debug" filter "configurations:Debug"
defines { "DEBUG" } defines { "DEBUG" }

View File

@ -17,6 +17,7 @@ WRAPPER void CControllerConfigManager::MakeControllerActionsBlank() { EAXJMP(0x5
WRAPPER void CControllerConfigManager::InitDefaultControlConfiguration() { EAXJMP(0x58B930); } WRAPPER void CControllerConfigManager::InitDefaultControlConfiguration() { EAXJMP(0x58B930); }
WRAPPER void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerState const &mousestate) { EAXJMP(0x58BD00); } WRAPPER void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerState const &mousestate) { EAXJMP(0x58BD00); }
WRAPPER Int32 CControllerConfigManager::GetJoyButtonJustDown() { EAXJMP(0x58B7D0); } WRAPPER Int32 CControllerConfigManager::GetJoyButtonJustDown() { EAXJMP(0x58B7D0); }
WRAPPER void CControllerConfigManager::InitDefaultControlConfigJoyPad(unsigned int buttons) { EAXJMP(0x58BD90); }
void CControllerConfigManager::LoadSettings(Int32 file) void CControllerConfigManager::LoadSettings(Int32 file)
{ {

View File

@ -45,6 +45,7 @@ public:
void MakeControllerActionsBlank(); void MakeControllerActionsBlank();
void InitDefaultControlConfiguration(); void InitDefaultControlConfiguration();
void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate); void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate);
void InitDefaultControlConfigJoyPad(unsigned int buttons);
}; };

View File

@ -10,7 +10,7 @@
#include <stdint.h> #include <stdint.h>
#include <math.h> #include <math.h>
#include <assert.h> //#include <assert.h>
#include <new> #include <new>
#ifdef WITHD3D #ifdef WITHD3D
@ -125,7 +125,7 @@ inline float sq(float x) { return x*x; }
#define DEGTORAD(x) ((x) * PI / 180.0f) #define DEGTORAD(x) ((x) * PI / 180.0f)
#define RADTODEG(x) ((x) * 180.0f / PI) #define RADTODEG(x) ((x) * 180.0f / PI)
#if USE_PS2_RAND == TRUE #ifdef USE_PS2_RAND
#define MYRAND_MAX 65535 #define MYRAND_MAX 65535
#else #else
#define MYRAND_MAX 32767 #define MYRAND_MAX 32767
@ -134,8 +134,15 @@ inline float sq(float x) { return x*x; }
int myrand(void); int myrand(void);
void mysrand(unsigned int seed); void mysrand(unsigned int seed);
#define debug(f, ...) printf("[DBG]: " f "\n", __VA_ARGS__) void re3_debug(char *format, ...);
#define DEV(f, ...) printf("[DEV]: " f "", __VA_ARGS__) void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...);
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func);
#define debug(f, ...) re3_debug("[DBG]: " f, __VA_ARGS__)
#define DEV(f, ...) re3_debug("[DEV]: " f, __VA_ARGS__)
#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, __VA_ARGS__)
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
#define ASSERT assert #define ASSERT assert
#define _TODO(x) #define _TODO(x)

View File

@ -57,7 +57,10 @@ enum Config {
NUMPOINTLIGHTS = 32 NUMPOINTLIGHTS = 32
}; };
#define GTA3_1_1_PATCH FALSE #define GTA3_1_1_PATCH
#define USE_PS2_RAND FALSE #define USE_PS2_RAND
#define RANDOMSPLASH #define RANDOMSPLASH
#define CHATTYSPLASH #define CHATTYSPLASH
//#define FIX_BUGS
//#define NO_CDCHECK
#define NO_MOVIES

View File

@ -1,4 +1,5 @@
#include <direct.h> #include <direct.h>
#include <csignal>
#include <Windows.h> #include <Windows.h>
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
@ -20,7 +21,7 @@ WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
void *operator new(size_t sz) { return gtanew(sz); } void *operator new(size_t sz) { return gtanew(sz); }
void operator delete(void *ptr) noexcept { gtadelete(ptr); } void operator delete(void *ptr) noexcept { gtadelete(ptr); }
#if USE_PS2_RAND == TRUE #ifdef USE_PS2_RAND
unsigned __int64 myrand_seed = 1; unsigned __int64 myrand_seed = 1;
#else #else
unsigned long int myrand_seed = 1; unsigned long int myrand_seed = 1;
@ -29,7 +30,7 @@ unsigned long int myrand_seed = 1;
int int
myrand(void) myrand(void)
{ {
#if USE_PS2_RAND == TRUE #ifdef USE_PS2_RAND
// Use our own implementation of rand, stolen from PS2 // Use our own implementation of rand, stolen from PS2
myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1; myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1;
return ((myrand_seed >> 32) & 0x7FFFFFFF); return ((myrand_seed >> 32) & 0x7FFFFFFF);
@ -136,6 +137,79 @@ HeadlightsFix_DontLimit:
} }
} }
const int re3_buffsize = 1024;
static char re3_buff[re3_buffsize];
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
{
int nCode;
strcpy_s(re3_buff, re3_buffsize, "Assertion failed!" );
strcat_s(re3_buff, re3_buffsize, "\n" );
strcat_s(re3_buff, re3_buffsize, "File: ");
strcat_s(re3_buff, re3_buffsize, filename );
strcat_s(re3_buff, re3_buffsize, "\n" );
strcat_s(re3_buff, re3_buffsize, "Line: " );
_itoa_s( lineno, re3_buff + strlen(re3_buff), re3_buffsize - strlen(re3_buff), 10 );
strcat_s(re3_buff, re3_buffsize, "\n");
strcat_s(re3_buff, re3_buffsize, "Function: ");
strcat_s(re3_buff, re3_buffsize, func );
strcat_s(re3_buff, re3_buffsize, "\n" );
strcat_s(re3_buff, re3_buffsize, "Expression: ");
strcat_s(re3_buff, re3_buffsize, expr);
strcat_s(re3_buff, re3_buffsize, "\n");
strcat_s(re3_buff, re3_buffsize, "\n" );
strcat_s(re3_buff, re3_buffsize, "(Press Retry to debug the application)");
nCode = ::MessageBoxA(NULL, re3_buff, "RE3 Assertion Failed!",
MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
if (nCode == IDABORT)
{
raise(SIGABRT);
_exit(3);
}
if (nCode == IDRETRY)
{
__debugbreak();
return;
}
if (nCode == IDIGNORE)
return;
abort();
}
void re3_debug(char *format, ...)
{
va_list va;
va_start(va, format);
vsprintf_s(re3_buff, re3_buffsize, format, va);
va_end(va);
printf("%s\n", re3_buff);
}
void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...)
{
char buff[re3_buffsize *2];
va_list va;
va_start(va, format);
vsprintf_s(re3_buff, re3_buffsize, format, va);
va_end(va);
sprintf_s(buff, re3_buffsize * 2, "[%s.%s:%d]: %s", filename, func, lineno, re3_buff);
OutputDebugStringA(buff);
}
void void
patch() patch()

View File

@ -587,7 +587,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ ) for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{ {
RwTextureDestroy(gpSmokeTex[i]); RwTextureDestroy(gpSmokeTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpSmokeTex[i] = NULL; gpSmokeTex[i] = NULL;
#endif #endif
} }
@ -595,7 +595,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ ) for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
{ {
RwTextureDestroy(gpSmoke2Tex[i]); RwTextureDestroy(gpSmoke2Tex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpSmoke2Tex[i] = NULL; gpSmoke2Tex[i] = NULL;
#endif #endif
} }
@ -603,7 +603,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ ) for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{ {
RwTextureDestroy(gpRubberTex[i]); RwTextureDestroy(gpRubberTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpRubberTex[i] = NULL; gpRubberTex[i] = NULL;
#endif #endif
} }
@ -611,7 +611,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{ {
RwTextureDestroy(gpRainSplashTex[i]); RwTextureDestroy(gpRainSplashTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpRainSplashTex[i] = NULL; gpRainSplashTex[i] = NULL;
#endif #endif
} }
@ -619,7 +619,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{ {
RwTextureDestroy(gpWatersprayTex[i]); RwTextureDestroy(gpWatersprayTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpWatersprayTex[i] = NULL; gpWatersprayTex[i] = NULL;
#endif #endif
} }
@ -627,7 +627,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{ {
RwTextureDestroy(gpExplosionMediumTex[i]); RwTextureDestroy(gpExplosionMediumTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpExplosionMediumTex[i] = NULL; gpExplosionMediumTex[i] = NULL;
#endif #endif
} }
@ -635,7 +635,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ ) for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{ {
RwTextureDestroy(gpGunFlashTex[i]); RwTextureDestroy(gpGunFlashTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpGunFlashTex[i] = NULL; gpGunFlashTex[i] = NULL;
#endif #endif
} }
@ -643,7 +643,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ ) for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
{ {
RwTextureDestroy(gpRainDropTex[i]); RwTextureDestroy(gpRainDropTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpRainDropTex[i] = NULL; gpRainDropTex[i] = NULL;
#endif #endif
} }
@ -651,7 +651,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{ {
RwTextureDestroy(gpRainSplashupTex[i]); RwTextureDestroy(gpRainSplashupTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpRainSplashupTex[i] = NULL; gpRainSplashupTex[i] = NULL;
#endif #endif
} }
@ -659,7 +659,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ ) for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{ {
RwTextureDestroy(gpBirdfrontTex[i]); RwTextureDestroy(gpBirdfrontTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpBirdfrontTex[i] = NULL; gpBirdfrontTex[i] = NULL;
#endif #endif
} }
@ -667,7 +667,7 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{ {
RwTextureDestroy(gpCarDebrisTex[i]); RwTextureDestroy(gpCarDebrisTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpCarDebrisTex[i] = NULL; gpCarDebrisTex[i] = NULL;
#endif #endif
} }
@ -675,78 +675,78 @@ void CParticle::Shutdown()
for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{ {
RwTextureDestroy(gpCarSplashTex[i]); RwTextureDestroy(gpCarSplashTex[i]);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpCarSplashTex[i] = NULL; gpCarSplashTex[i] = NULL;
#endif #endif
} }
RwTextureDestroy(gpFlame1Tex); RwTextureDestroy(gpFlame1Tex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpFlame1Tex = NULL; gpFlame1Tex = NULL;
#endif #endif
RwTextureDestroy(gpFlame5Tex); RwTextureDestroy(gpFlame5Tex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpFlame5Tex = NULL; gpFlame5Tex = NULL;
#endif #endif
RwTextureDestroy(gpRainDropSmallTex); RwTextureDestroy(gpRainDropSmallTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpRainDropSmallTex = NULL; gpRainDropSmallTex = NULL;
#endif #endif
RwTextureDestroy(gpBloodTex); RwTextureDestroy(gpBloodTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpBloodTex = NULL; gpBloodTex = NULL;
#endif #endif
RwTextureDestroy(gpLeafTex); RwTextureDestroy(gpLeafTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpLeafTex = NULL; gpLeafTex = NULL;
#endif #endif
RwTextureDestroy(gpCloudTex1); RwTextureDestroy(gpCloudTex1);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpCloudTex1 = NULL; gpCloudTex1 = NULL;
#endif #endif
RwTextureDestroy(gpCloudTex4); RwTextureDestroy(gpCloudTex4);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpCloudTex4 = NULL; gpCloudTex4 = NULL;
#endif #endif
RwTextureDestroy(gpBloodSmallTex); RwTextureDestroy(gpBloodSmallTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpBloodSmallTex = NULL; gpBloodSmallTex = NULL;
#endif #endif
RwTextureDestroy(gpGungeTex); RwTextureDestroy(gpGungeTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpGungeTex = NULL; gpGungeTex = NULL;
#endif #endif
RwTextureDestroy(gpCollisionSmokeTex); RwTextureDestroy(gpCollisionSmokeTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpCollisionSmokeTex = NULL; gpCollisionSmokeTex = NULL;
#endif #endif
RwTextureDestroy(gpBulletHitTex); RwTextureDestroy(gpBulletHitTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpBulletHitTex = NULL; gpBulletHitTex = NULL;
#endif #endif
RwTextureDestroy(gpGunShellTex); RwTextureDestroy(gpGunShellTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpGunShellTex = NULL; gpGunShellTex = NULL;
#endif #endif
RwTextureDestroy(gpWakeOldTex); RwTextureDestroy(gpWakeOldTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpWakeOldTex = NULL; gpWakeOldTex = NULL;
#endif #endif
RwTextureDestroy(gpPointlightTex); RwTextureDestroy(gpPointlightTex);
#if GTA3_1_1_PATCH == TRUE #ifdef GTA3_1_1_PATCH
gpPointlightTex = NULL; gpPointlightTex = NULL;
#endif #endif

View File

@ -654,7 +654,6 @@ HandleKeyUp(RsKeyStatus *keyStatus)
if ( c < 255 ) if ( c < 255 )
{ {
CPad::TempKeyState.VK_KEYS[c] = 0; CPad::TempKeyState.VK_KEYS[c] = 0;
pad0->AddToPCCheatString(c);
} }
break; break;
} }

View File

@ -190,7 +190,6 @@ typedef struct RsPadButtonStatus RsPadButtonStatus;
struct RsPadButtonStatus struct RsPadButtonStatus
{ {
RwInt32 padID; RwInt32 padID;
RwUInt32 padButtons;
}; };
enum RsPadButtons enum RsPadButtons

File diff suppressed because it is too large Load Diff