From 2099df03466b6d275733cd5f282f15caba90f342 Mon Sep 17 00:00:00 2001 From: Seemann Date: Mon, 31 Aug 2026 21:18:55 -0400 Subject: [PATCH] correct various errors --- injector/injector.hpp | 2 +- plugin_sa/game_sa/CCullZones.cpp | 6 +++--- plugin_sa/game_sa/CDummy.h | 3 --- plugin_sa/game_sa/CDummyObject.h | 3 --- plugin_sa/game_sa/CGangWars.cpp | 4 ++-- plugin_sa/game_sa/CGangWars.h | 2 +- plugin_sa/game_sa/CGarages.cpp | 2 +- plugin_sa/game_sa/CMenuManager.cpp | 4 ++-- plugin_sa/game_sa/CMenuSystem.cpp | 4 ++-- plugin_sa/game_sa/CModelInfo.cpp | 2 +- plugin_sa/game_sa/CPad.cpp | 4 ++-- plugin_sa/game_sa/CPad.h | 2 +- plugin_sa/game_sa/CPlaceable.cpp | 16 ++++++++++++---- plugin_sa/game_sa/CPostEffects.cpp | 2 +- plugin_sa/game_sa/CRestart.cpp | 4 ++-- plugin_sa/game_sa/CStore.h | 2 +- plugin_sa/game_sa/CStuntJumpManager.cpp | 2 +- plugin_sa/game_sa/CVehicle.cpp | 4 ++-- plugin_sa/game_sa/CVehicle.h | 2 +- 19 files changed, 36 insertions(+), 34 deletions(-) diff --git a/injector/injector.hpp b/injector/injector.hpp index d16f6e9c6..187c0779c 100644 --- a/injector/injector.hpp +++ b/injector/injector.hpp @@ -102,7 +102,7 @@ namespace injector template explicit auto_pointer(T x) : p(to_void_pointer(x)) {} - bool is_null() const { return this->p != nullptr; } + bool is_null() const { return this->p == nullptr; } #if __cplusplus >= 201103L || _MSC_VER >= 1800 explicit operator bool() const { return is_null(); } diff --git a/plugin_sa/game_sa/CCullZones.cpp b/plugin_sa/game_sa/CCullZones.cpp index 34bc2012d..691f8b1a9 100644 --- a/plugin_sa/game_sa/CCullZones.cpp +++ b/plugin_sa/game_sa/CCullZones.cpp @@ -33,15 +33,15 @@ void CCullZones::Update() { } void CCullZones::AddCullZone(const CVector& center, float unk1, float fWidthY, float fBottomZ, float fWidthX, float unk2, float fTopZ, ushort flags) { - plugin::Call<0x72DF70>(); + plugin::Call<0x72DF70>(center, unk1, fWidthY, fBottomZ, fWidthX, unk2, fTopZ, flags); } void CCullZones::AddTunnelAttributeZone(const CVector& center, float unk1, float fWidthY, float fBottomZ, float fWidthX, float unk2, float fTopZ, ushort flags) { - plugin::Call<0x72DB50>(); + plugin::Call<0x72DB50>(center, unk1, fWidthY, fBottomZ, fWidthX, unk2, fTopZ, flags); } void CCullZones::AddMirrorAttributeZone(const CVector& center, float unk1, float fWidthY, float fBottomZ, float fWidthX, float unk2, float fTopZ, eZoneAttributes flags, float cm, float vX, float vY, float vZ) { - plugin::Call<0x72DC10>(); + plugin::Call<0x72DC10>(center, unk1, fWidthY, fBottomZ, fWidthX, unk2, fTopZ, flags, cm, vX, vY, vZ); } bool CCullZones::InRoomForAudio() { diff --git a/plugin_sa/game_sa/CDummy.h b/plugin_sa/game_sa/CDummy.h index f504f1d4a..8961a3aa4 100644 --- a/plugin_sa/game_sa/CDummy.h +++ b/plugin_sa/game_sa/CDummy.h @@ -12,7 +12,4 @@ class PLUGIN_API CDummy : public CEntity { public: }; -VALIDATE_SIZE(CDummy, 0x38); - - VALIDATE_SIZE(CDummy, 0x38); \ No newline at end of file diff --git a/plugin_sa/game_sa/CDummyObject.h b/plugin_sa/game_sa/CDummyObject.h index 1adc4bdaa..612579281 100644 --- a/plugin_sa/game_sa/CDummyObject.h +++ b/plugin_sa/game_sa/CDummyObject.h @@ -12,7 +12,4 @@ class PLUGIN_API CDummyObject : public CDummy { public: }; -VALIDATE_SIZE(CDummyObject, 0x38); - - VALIDATE_SIZE(CDummyObject, 0x38); \ No newline at end of file diff --git a/plugin_sa/game_sa/CGangWars.cpp b/plugin_sa/game_sa/CGangWars.cpp index 1e8da25be..a3ac64eb6 100644 --- a/plugin_sa/game_sa/CGangWars.cpp +++ b/plugin_sa/game_sa/CGangWars.cpp @@ -95,8 +95,8 @@ bool CGangWars::CreateAttackWave(int warFerocity, int waveID) { int addrof(CGangWars::CreateDefendingGroup) = ADDRESS_BY_VERSION(0x4453D0, 0, 0, 0, 0, 0); int gaddrof(CGangWars::CreateDefendingGroup) = GLOBAL_ADDRESS_BY_VERSION(0x4453D0, 0, 0, 0, 0, 0); -bool CGangWars::CreateDefendingGroup(int unsued) { - return plugin::CallAndReturnDynGlobal(gaddrof(CGangWars::CreateDefendingGroup), unsued); +bool CGangWars::CreateDefendingGroup(int unused) { + return plugin::CallAndReturnDynGlobal(gaddrof(CGangWars::CreateDefendingGroup), unused); } int addrof(CGangWars::DoStuffWhenPlayerVictorious) = ADDRESS_BY_VERSION(0x446400, 0, 0, 0, 0, 0); diff --git a/plugin_sa/game_sa/CGangWars.h b/plugin_sa/game_sa/CGangWars.h index 88ac89e32..703e67f50 100644 --- a/plugin_sa/game_sa/CGangWars.h +++ b/plugin_sa/game_sa/CGangWars.h @@ -66,7 +66,7 @@ class PLUGIN_API CGangWars { SUPPORTED_10US static void ClearSpecificZonesToTriggerGangWar(); SUPPORTED_10US static void ClearTheStreets(); SUPPORTED_10US static bool CreateAttackWave(int warFerocity, int waveID); - SUPPORTED_10US static bool CreateDefendingGroup(int unsued); + SUPPORTED_10US static bool CreateDefendingGroup(int unused); SUPPORTED_10US static void DoStuffWhenPlayerVictorious(); //! unused SUPPORTED_10US static bool DoesPlayerControlThisZone(CZoneInfo *zoneinfo); diff --git a/plugin_sa/game_sa/CGarages.cpp b/plugin_sa/game_sa/CGarages.cpp index 495bbe5b8..06a0e35af 100644 --- a/plugin_sa/game_sa/CGarages.cpp +++ b/plugin_sa/game_sa/CGarages.cpp @@ -15,5 +15,5 @@ bool CGarages::Load() { } bool CGarages::Save() { - return plugin::CallAndReturn(); + return plugin::CallAndReturn(); } \ No newline at end of file diff --git a/plugin_sa/game_sa/CMenuManager.cpp b/plugin_sa/game_sa/CMenuManager.cpp index 3e21d515a..0154ca4dd 100644 --- a/plugin_sa/game_sa/CMenuManager.cpp +++ b/plugin_sa/game_sa/CMenuManager.cpp @@ -72,11 +72,11 @@ bool CMenuManager::CheckRedefineControlInput() { } void CMenuManager::CheckSliderMovement(float input) { - plugin::CallMethod<0x57E4D0, CMenuManager*>(this, input); + plugin::CallMethod<0x573440, CMenuManager*>(this, input); } void CMenuManager::DisplayHelperText(char* text) { - plugin::CallMethod<0x57E4D0, CMenuManager*>(this, text); + plugin::CallMethod<0x57E240, CMenuManager*>(this, text); } int CMenuManager::DisplaySlider(float posX, float posY, float beginHeight, float endHeight, float distBetweenRects, float filledAmount, CRGBA const& colour) { diff --git a/plugin_sa/game_sa/CMenuSystem.cpp b/plugin_sa/game_sa/CMenuSystem.cpp index f99ccbe83..01c20ec7c 100644 --- a/plugin_sa/game_sa/CMenuSystem.cpp +++ b/plugin_sa/game_sa/CMenuSystem.cpp @@ -68,7 +68,7 @@ void CMenuSystem::DisplayGridMenu(unsigned char panelId, bool bBrightFont) void CMenuSystem::HighlightOneItem(unsigned char panelId, unsigned char itemId, bool bHighlight) { - ((void (__cdecl *)(unsigned char, unsigned char, bool))0x5816E0)(panelId, itemId, bHighlight); + ((void (__cdecl *)(unsigned char, unsigned char, bool))0x581C10)(panelId, itemId, bHighlight); } tMenuPanel** CMenuSystem::InsertMenu(unsigned char panelId, unsigned char columnId, char *pTitle, char *str1, char *str2, char *str3, char *str4, char *str5, char *str6, char *str7, char *str8, char *str9, char *str10, char *str11, char *str12) @@ -88,7 +88,7 @@ tMenuPanel* CMenuSystem::InsertOneMenuItemWithNumber(unsigned char panelId, unsi void CMenuSystem::SetActiveMenuItem(unsigned char panelId, char rowId) { - ((void (__cdecl *)(unsigned char, char))0x582630)(panelId, rowId); + ((void (__cdecl *)(unsigned char, char))0x5820C0)(panelId, rowId); } void CMenuSystem::SetColumnHeader(unsigned char panelId, unsigned char columnId, char *str) diff --git a/plugin_sa/game_sa/CModelInfo.cpp b/plugin_sa/game_sa/CModelInfo.cpp index 2ad282125..2284f5ebb 100644 --- a/plugin_sa/game_sa/CModelInfo.cpp +++ b/plugin_sa/game_sa/CModelInfo.cpp @@ -147,7 +147,7 @@ bool CModelInfo::IsHeliModel(int modelId) { return ((bool (__cdecl*)(int))0x4C5B00)(modelId); } -static bool IsMonsterTruckModel(int modelId) { +bool CModelInfo::IsMonsterTruckModel(int modelId) { return ((bool (__cdecl*)(int))0x4C5BC0)(modelId); } diff --git a/plugin_sa/game_sa/CPad.cpp b/plugin_sa/game_sa/CPad.cpp index 8dcb031d7..d79d3583f 100644 --- a/plugin_sa/game_sa/CPad.cpp +++ b/plugin_sa/game_sa/CPad.cpp @@ -149,8 +149,8 @@ bool CPad::ExitVehicleJustDown() { } // Converted from thiscall uchar CPad::GetMeleeAttack(void) 0x540340 -unsigned char CPad::GetMeleeAttack() { - return plugin::CallMethodAndReturn(this, 0); +unsigned char CPad::GetMeleeAttack(bool checkButtonCircleStateOnly) { + return plugin::CallMethodAndReturn(this, checkButtonCircleStateOnly); } // Converted from thiscall uchar CPad::MeleeAttackJustDown(void) 0x540390 diff --git a/plugin_sa/game_sa/CPad.h b/plugin_sa/game_sa/CPad.h index 76320af5f..9f9290043 100644 --- a/plugin_sa/game_sa/CPad.h +++ b/plugin_sa/game_sa/CPad.h @@ -292,7 +292,7 @@ class CPad { short GetBrake(); bool GetExitVehicle(); bool ExitVehicleJustDown(); - unsigned char GetMeleeAttack(); + unsigned char GetMeleeAttack(bool checkButtonCircleStateOnly = false); unsigned char MeleeAttackJustDown(); short GetAccelerate(); bool GetAccelerateJustDown(); diff --git a/plugin_sa/game_sa/CPlaceable.cpp b/plugin_sa/game_sa/CPlaceable.cpp index 6be72de73..d0d290ae5 100644 --- a/plugin_sa/game_sa/CPlaceable.cpp +++ b/plugin_sa/game_sa/CPlaceable.cpp @@ -99,10 +99,18 @@ void CPlaceable::GetOrientation(float& x, float& y, float& z) x = asinf(this->m_matrix->up.z); float cosx = cosf(x); - float cosy = this->m_matrix->at.z / cosx; - y = acosf(cosy); - float cosz = this->m_matrix->up.y / cosx; - z = acosf(cosz); + if (cosx != 0.0f) + { + float cosy = this->m_matrix->at.z / cosx; + y = acosf(cosy); + float cosz = this->m_matrix->up.y / cosx; + z = acosf(cosz); + } + else + { + y = 0.0f; + z = 0.0f; + } } else { diff --git a/plugin_sa/game_sa/CPostEffects.cpp b/plugin_sa/game_sa/CPostEffects.cpp index 00ee92dd3..f3445355c 100644 --- a/plugin_sa/game_sa/CPostEffects.cpp +++ b/plugin_sa/game_sa/CPostEffects.cpp @@ -309,7 +309,7 @@ void CPostEffects::ColourFilter(RwRGBA col1, RwRGBA col2) { // 0x702080 void CPostEffects::Radiosity(int32_t intensityLimit, int32_t filterPasses, int32_t renderPasses, int32_t intensity) { - plugin::Call<0x702080>(); + plugin::Call<0x702080, int32_t>(intensityLimit, filterPasses, renderPasses, intensity); } // 0x700BE0 diff --git a/plugin_sa/game_sa/CRestart.cpp b/plugin_sa/game_sa/CRestart.cpp index 7c09bc08f..38d49c08c 100644 --- a/plugin_sa/game_sa/CRestart.cpp +++ b/plugin_sa/game_sa/CRestart.cpp @@ -61,10 +61,10 @@ void CRestart::OverrideNextRestart(CVector const& point, float angle) void CRestart::Save() { - ((void(__cdecl *)())0x460780)(); + ((void(__cdecl *)())0x5D3620)(); } void CRestart::SetRespawnPointForDurationOfMission(CVector point) { - ((void(__cdecl *)())0x460780)(); + ((void(__cdecl *)(CVector))0x460810)(point); } \ No newline at end of file diff --git a/plugin_sa/game_sa/CStore.h b/plugin_sa/game_sa/CStore.h index 1c1f2548b..5d7a6b12a 100644 --- a/plugin_sa/game_sa/CStore.h +++ b/plugin_sa/game_sa/CStore.h @@ -18,7 +18,7 @@ class CStore { } ObjectType* Alloc() { - if (count <= Capacity) + if (count < Capacity) return &objects[count++]; return nullptr; diff --git a/plugin_sa/game_sa/CStuntJumpManager.cpp b/plugin_sa/game_sa/CStuntJumpManager.cpp index 84ac8f17f..b0b5d9534 100644 --- a/plugin_sa/game_sa/CStuntJumpManager.cpp +++ b/plugin_sa/game_sa/CStuntJumpManager.cpp @@ -13,5 +13,5 @@ bool CStuntJumpManager::Save() { // 0x5D5920 bool CStuntJumpManager::Load() { - return plugin::CallAndReturn(); + return plugin::CallAndReturn(); } \ No newline at end of file diff --git a/plugin_sa/game_sa/CVehicle.cpp b/plugin_sa/game_sa/CVehicle.cpp index 833faedc1..788c8c379 100644 --- a/plugin_sa/game_sa/CVehicle.cpp +++ b/plugin_sa/game_sa/CVehicle.cpp @@ -783,9 +783,9 @@ void CVehicle::RemoveReplacementUpgrade(int nodeId) } // Converted from thiscall void CVehicle::GetReplacementUpgrade(int nodeId) 0x6D3A50 -void CVehicle::GetReplacementUpgrade(int nodeId) +int CVehicle::GetReplacementUpgrade(int nodeId) { - ((void (__thiscall *)(CVehicle*, int))0x6D3A50)(this, nodeId); + return ((int (__thiscall *)(CVehicle*, int))0x6D3A50)(this, nodeId); } // Converted from thiscall void CVehicle::RemoveAllUpgrades(void) 0x6D3AB0 diff --git a/plugin_sa/game_sa/CVehicle.h b/plugin_sa/game_sa/CVehicle.h index d7eba659d..11eeb7e44 100644 --- a/plugin_sa/game_sa/CVehicle.h +++ b/plugin_sa/game_sa/CVehicle.h @@ -465,7 +465,7 @@ class PLUGIN_API CVehicle : public CPhysical { void AddReplacementUpgrade(int modelIndex, int nodeId); void RemoveReplacementUpgrade(int nodeId); // return upgrade model id or -1 if not present - void GetReplacementUpgrade(int nodeId); + int GetReplacementUpgrade(int nodeId); void RemoveAllUpgrades(); int GetSpareHasslePosId(); void SetHasslePosId(int hasslePos, bool enable);