From a5ba53896881ec479f9819ab0349437de4c3f4ed Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 23 Jun 2019 13:11:41 +0200 Subject: some Radar and Hud cleanup; fix in Physical --- src/Streaming.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Streaming.h') diff --git a/src/Streaming.h b/src/Streaming.h index 93c2e73e..fc14829c 100644 --- a/src/Streaming.h +++ b/src/Streaming.h @@ -111,6 +111,7 @@ public: static void RequestSpecialModel(int32 modelId, const char *modelName, int32 flags); static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags); static void RemoveModel(int32 id); + static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); } static bool IsTxdUsedByRequestedModels(int32 txdId); static bool AddToLoadedVehiclesList(int32 modelId); -- cgit v1.2.3 From db2e2575c8c1c23f153571ae1df1bb77dbe76821 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 24 Jun 2019 18:44:23 +0200 Subject: more CStreaming --- src/Streaming.h | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'src/Streaming.h') diff --git a/src/Streaming.h b/src/Streaming.h index fc14829c..62d0c2fb 100644 --- a/src/Streaming.h +++ b/src/Streaming.h @@ -14,6 +14,7 @@ enum StreamFlags STREAMFLAGS_PRIORITY = 0x08, STREAMFLAGS_NOFADE = 0x10, + // TODO: this isn't named well, maybe CANT_REMOVE? STREAMFLAGS_NOT_IN_LIST = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED, STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY, }; @@ -29,7 +30,10 @@ enum StreamLoadState enum ChannelState { - CHANNELSTATE_0 = 0, + CHANNELSTATE_IDLE = 0, + CHANNELSTATE_UNK1 = 1, + CHANNELSTATE_STARTED = 2, + CHANNELSTATE_ERROR = 3, }; class CStreamingInfo @@ -53,7 +57,7 @@ public: struct CStreamingChannel { - int32 modelIds[4]; + int32 streamIds[4]; int32 offsets[4]; int32 state; int32 field24; @@ -80,11 +84,13 @@ public: static int32 &ms_oldSectorX; static int32 &ms_oldSectorY; static uint32 &ms_streamingBufferSize; - static uint8 **ms_pStreamingBuffer; //[2] + static int8 **ms_pStreamingBuffer; //[2] static int32 &ms_memoryUsed; static CStreamingChannel *ms_channel; //[2] + static int32 &ms_channelError; static int32 &ms_numVehiclesLoaded; static int32 *ms_vehiclesLoaded; //[MAXVEHICLESLOADED] + static int32 &ms_lastVehicleDeleted; static CDirectory *&ms_pExtraObjectsDir; static int32 &ms_numPriorityRequests; static bool &ms_hasLoadedLODs; @@ -104,7 +110,9 @@ public: static bool ConvertBufferToObject(int8 *buf, int32 streamId); static bool FinishLoadingLargeFile(int8 *buf, int32 streamId); static void RequestModel(int32 model, int32 flags); + static void ReRequestModel(int32 model) { RequestModel(model, ms_aInfoForModel[model].m_flags); } static void RequestTxd(int32 txd, int32 flags) { RequestModel(txd + STREAM_OFFSET_TXD, flags); } + static void ReRequestTxd(int32 txd) { ReRequestModel(txd + STREAM_OFFSET_TXD); } static void RequestSubway(void); static void RequestBigBuildings(eLevelName level); static void RequestIslands(eLevelName level); @@ -112,12 +120,38 @@ public: static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags); static void RemoveModel(int32 id); static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); } - + static void RemoveUnusedBuildings(eLevelName level); + static void RemoveBuildings(eLevelName level); + static void RemoveUnusedBigBuildings(eLevelName level); + static void RemoveIslandsNotUsed(eLevelName level); + static void RemoveBigBuildings(eLevelName level); + static bool RemoveLoadedVehicle(void); + static bool RemoveLeastUsedModel(void); + static void RemoveAllUnusedModels(void); + static void RemoveUnusedModelsInLoadedList(void); + static bool RemoveReferencedTxds(int32 mem); + static int32 GetAvailableVehicleSlot(void); static bool IsTxdUsedByRequestedModels(int32 txdId); static bool AddToLoadedVehiclesList(int32 modelId); + static bool IsObjectInCdImage(int32 id); + static void HaveAllBigBuildingsLoaded(eLevelName level); + static void SetModelIsDeletable(int32 id); + static void SetModelTxdIsDeletable(int32 id); + static void SetMissionDoesntRequireModel(int32 id); + + static int32 GetNextFileOnCd(int32 position, bool priority); + static bool ProcessLoadingChannel(int32 ch); + static void RequestModelStream(int32 ch); + static void FlushChannels(void); + static void FlushRequestList(void); + static int32 GetCdImageOffset(int32 lastPosn); static void MakeSpaceFor(int32 size); static void ImGonnaUseStreamingMemory(void); static void IHaveUsedStreamingMemory(void); static void UpdateMemoryUsed(void); + + + static void LoadInitialPeds(void); + static void LoadInitialVehicles(void); }; -- cgit v1.2.3 From a91f40e79daff5ecf620fe892b0ddc30da6a2895 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 26 Jun 2019 16:49:32 +0200 Subject: CStreaming streams --- src/Streaming.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/Streaming.h') diff --git a/src/Streaming.h b/src/Streaming.h index 62d0c2fb..571a7194 100644 --- a/src/Streaming.h +++ b/src/Streaming.h @@ -24,14 +24,14 @@ enum StreamLoadState STREAMSTATE_NOTLOADED = 0, STREAMSTATE_LOADED = 1, STREAMSTATE_INQUEUE = 2, - STREAMSTATE_READING = 3, // what is this? - STREAMSTATE_STARTED = 4, // first part read + STREAMSTATE_READING = 3, // channel is reading + STREAMSTATE_STARTED = 4, // first part loaded }; enum ChannelState { CHANNELSTATE_IDLE = 0, - CHANNELSTATE_UNK1 = 1, + CHANNELSTATE_READING = 1, CHANNELSTATE_STARTED = 2, CHANNELSTATE_ERROR = 3, }; @@ -53,6 +53,7 @@ public: void AddToList(CStreamingInfo *link); void RemoveFromList(void); uint32 GetCdSize(void) { return m_size; } + bool IsPriority(void) { return !!(m_flags & STREAMFLAGS_PRIORITY); } }; struct CStreamingChannel @@ -63,7 +64,7 @@ struct CStreamingChannel int32 field24; int32 position; int32 size; - int32 field30; + int32 numTries; int32 status; // from CdStream }; @@ -83,7 +84,7 @@ public: static CStreamingInfo &ms_endRequestedList; static int32 &ms_oldSectorX; static int32 &ms_oldSectorY; - static uint32 &ms_streamingBufferSize; + static int32 &ms_streamingBufferSize; static int8 **ms_pStreamingBuffer; //[2] static int32 &ms_memoryUsed; static CStreamingChannel *ms_channel; //[2] @@ -118,6 +119,7 @@ public: static void RequestIslands(eLevelName level); static void RequestSpecialModel(int32 modelId, const char *modelName, int32 flags); static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags); + static void DecrementRef(int32 id); static void RemoveModel(int32 id); static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); } static void RemoveUnusedBuildings(eLevelName level); @@ -139,12 +141,14 @@ public: static void SetModelTxdIsDeletable(int32 id); static void SetMissionDoesntRequireModel(int32 id); + static int32 GetCdImageOffset(int32 lastPosn); static int32 GetNextFileOnCd(int32 position, bool priority); - static bool ProcessLoadingChannel(int32 ch); static void RequestModelStream(int32 ch); + static bool ProcessLoadingChannel(int32 ch); + static void LoadRequestedModels(void); + static void LoadAllRequestedModels(bool priority); static void FlushChannels(void); static void FlushRequestList(void); - static int32 GetCdImageOffset(int32 lastPosn); static void MakeSpaceFor(int32 size); static void ImGonnaUseStreamingMemory(void); -- cgit v1.2.3 From d9b3c82c5e43ef3cc271800ccd0fc79ead99c7b7 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 26 Jun 2019 21:33:58 +0200 Subject: some more CStreaming + fixes by erorcun --- src/Streaming.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Streaming.h') diff --git a/src/Streaming.h b/src/Streaming.h index 571a7194..75d53dcd 100644 --- a/src/Streaming.h +++ b/src/Streaming.h @@ -145,6 +145,7 @@ public: static int32 GetNextFileOnCd(int32 position, bool priority); static void RequestModelStream(int32 ch); static bool ProcessLoadingChannel(int32 ch); + static void RetryLoadFile(int32 ch); static void LoadRequestedModels(void); static void LoadAllRequestedModels(bool priority); static void FlushChannels(void); -- cgit v1.2.3