From 61036779140610c81688a636c3226c46571dbbef Mon Sep 17 00:00:00 2001 From: withmorten Date: Wed, 13 Jan 2021 00:28:07 +0100 Subject: [PATCH] more securom fixes --- src/control/Replay.cpp | 20 ++++++++++---------- src/control/Replay.h | 6 +----- src/vehicles/Cranes.h | 2 +- src/vehicles/Heli.cpp | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 05880162..2e87d1a7 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1457,7 +1457,7 @@ void CReplay::SaveReplayToHD(void) CFileMgr::SetDir(""); } -void PlayReplayFromHD(void) +void CReplay::PlayReplayFromHD(void) { CFileMgr::SetDirMyDocuments(); int fr = CFileMgr::OpenFile("replay.rep", "rb"); @@ -1476,17 +1476,17 @@ void PlayReplayFromHD(void) return; } int slot; - for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++) - CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK; - CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD; - while (slot < CReplay::NUM_REPLAYBUFFERS) - CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED; + for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++) + BufferStatus[slot] = REPLAYBUFFER_PLAYBACK; + BufferStatus[slot - 1] = REPLAYBUFFER_RECORD; + while (slot < NUM_REPLAYBUFFERS) + BufferStatus[slot++] = REPLAYBUFFER_UNUSED; CFileMgr::CloseFile(fr); CFileMgr::SetDir(""); - CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); - CReplay::bPlayingBackFromFile = true; - CReplay::bAllowLookAroundCam = true; - CReplay::StreamAllNecessaryCarsAndPeds(); + TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); + bPlayingBackFromFile = true; + bAllowLookAroundCam = true; + StreamAllNecessaryCarsAndPeds(); } void CReplay::StreamAllNecessaryCarsAndPeds(void) diff --git a/src/control/Replay.h b/src/control/Replay.h index aa2ecd86..68da9cc3 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -61,8 +61,6 @@ struct CStoredDetailedAnimationState uint16 aFlags2[NUM_PARTIAL_ANIMS_IN_REPLAY]; }; -void PlayReplayFromHD(void); - #ifdef GTA_REPLAY #define REPLAY_STUB #else @@ -323,11 +321,9 @@ private: static void EmptyAllPools(void); static void MarkEverythingAsNew(void); static void SaveReplayToHD(void); + static void PlayReplayFromHD(void); // out of class in III PC and later because of SecuROM static void FindFirstFocusCoordinate(CVector *coord); static void ProcessLookAroundCam(void); static size_t FindSizeOfPacket(uint8); - - /* Absolute nonsense, but how could this function end up being outside of class? */ - friend void PlayReplayFromHD(void); #endif }; diff --git a/src/vehicles/Cranes.h b/src/vehicles/Cranes.h index 0e134310..e9178105 100644 --- a/src/vehicles/Cranes.h +++ b/src/vehicles/Cranes.h @@ -89,7 +89,7 @@ public: static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle); static void Save(uint8* buf, uint32* size); - static void Load(uint8* buf, uint32 size); // on mobile it's CranesLoad outside of the class + static void Load(uint8* buf, uint32 size); // out of class in III PC and later because of SecuROM static uint32 CarsCollectedMilitaryCrane; static int32 NumCranes; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 56d6a8eb..44e9a73f 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -830,7 +830,7 @@ CHeli::GenerateHeli(bool catalina) id++; found = true; for(i = 0; i < 4; i++) - if(CHeli::pHelis[i] && CHeli::pHelis[i]->m_nHeliId == id) + if(pHelis[i] && pHelis[i]->m_nHeliId == id) found = false; } heli->m_nHeliId = id;