64-bit on Windows

This commit is contained in:
eray orçunus 2020-07-22 14:56:28 +03:00
parent afc38c0d72
commit 1dc6fbda1f
51 changed files with 13355 additions and 87 deletions

View file

@ -45,7 +45,7 @@ int32 CStreaming::ms_oldSectorX;
int32 CStreaming::ms_oldSectorY;
int32 CStreaming::ms_streamingBufferSize;
int8 *CStreaming::ms_pStreamingBuffer[2];
int32 CStreaming::ms_memoryUsed;
size_t CStreaming::ms_memoryUsed;
CStreamingChannel CStreaming::ms_channel[2];
int32 CStreaming::ms_channelError;
int32 CStreaming::ms_numVehiclesLoaded;
@ -62,7 +62,7 @@ uint16 CStreaming::ms_loadedGangCars;
int32 CStreaming::ms_imageOffsets[NUMCDIMAGES];
int32 CStreaming::ms_lastImageRead;
int32 CStreaming::ms_imageSize;
uint32 CStreaming::ms_memoryAvailable;
size_t CStreaming::ms_memoryAvailable;
int32 desiredNumVehiclesLoaded = 12;
@ -202,14 +202,19 @@ CStreaming::Init2(void)
// PC only, figure out how much memory we got
#ifdef GTA_PC
#define MB (1024*1024)
extern unsigned long _dwMemAvailPhys;
extern size_t _dwMemAvailPhys;
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
if(ms_memoryAvailable < 50*MB)
ms_memoryAvailable = 50*MB;
desiredNumVehiclesLoaded = (ms_memoryAvailable/MB - 50)/3 + 12;
desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
#if defined(__LP64__) || defined(_WIN64)
debug("Memory allocated to Streaming is %lluMB", ms_memoryAvailable/MB);
#else
debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable/MB);
#endif
#undef MB
#endif
@ -1085,7 +1090,7 @@ CStreaming::RemoveAllUnusedModels(void)
}
bool
CStreaming::RemoveReferencedTxds(int32 mem)
CStreaming::RemoveReferencedTxds(size_t mem)
{
CStreamingInfo *si;
int streamId;
@ -2201,7 +2206,7 @@ CStreaming::DeleteRwObjectsAfterDeath(const CVector &pos)
}
void
CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
{
int ix, iy;
int x, y;
@ -2382,7 +2387,7 @@ CStreaming::DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y)
}
bool
CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem)
CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem)
{
CPtrNode *node;
CEntity *e;
@ -2403,7 +2408,7 @@ CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem)
}
bool
CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem)
CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem)
{
CPtrNode *node;
CEntity *e;
@ -2430,7 +2435,7 @@ CStreaming::MakeSpaceFor(int32 size)
// the code still happens to work in that case because ms_memoryAvailable is unsigned
// but it's not nice....
while((uint32)ms_memoryUsed >= ms_memoryAvailable - size)
while(ms_memoryUsed >= ms_memoryAvailable - size)
if(!RemoveLeastUsedModel()){
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
return;
@ -2492,7 +2497,11 @@ CStreaming::UpdateForAnimViewer(void)
if (CStreaming::ms_channelError == -1) {
CStreaming::AddModelsToRequestList(CVector(0.0f, 0.0f, 0.0f));
CStreaming::LoadRequestedModels();
#if defined(__LP64__) || defined(_WIN64)
sprintf(gString, "Requested %d, memory size %lluK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
#else
sprintf(gString, "Requested %d, memory size %dK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
#endif
}
else {
CStreaming::RetryLoadFile(CStreaming::ms_channelError);