From 37691701138c8a458bc8b41944745000d27a3b83 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Thu, 9 Apr 2020 02:52:38 +0300 Subject: (PS2) TheGame/main/GameInit/SystemInit, ProcessSlowMode --- src/save/GenericGameStorage.cpp | 7 +++++++ src/save/GenericGameStorage.h | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'src/save') diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index d71b0c22..2545b9ab 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -48,6 +48,13 @@ char SaveFileNameJustSaved[260]; int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C; CDate &CompileDateAndTime = *(CDate*)0x72BCB8; + +bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8; +bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4; +bool &StillToFadeOut = *(bool*)0x95CD99; +uint32 &TimeStartedCountingForFade = *(uint32*)0x9430EC; +uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564; + #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h index e22dfc7e..40d92f16 100644 --- a/src/save/GenericGameStorage.h +++ b/src/save/GenericGameStorage.h @@ -32,6 +32,12 @@ extern int &CheckSum; extern enum eLevelName &m_LevelToLoad; extern int (&Slots)[SLOT_COUNT+1]; +extern bool &b_FoundRecentSavedGameWantToLoad; +extern bool &JustLoadedDontFadeInYet; +extern bool &StillToFadeOut; +extern uint32 &TimeStartedCountingForFade; +extern uint32 &TimeToStayFadedBeforeFadeOut; + extern char SaveFileNameJustSaved[260]; // 8F2570 const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; \ No newline at end of file -- cgit v1.2.3 From 34349c4df2683fca35be37ec626aaa8eef2ddaee Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 9 Apr 2020 20:50:24 +0200 Subject: normalized line endings to LF --- src/save/Date.h | 34 +++++++++--------- src/save/GenericGameStorage.h | 84 +++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 59 deletions(-) (limited to 'src/save') diff --git a/src/save/Date.h b/src/save/Date.h index 3e022d09..15646c23 100644 --- a/src/save/Date.h +++ b/src/save/Date.h @@ -1,18 +1,18 @@ -#pragma once - -class CDate -{ -public: - int m_nSecond; - int m_nMinute; - int m_nHour; - int m_nDay; - int m_nMonth; - int m_nYear; - - CDate(); - bool operator>(const CDate &right); - bool operator<(const CDate &right); - bool operator==(const CDate &right); - void PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year); +#pragma once + +class CDate +{ +public: + int m_nSecond; + int m_nMinute; + int m_nHour; + int m_nDay; + int m_nMonth; + int m_nYear; + + CDate(); + bool operator>(const CDate &right); + bool operator<(const CDate &right); + bool operator==(const CDate &right); + void PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year); }; \ No newline at end of file diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h index 40d92f16..e6fd2e2d 100644 --- a/src/save/GenericGameStorage.h +++ b/src/save/GenericGameStorage.h @@ -1,43 +1,43 @@ -#pragma once - -#include "PCSave.h" - -#define SLOT_COUNT (8) - -bool GenericSave(int file); -bool GenericLoad(); -bool ReadInSizeofSaveFileBuffer(int32 &file, uint32 &size); -bool ReadDataFromFile(int32 file, uint8 *buf, uint32 size); -bool CloseFile(int32 file); -void DoGameSpecificStuffAfterSucessLoad(); -bool CheckSlotDataValid(int32 slot); -void MakeSpaceForSizeInBufferPointer(uint8 *&presize, uint8 *&buf, uint8 *&postsize); -void CopySizeAndPreparePointer(uint8 *&buf, uint8 *&postbuf, uint8 *&postbuf2, uint32 &unused, uint32 &size); -void DoGameSpecificStuffBeforeSave(); -void MakeValidSaveName(int32 slot); -wchar *GetSavedGameDateAndTime(int32 slot); -wchar *GetNameOfSavedGame(int32 slot); -bool CheckDataNotCorrupt(int32 slot, char *name); -bool RestoreForStartLoad(); -int align4bytes(int32 size); - -extern class CDate& CompileDateAndTime; - -extern char (&DefaultPCSaveFileName)[260]; -extern char (&ValidSaveName)[260]; -extern char (&LoadFileName)[256]; -extern wchar (&SlotFileName)[SLOT_COUNT][260]; -extern wchar (&SlotSaveDate)[SLOT_COUNT][70]; -extern int &CheckSum; -extern enum eLevelName &m_LevelToLoad; -extern int (&Slots)[SLOT_COUNT+1]; - -extern bool &b_FoundRecentSavedGameWantToLoad; -extern bool &JustLoadedDontFadeInYet; -extern bool &StillToFadeOut; -extern uint32 &TimeStartedCountingForFade; -extern uint32 &TimeToStayFadedBeforeFadeOut; - -extern char SaveFileNameJustSaved[260]; // 8F2570 - +#pragma once + +#include "PCSave.h" + +#define SLOT_COUNT (8) + +bool GenericSave(int file); +bool GenericLoad(); +bool ReadInSizeofSaveFileBuffer(int32 &file, uint32 &size); +bool ReadDataFromFile(int32 file, uint8 *buf, uint32 size); +bool CloseFile(int32 file); +void DoGameSpecificStuffAfterSucessLoad(); +bool CheckSlotDataValid(int32 slot); +void MakeSpaceForSizeInBufferPointer(uint8 *&presize, uint8 *&buf, uint8 *&postsize); +void CopySizeAndPreparePointer(uint8 *&buf, uint8 *&postbuf, uint8 *&postbuf2, uint32 &unused, uint32 &size); +void DoGameSpecificStuffBeforeSave(); +void MakeValidSaveName(int32 slot); +wchar *GetSavedGameDateAndTime(int32 slot); +wchar *GetNameOfSavedGame(int32 slot); +bool CheckDataNotCorrupt(int32 slot, char *name); +bool RestoreForStartLoad(); +int align4bytes(int32 size); + +extern class CDate& CompileDateAndTime; + +extern char (&DefaultPCSaveFileName)[260]; +extern char (&ValidSaveName)[260]; +extern char (&LoadFileName)[256]; +extern wchar (&SlotFileName)[SLOT_COUNT][260]; +extern wchar (&SlotSaveDate)[SLOT_COUNT][70]; +extern int &CheckSum; +extern enum eLevelName &m_LevelToLoad; +extern int (&Slots)[SLOT_COUNT+1]; + +extern bool &b_FoundRecentSavedGameWantToLoad; +extern bool &JustLoadedDontFadeInYet; +extern bool &StillToFadeOut; +extern uint32 &TimeStartedCountingForFade; +extern uint32 &TimeToStayFadedBeforeFadeOut; + +extern char SaveFileNameJustSaved[260]; // 8F2570 + const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; \ No newline at end of file -- cgit v1.2.3 From dbf6e155ff030e8c6c332e68678b943a70a077cf Mon Sep 17 00:00:00 2001 From: Wes Hampson Date: Sun, 12 Apr 2020 15:47:12 -0700 Subject: GenericLoad() done --- src/save/GenericGameStorage.cpp | 160 +++++++++++++++++++++++++++++++++------- 1 file changed, 135 insertions(+), 25 deletions(-) (limited to 'src/save') diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 2545b9ab..eb9092c3 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -9,11 +9,13 @@ #include "Clock.h" #include "Date.h" #include "FileMgr.h" +#include "Frontend.h" #include "GameLogic.h" #include "Gangs.h" #include "Garages.h" #include "GenericGameStorage.h" #include "Pad.h" +#include "Particle.h" #include "ParticleObject.h" #include "PathFind.h" #include "PCSave.h" @@ -48,7 +50,6 @@ char SaveFileNameJustSaved[260]; int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C; CDate &CompileDateAndTime = *(CDate*)0x72BCB8; - bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8; bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4; bool &StillToFadeOut = *(bool*)0x95CD99; @@ -58,10 +59,22 @@ uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564; #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); -WRAPPER bool GenericLoad() { EAXJMP(0x590A00); } - +#define LoadSaveDataBlock(msg,load_func)\ +do {\ + if (!ReadDataFromFile(file, (uint8 *) &size, 4))\ + return false;\ + size = align4bytes(size);\ + if (!ReadDataFromFile(file, work_buff, size))\ + return false;\ + buf = work_buff;\ + printf(msg);\ + ReadDataFromBufferPointer(buf, size);\ + load_func(buf, size);\ + size = align4bytes(size);\ + buf += size;\ +} while (0) -#define WRITE_BLOCK(save_func)\ +#define WriteSaveDataBlock(save_func)\ do {\ buf = work_buff;\ reserved = 0;\ @@ -138,7 +151,6 @@ GenericSave(int file) WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList); WriteDataToBufferPointer(buf, TheCamera.CarZoomIndicator); WriteDataToBufferPointer(buf, TheCamera.PedZoomIndicator); - assert(buf - work_buff == SIZE_OF_SIMPLEVARS); // Save scripts, block is nested within the same block as simple vars for some reason @@ -153,25 +165,25 @@ GenericSave(int file) totalSize = buf - work_buff; // Save the rest - WRITE_BLOCK(CPools::SavePedPool); - WRITE_BLOCK(CGarages::Save); - WRITE_BLOCK(CPools::SaveVehiclePool); - WRITE_BLOCK(CPools::SaveObjectPool); - WRITE_BLOCK(ThePaths.Save); - WRITE_BLOCK(CCranes::Save); - WRITE_BLOCK(CPickups::Save); - WRITE_BLOCK(gPhoneInfo.Save); - WRITE_BLOCK(CRestart::SaveAllRestartPoints); - WRITE_BLOCK(CRadar::SaveAllRadarBlips); - WRITE_BLOCK(CTheZones::SaveAllZones); - WRITE_BLOCK(CGangs::SaveAllGangData); - WRITE_BLOCK(CTheCarGenerators::SaveAllCarGenerators); - WRITE_BLOCK(CParticleObject::SaveParticle); - WRITE_BLOCK(cAudioScriptObject::SaveAllAudioScriptObjects); - WRITE_BLOCK(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo); - WRITE_BLOCK(CStats::SaveStats); - WRITE_BLOCK(CStreaming::MemoryCardSave); - WRITE_BLOCK(CPedType::Save); + WriteSaveDataBlock(CPools::SavePedPool); + WriteSaveDataBlock(CGarages::Save); + WriteSaveDataBlock(CPools::SaveVehiclePool); + WriteSaveDataBlock(CPools::SaveObjectPool); + WriteSaveDataBlock(ThePaths.Save); + WriteSaveDataBlock(CCranes::Save); + WriteSaveDataBlock(CPickups::Save); + WriteSaveDataBlock(gPhoneInfo.Save); + WriteSaveDataBlock(CRestart::SaveAllRestartPoints); + WriteSaveDataBlock(CRadar::SaveAllRadarBlips); + WriteSaveDataBlock(CTheZones::SaveAllZones); + WriteSaveDataBlock(CGangs::SaveAllGangData); + WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators); + WriteSaveDataBlock(CParticleObject::SaveParticle); + WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects); + WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo); + WriteSaveDataBlock(CStats::SaveStats); + WriteSaveDataBlock(CStreaming::MemoryCardSave); + WriteSaveDataBlock(CPedType::Save); // Write padding for (int i = 0; i < 4; i++) { @@ -198,6 +210,104 @@ GenericSave(int file) return true; } +bool +GenericLoad() +{ + uint8 *buf; + int32 file; + uint32 size; + + int32 saveSize; + CPad *currPad; + + uint32 timeInMilliseconds; + float timeScale; + float timeStep; + float timeStepNonClipped; + uint32 frameCounter; + + // Load SimpleVars and Scripts + CheckSum = 0; + CDate(CompileDateAndTime); + CPad::ResetCheats(); + if (!ReadInSizeofSaveFileBuffer(file, size)) + return false; + size = align4bytes(size); + ReadDataFromFile(file, work_buff, size); + buf = (work_buff + 0x40); + ReadDataFromBufferPointer(buf, saveSize); + ReadDataFromBufferPointer(buf, CGame::currLevel); + ReadDataFromBufferPointer(buf, TheCamera.GetPosition().x); + ReadDataFromBufferPointer(buf, TheCamera.GetPosition().y); + ReadDataFromBufferPointer(buf, TheCamera.GetPosition().z); + ReadDataFromBufferPointer(buf, CClock::ms_nMillisecondsPerGameMinute); + ReadDataFromBufferPointer(buf, CClock::ms_nLastClockTick); + ReadDataFromBufferPointer(buf, CClock::ms_nGameClockHours); + ReadDataFromBufferPointer(buf, CClock::ms_nGameClockMinutes); + currPad = CPad::GetPad(0); + ReadDataFromBufferPointer(buf, currPad->Mode); + ReadDataFromBufferPointer(buf, timeInMilliseconds); CTimer::SetTimeInMilliseconds(timeInMilliseconds); + ReadDataFromBufferPointer(buf, timeScale); CTimer::SetTimeScale(timeScale); + ReadDataFromBufferPointer(buf, timeStep); CTimer::SetTimeStep(timeStep); + ReadDataFromBufferPointer(buf, timeStepNonClipped); CTimer::SetTimeInMillisecondsNonClipped(timeStepNonClipped); + ReadDataFromBufferPointer(buf, frameCounter); CTimer::SetFrameCounter(frameCounter); + ReadDataFromBufferPointer(buf, CTimeStep::ms_fTimeStep); + ReadDataFromBufferPointer(buf, CTimeStep::ms_fFramesPerUpdate); + ReadDataFromBufferPointer(buf, CTimeStep::ms_fTimeScale); + ReadDataFromBufferPointer(buf, CWeather::OldWeatherType); + ReadDataFromBufferPointer(buf, CWeather::NewWeatherType); + ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType); + ReadDataFromBufferPointer(buf, CWeather::InterpolationValue); + ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nSecond); + ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMinute); + ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nHour); + ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nDay); + ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMonth); + ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nYear); + ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList); + ReadDataFromBufferPointer(buf, TheCamera.CarZoomIndicator); + ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator); + assert(buf - work_buff == SIZE_OF_SIMPLEVARS); + printf("Loading Scripts \n"); + ReadDataFromBufferPointer(buf, size); + CTheScripts::LoadAllScripts(buf, size); + size = align4bytes(size); + buf += size; + + // Load the rest + LoadSaveDataBlock("Loading PedPool \n", CPools::LoadPedPool); + LoadSaveDataBlock("Loading Garages \n", CGarages::Load); + LoadSaveDataBlock("Loading Vehicles \n", CPools::LoadVehiclePool); + LoadSaveDataBlock("Loading Objects \n", CPools::LoadObjectPool); + LoadSaveDataBlock("Loading Paths \n", ThePaths.Load); + LoadSaveDataBlock("Loading Cranes \n", CranesLoad); + LoadSaveDataBlock("Loading Pickups \n", CPickups::Load); + LoadSaveDataBlock("Loading Phoneinfo \n", gPhoneInfo.Load); + LoadSaveDataBlock("Loading Restart \n", CRestart::LoadAllRestartPoints); + LoadSaveDataBlock("Loading Radar Blips \n", CRadar::LoadAllRadarBlips); + LoadSaveDataBlock("Loading Zones \n", CTheZones::LoadAllZones); + LoadSaveDataBlock("Loading Gang Data \n", CGangs::LoadAllGangData); + LoadSaveDataBlock("Loading Car Generators \n", CTheCarGenerators::LoadAllCarGenerators); + CParticle::ReloadConfig(); + LoadSaveDataBlock("Loading Particles \n", CParticleObject::LoadParticle); + LoadSaveDataBlock("Loading AudioScript Objects \n", cAudioScriptObject::LoadAllAudioScriptObjects); + LoadSaveDataBlock("Loading Player Info \n", CWorld::Players[CWorld::PlayerInFocus].LoadPlayerInfo); + LoadSaveDataBlock("Loading Stats \n", CStats::LoadStats); + LoadSaveDataBlock("Loading Streaming Stuff \n", CStreaming::MemoryCardLoad); + LoadSaveDataBlock("Loading PedType Stuff \n", CPedType::Load); + + DMAudio.SetMusicMasterVolume(CMenuManager::m_PrefsMusicVolume); + DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume); + if (!CloseFile(file)) { + PcSaveHelper.nErrorCode = SAVESTATUS_ERR_LOAD_CLOSE; + return false; + } + DoGameSpecificStuffAfterSucessLoad(); + printf("Game successfully loaded \n"); + + return true; +} + bool ReadInSizeofSaveFileBuffer(int32 &file, uint32 &size) { @@ -411,7 +521,7 @@ align4bytes(int32 size) STARTPATCHES InjectHook(0x58F8D0, GenericSave, PATCH_JUMP); - //InjectHook(0x590A00, GenericLoad, PATCH_JUMP); + InjectHook(0x590A00, GenericLoad, PATCH_JUMP); InjectHook(0x591910, ReadInSizeofSaveFileBuffer, PATCH_JUMP); InjectHook(0x591990, ReadDataFromFile, PATCH_JUMP); InjectHook(0x591A00, CloseFile, PATCH_JUMP); -- cgit v1.2.3 From a19d5dbee146bef01ed44058d0498bce63b48279 Mon Sep 17 00:00:00 2001 From: Wes Hampson Date: Mon, 13 Apr 2020 11:20:57 -0700 Subject: Fixes --- src/save/GenericGameStorage.cpp | 104 +++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 44 deletions(-) (limited to 'src/save') diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index eb9092c3..4cfa75b3 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -22,6 +22,7 @@ #include "Phones.h" #include "Pickups.h" #include "PlayerPed.h" +#include "ProjectileInfo.h" #include "Pools.h" #include "Radar.h" #include "Restart.h" @@ -59,7 +60,7 @@ uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564; #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); -#define LoadSaveDataBlock(msg,load_func)\ +#define LoadSaveDataBlock()\ do {\ if (!ReadDataFromFile(file, (uint8 *) &size, 4))\ return false;\ @@ -67,7 +68,11 @@ do {\ if (!ReadDataFromFile(file, work_buff, size))\ return false;\ buf = work_buff;\ - printf(msg);\ +} while (0) + +#define ReadDataFromBlock(msg,load_func)\ +do {\ + debug(msg);\ ReadDataFromBufferPointer(buf, size);\ load_func(buf, size);\ size = align4bytes(size);\ @@ -130,11 +135,11 @@ GenericSave(int file) WriteDataToBufferPointer(buf, CClock::ms_nGameClockMinutes); currPad = CPad::GetPad(0); WriteDataToBufferPointer(buf, currPad->Mode); - WriteDataToBufferPointer(buf, CTimer::GetTimeInMilliseconds()); - WriteDataToBufferPointer(buf, CTimer::GetTimeScale()); - WriteDataToBufferPointer(buf, CTimer::GetTimeStep()); - WriteDataToBufferPointer(buf, CTimer::GetTimeStepNonClipped()); - WriteDataToBufferPointer(buf, CTimer::GetFrameCounter()); + WriteDataToBufferPointer(buf, CTimer::m_snTimeInMilliseconds); + WriteDataToBufferPointer(buf, CTimer::ms_fTimeScale); + WriteDataToBufferPointer(buf, CTimer::ms_fTimeStep); + WriteDataToBufferPointer(buf, CTimer::ms_fTimeStepNonClipped); + WriteDataToBufferPointer(buf, CTimer::m_FrameCounter); WriteDataToBufferPointer(buf, CTimeStep::ms_fTimeStep); WriteDataToBufferPointer(buf, CTimeStep::ms_fFramesPerUpdate); WriteDataToBufferPointer(buf, CTimeStep::ms_fTimeScale); @@ -220,12 +225,6 @@ GenericLoad() int32 saveSize; CPad *currPad; - uint32 timeInMilliseconds; - float timeScale; - float timeStep; - float timeStepNonClipped; - uint32 frameCounter; - // Load SimpleVars and Scripts CheckSum = 0; CDate(CompileDateAndTime); @@ -246,11 +245,11 @@ GenericLoad() ReadDataFromBufferPointer(buf, CClock::ms_nGameClockMinutes); currPad = CPad::GetPad(0); ReadDataFromBufferPointer(buf, currPad->Mode); - ReadDataFromBufferPointer(buf, timeInMilliseconds); CTimer::SetTimeInMilliseconds(timeInMilliseconds); - ReadDataFromBufferPointer(buf, timeScale); CTimer::SetTimeScale(timeScale); - ReadDataFromBufferPointer(buf, timeStep); CTimer::SetTimeStep(timeStep); - ReadDataFromBufferPointer(buf, timeStepNonClipped); CTimer::SetTimeInMillisecondsNonClipped(timeStepNonClipped); - ReadDataFromBufferPointer(buf, frameCounter); CTimer::SetFrameCounter(frameCounter); + ReadDataFromBufferPointer(buf, CTimer::m_snTimeInMilliseconds); + ReadDataFromBufferPointer(buf, CTimer::ms_fTimeScale); + ReadDataFromBufferPointer(buf, CTimer::ms_fTimeStep); + ReadDataFromBufferPointer(buf, CTimer::ms_fTimeStepNonClipped); + ReadDataFromBufferPointer(buf, CTimer::m_FrameCounter); ReadDataFromBufferPointer(buf, CTimeStep::ms_fTimeStep); ReadDataFromBufferPointer(buf, CTimeStep::ms_fFramesPerUpdate); ReadDataFromBufferPointer(buf, CTimeStep::ms_fTimeScale); @@ -268,33 +267,50 @@ GenericLoad() ReadDataFromBufferPointer(buf, TheCamera.CarZoomIndicator); ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator); assert(buf - work_buff == SIZE_OF_SIMPLEVARS); - printf("Loading Scripts \n"); - ReadDataFromBufferPointer(buf, size); - CTheScripts::LoadAllScripts(buf, size); - size = align4bytes(size); - buf += size; + ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts); // Load the rest - LoadSaveDataBlock("Loading PedPool \n", CPools::LoadPedPool); - LoadSaveDataBlock("Loading Garages \n", CGarages::Load); - LoadSaveDataBlock("Loading Vehicles \n", CPools::LoadVehiclePool); - LoadSaveDataBlock("Loading Objects \n", CPools::LoadObjectPool); - LoadSaveDataBlock("Loading Paths \n", ThePaths.Load); - LoadSaveDataBlock("Loading Cranes \n", CranesLoad); - LoadSaveDataBlock("Loading Pickups \n", CPickups::Load); - LoadSaveDataBlock("Loading Phoneinfo \n", gPhoneInfo.Load); - LoadSaveDataBlock("Loading Restart \n", CRestart::LoadAllRestartPoints); - LoadSaveDataBlock("Loading Radar Blips \n", CRadar::LoadAllRadarBlips); - LoadSaveDataBlock("Loading Zones \n", CTheZones::LoadAllZones); - LoadSaveDataBlock("Loading Gang Data \n", CGangs::LoadAllGangData); - LoadSaveDataBlock("Loading Car Generators \n", CTheCarGenerators::LoadAllCarGenerators); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading PedPool \n", CPools::LoadPedPool); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Garages \n", CGarages::Load); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Vehicles \n", CPools::LoadVehiclePool); + LoadSaveDataBlock(); + CProjectileInfo::RemoveAllProjectiles(); + CObject::DeleteAllTempObjects(); + ReadDataFromBlock("Loading Objects \n", CPools::LoadObjectPool); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Paths \n", ThePaths.Load); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Cranes \n", CranesLoad); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Pickups \n", CPickups::Load); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Phoneinfo \n", gPhoneInfo.Load); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Restart \n", CRestart::LoadAllRestartPoints); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Radar Blips \n", CRadar::LoadAllRadarBlips); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Zones \n", CTheZones::LoadAllZones); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Gang Data \n", CGangs::LoadAllGangData); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Car Generators \n", CTheCarGenerators::LoadAllCarGenerators); CParticle::ReloadConfig(); - LoadSaveDataBlock("Loading Particles \n", CParticleObject::LoadParticle); - LoadSaveDataBlock("Loading AudioScript Objects \n", cAudioScriptObject::LoadAllAudioScriptObjects); - LoadSaveDataBlock("Loading Player Info \n", CWorld::Players[CWorld::PlayerInFocus].LoadPlayerInfo); - LoadSaveDataBlock("Loading Stats \n", CStats::LoadStats); - LoadSaveDataBlock("Loading Streaming Stuff \n", CStreaming::MemoryCardLoad); - LoadSaveDataBlock("Loading PedType Stuff \n", CPedType::Load); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Particles \n", CParticleObject::LoadParticle); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading AudioScript Objects \n", cAudioScriptObject::LoadAllAudioScriptObjects); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Player Info \n", CWorld::Players[CWorld::PlayerInFocus].LoadPlayerInfo); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Stats \n", CStats::LoadStats); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading Streaming Stuff \n", CStreaming::MemoryCardLoad); + LoadSaveDataBlock(); + ReadDataFromBlock("Loading PedType Stuff \n", CPedType::Load); DMAudio.SetMusicMasterVolume(CMenuManager::m_PrefsMusicVolume); DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume); @@ -302,9 +318,9 @@ GenericLoad() PcSaveHelper.nErrorCode = SAVESTATUS_ERR_LOAD_CLOSE; return false; } - DoGameSpecificStuffAfterSucessLoad(); - printf("Game successfully loaded \n"); + DoGameSpecificStuffAfterSucessLoad(); + debug("Game successfully loaded \n"); return true; } -- cgit v1.2.3 From a19fa8764f63b4521873bbee8d2549c23d4be70a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 14 Apr 2020 13:08:03 +0300 Subject: CarGen, Cranes, Gangs: cleanup, fixes, r* visioned placement --- src/save/GenericGameStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/save') diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 4cfa75b3..0ec0b117 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -283,7 +283,7 @@ GenericLoad() LoadSaveDataBlock(); ReadDataFromBlock("Loading Paths \n", ThePaths.Load); LoadSaveDataBlock(); - ReadDataFromBlock("Loading Cranes \n", CranesLoad); + ReadDataFromBlock("Loading Cranes \n", CCranes::Load); LoadSaveDataBlock(); ReadDataFromBlock("Loading Pickups \n", CPickups::Load); LoadSaveDataBlock(); -- cgit v1.2.3