From 8aac6060d36c5dca48c02988b654d4646b175e64 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Mon, 4 May 2020 20:33:48 +0300 Subject: oal upd --- src/core/Game.cpp | 19 +++---------------- src/core/config.h | 3 ++- 2 files changed, 5 insertions(+), 17 deletions(-) (limited to 'src/core') diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 8633d222..8ab12e3f 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -220,22 +220,9 @@ bool CGame::InitialiseOnceAfterRW(void) if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) { CMenuManager::m_PrefsSpeakers = 0; - - for ( int32 i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++ ) - { - wchar buff[64]; - - char *name = DMAudio.Get3DProviderName(i); - AsciiToUnicode(name, buff); - char *providername = UnicodeToAscii(buff); - strupr(providername); - - if ( !strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") ) - { - FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = i; - break; - } - } + int8 provider = DMAudio.AutoDetect3DProviders(); + if ( provider != -1 ) + FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider; } DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex); diff --git a/src/core/config.h b/src/core/config.h index 163af701..23fe9993 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -193,7 +193,8 @@ enum Config { #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img //#define USE_TEXTURE_POOL -//#define OPENAL +#define AUDIO_OAL +//#define AUDIO_MSS // Particle //#define PC_PARTICLE -- cgit v1.2.3 From 0abd0c659b39805a457896427980414cdc552ff8 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Mon, 4 May 2020 21:06:14 +0300 Subject: openal-soft added --- src/core/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/config.h b/src/core/config.h index 23fe9993..6896a7ba 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -193,8 +193,8 @@ enum Config { #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img //#define USE_TEXTURE_POOL -#define AUDIO_OAL -//#define AUDIO_MSS +//#define AUDIO_OAL +#define AUDIO_MSS // Particle //#define PC_PARTICLE -- cgit v1.2.3 From 12a3499ca365756a77958d616423aca39a23234b Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Thu, 7 May 2020 09:26:16 +0300 Subject: oal wav/mp3 stream update --- src/core/common.h | 2 ++ src/core/re3.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/core') diff --git a/src/core/common.h b/src/core/common.h index 18f4715c..66a3ad81 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -209,6 +209,7 @@ void mysrand(unsigned int seed); void re3_debug(const char *format, ...); void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...); void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func); +void re3_usererror(const char *format, ...); #define DEBUGBREAK() __debugbreak(); @@ -216,6 +217,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__) #define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__) #define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__) +#define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__) #define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) ) #define ASSERT assert diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 2a9cbc77..b7eb6480 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -456,6 +456,20 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons OutputDebugStringA(buff); } +void re3_usererror(const char *format, ...) +{ + va_list va; + va_start(va, format); + vsprintf_s(re3_buff, re3_buffsize, format, va); + va_end(va); + + ::MessageBoxA(nil, re3_buff, "RE3 Error!", + MB_OK|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); + + raise(SIGABRT); + _exit(3); +} + #ifdef VALIDATE_SAVE_SIZE int32 _saveBufCount; #endif -- cgit v1.2.3 From af6e132b37e8b7e89e4c0c7a52e5bb81e4b1b9a8 Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 19:54:37 +0600 Subject: defined out asserts. --- src/core/Camera.h | 6 ++++++ src/core/CdStream.cpp | 3 +++ src/core/CdStream.h | 3 ++- src/core/Placeable.h | 5 ++++- src/core/PlayerInfo.h | 3 +++ src/core/Wanted.h | 2 ++ src/core/World.h | 4 ++++ src/core/common.h | 4 ++++ 8 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/Camera.h b/src/core/Camera.h index 51138f99..d69b1be4 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -260,9 +260,12 @@ public: void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size"); static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); static_assert(offsetof(CCam, Front) == 0x140, "CCam: error"); +#endif class CCamPathSplines { @@ -637,6 +640,8 @@ uint32 unknown; // some counter having to do with music bool IsSphereVisible(const CVector ¢er, float radius); bool IsBoxVisible(RwV3d *box, const CMatrix *mat); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error"); static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error"); static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error"); @@ -650,6 +655,7 @@ static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: er static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error"); static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error"); static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); +#endif extern CCamera TheCamera; diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp index ea79fb9a..3b9eaac5 100644 --- a/src/core/CdStream.cpp +++ b/src/core/CdStream.cpp @@ -22,7 +22,10 @@ struct CdReadInfo HANDLE hFile; OVERLAPPED Overlapped; }; + +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CdReadInfo, 0x30); +#endif char gCdImageNames[MAX_CDIMAGES+1][64]; int32 gNumImages; diff --git a/src/core/CdStream.h b/src/core/CdStream.h index 9ef71b65..ba74be31 100644 --- a/src/core/CdStream.h +++ b/src/core/CdStream.h @@ -25,8 +25,9 @@ struct Queue int32 size; }; +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(Queue, 0x10); - +#endif void CdStreamInitThread(void); void CdStreamInit(int32 numChannels); diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 7e858283..110a1542 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -31,4 +31,7 @@ public: bool IsWithinArea(float x1, float y1, float x2, float y2); bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2); }; -static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); \ No newline at end of file + +#ifdef CHECK_STRUCT_SIZES +static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); +#endif \ No newline at end of file diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index e970e42d..ae089032 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -80,4 +80,7 @@ public: ~CPlayerInfo() { }; }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error"); +#endif diff --git a/src/core/Wanted.h b/src/core/Wanted.h index e3e407b0..802c3673 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -54,4 +54,6 @@ public: static void SetMaximumWantedLevel(int32 level); }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); +#endif diff --git a/src/core/World.h b/src/core/World.h index ab3f0192..6fc6681d 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -45,7 +45,11 @@ class CSector public: CPtrList m_lists[NUMSECTORENTITYLISTS]; }; + + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CSector) == 0x28, "CSector: error"); +#endif class CEntity; struct CColPoint; diff --git a/src/core/common.h b/src/core/common.h index ff8580a1..41773877 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -226,7 +226,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define _TODO(x) #define _TODOCONST(x) (x) +#ifdef CHECK_STRUCT_SIZES #define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc) +#else +#define VALIDATE_SIZE(struc, size) +#endif #define VALIDATE_OFFSET(struc, member, offset) static_assert(offsetof(struc, member) == offset, "The offset of " #member " in " #struc " is not " #offset "...") #define PERCENT(x, p) ((float(x) * (float(p) / 100.0f))) -- cgit v1.2.3 From 5b605c127144ab805581f62015ef3742c1d4a64e Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 10 May 2020 17:09:57 +0200 Subject: some fixes and cosmetic changes --- src/core/FileLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index adf4b9f8..88afb40c 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -783,7 +783,7 @@ CFileLoader::LoadVehicleObject(const char *line) mi->SetTexDictionary(txd); for(p = gamename; *p; p++) if(*p == '_') *p = ' '; - strncpy(mi->m_gameName, gamename, 32); + strcpy(mi->m_gameName, gamename); mi->m_level = level; mi->m_compRules = comprules; -- cgit v1.2.3 From c798e1bacdaabaf140ff3904948fd7cec46c09bb Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 21:49:33 +0600 Subject: Fixed typos and made all assert functions optional --- src/core/Camera.h | 4 ++-- src/core/CdStream.cpp | 2 -- src/core/CdStream.h | 2 -- src/core/Frontend.h | 2 +- src/core/Placeable.h | 4 +--- src/core/PlayerInfo.h | 4 +--- src/core/Radar.cpp | 2 ++ src/core/Radar.h | 2 +- src/core/Wanted.h | 4 +--- src/core/World.h | 5 +---- 10 files changed, 10 insertions(+), 21 deletions(-) (limited to 'src/core') diff --git a/src/core/Camera.h b/src/core/Camera.h index d69b1be4..b197aed3 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -261,8 +261,8 @@ public: void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size"); +VALIDATE_SIZE(CCam, 0x1A4); +#ifdef CHECK_STRUCT_SIZES static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); static_assert(offsetof(CCam, Front) == 0x140, "CCam: error"); #endif diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp index 3b9eaac5..666041e1 100644 --- a/src/core/CdStream.cpp +++ b/src/core/CdStream.cpp @@ -23,9 +23,7 @@ struct CdReadInfo OVERLAPPED Overlapped; }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CdReadInfo, 0x30); -#endif char gCdImageNames[MAX_CDIMAGES+1][64]; int32 gNumImages; diff --git a/src/core/CdStream.h b/src/core/CdStream.h index ba74be31..ba6c63a3 100644 --- a/src/core/CdStream.h +++ b/src/core/CdStream.h @@ -25,9 +25,7 @@ struct Queue int32 size; }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(Queue, 0x10); -#endif void CdStreamInitThread(void); void CdStreamInit(int32 numChannels); diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 3286f275..e496f9c0 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -658,7 +658,7 @@ public: }; #ifndef IMPROVED_VIDEOMODE -static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); +VALIDATE_SIZE(CMenuManager, 0x564); #endif extern CMenuManager FrontEndMenuManager; diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 110a1542..970c0d48 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -32,6 +32,4 @@ public: bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); -#endif \ No newline at end of file +VALIDATE_SIZE(CPlaceable, 0x4C); diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index ae089032..94410753 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -81,6 +81,4 @@ public: ~CPlayerInfo() { }; }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error"); -#endif +VALIDATE_SIZE(CPlayerInfo, 0x13C); diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 9406f1bd..ac2712c9 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -76,7 +76,9 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { #define RADAR_NUM_TILES (8) #define RADAR_TILE_SIZE (RADAR_SIZE_X / RADAR_NUM_TILES) +#ifdef CHECK_STRUCT_SIZES static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square"); +#endif #define RADAR_MIN_RANGE (120.0f) #define RADAR_MAX_RANGE (350.0f) diff --git a/src/core/Radar.h b/src/core/Radar.h index e39a17f0..7d07671d 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -71,7 +71,7 @@ struct sRadarTrace uint16 m_eBlipDisplay; // eBlipDisplay uint16 m_eRadarSprite; // eRadarSprite }; -static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error"); +VALIDATE_SIZE(sRadarTrace, 0x30); // Values for screen space #define RADAR_LEFT (40.0f) diff --git a/src/core/Wanted.h b/src/core/Wanted.h index 802c3673..de36c442 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -54,6 +54,4 @@ public: static void SetMaximumWantedLevel(int32 level); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); -#endif +VALIDATE_SIZE(CWanted, 0x204); diff --git a/src/core/World.h b/src/core/World.h index 6fc6681d..2bcc4e43 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -46,10 +46,7 @@ public: CPtrList m_lists[NUMSECTORENTITYLISTS]; }; - -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CSector) == 0x28, "CSector: error"); -#endif +VALIDATE_SIZE(CSector, 0x28); class CEntity; struct CColPoint; -- cgit v1.2.3 From b4abb6ddd8c2daee13cc9f83f17286fdf286c798 Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 22:04:36 +0600 Subject: fixed few more typos --- src/core/Camera.h | 20 +------------------- src/core/Radar.cpp | 2 -- 2 files changed, 1 insertion(+), 21 deletions(-) (limited to 'src/core') diff --git a/src/core/Camera.h b/src/core/Camera.h index b197aed3..94bcbd23 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -262,10 +262,6 @@ public: }; VALIDATE_SIZE(CCam, 0x1A4); -#ifdef CHECK_STRUCT_SIZES -static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); -static_assert(offsetof(CCam, Front) == 0x140, "CCam: error"); -#endif class CCamPathSplines { @@ -641,21 +637,7 @@ uint32 unknown; // some counter having to do with music bool IsBoxVisible(RwV3d *box, const CMatrix *mat); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error"); -static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error"); -static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error"); -static_assert(offsetof(CCamera, m_uiNumberOfTrainCamNodes) == 0x84, "CCamera: error"); -static_assert(offsetof(CCamera, m_uiTransitionState) == 0x89, "CCamera: error"); -static_assert(offsetof(CCamera, m_uiTimeTransitionStart) == 0x94, "CCamera: error"); -static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error"); -static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error"); -static_assert(offsetof(CCamera, pToGarageWeAreIn) == 0x690, "CCamera: error"); -static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: error"); -static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error"); -static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error"); -static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); -#endif +VALIDATE_SIZE(CCamera, 0xE9D8); extern CCamera TheCamera; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index ac2712c9..9406f1bd 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -76,9 +76,7 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { #define RADAR_NUM_TILES (8) #define RADAR_TILE_SIZE (RADAR_SIZE_X / RADAR_NUM_TILES) -#ifdef CHECK_STRUCT_SIZES static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square"); -#endif #define RADAR_MIN_RANGE (120.0f) #define RADAR_MAX_RANGE (350.0f) -- cgit v1.2.3 From b11715608f5d12d82ecb364b0d2dc76c24d6ab1f Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 11 May 2020 09:18:41 +0200 Subject: few fixes --- src/core/Cam.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 20b262c8..21569647 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4540,6 +4540,9 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient } + if(TheCamera.m_bUseTransitionBeta) + Beta = CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta)); + Front = CVector(Cos(Alpha) * Cos(Beta), Cos(Alpha) * Sin(Beta), Sin(Alpha)); Source = TargetCoors - Front*CamDist; TargetCoors.z -= BaseOffset; // now get back to the real target coors again -- cgit v1.2.3