64-bit on Windows

This commit is contained in:
eray orçunus
2020-07-22 14:56:28 +03:00
parent 8117bcb56f
commit 732b760829
56 changed files with 13368 additions and 106 deletions

View File

@ -3376,15 +3376,15 @@ CCamera::LoadTrainCamNodes(char const *name)
char token[16] = { 0 };
char filename[16] = { 0 };
uint8 *buf;
int bufpos = 0;
size_t bufpos = 0;
int field = 0;
int tokpos = 0;
char c;
int i;
int len;
size_t len;
strcpy(filename, name);
len = strlen(filename);
len = (int)strlen(filename);
filename[len] = '.';
filename[len+1] = 'd';
filename[len+2] = 'a';

View File

@ -30,7 +30,8 @@ CDirectory::ReadDirFile(const char *filename)
bool
CDirectory::WriteDirFile(const char *filename)
{
int fd, n;
int fd;
size_t n;
fd = CFileMgr::OpenFileForWriting(filename);
n = CFileMgr::Write(fd, (char*)entries, numEntries*sizeof(DirectoryInfo));
CFileMgr::CloseFile(fd);

View File

@ -189,7 +189,7 @@ CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
// --MIAMI: Done
void
CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare)
CEventList::ReportCrimeForEvent(eEventType type, size_t crimeId, bool copsDontCare)
{
eCrimeType crime;
switch(type){
@ -227,10 +227,10 @@ CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCar
if(CWanted::WorkOutPolicePresence(playerCoors, 14.0f) != 0 ||
CGame::germanGame && (crime == CRIME_SHOOT_PED || crime == CRIME_SHOOT_COP || crime == CRIME_COP_BURNED || crime == CRIME_VEHICLE_BURNED)){
FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(crime, playerPedCoors, crimeId, copsDontCare);
FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(crime, playerPedCoors, (uint32)crimeId, copsDontCare);
FindPlayerPed()->m_pWanted->SetWantedLevelNoDrop(1);
}else
FindPlayerPed()->m_pWanted->RegisterCrime(crime, playerPedCoors, crimeId, copsDontCare);
FindPlayerPed()->m_pWanted->RegisterCrime(crime, playerPedCoors, (uint32)crimeId, copsDontCare);
if(type == EVENT_ASSAULT_POLICE)
FindPlayerPed()->SetWantedLevelNoDrop(1);

View File

@ -61,7 +61,7 @@ public:
static bool GetEvent(eEventType type, int32 *event);
static void ClearEvent(int32 event);
static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
static void ReportCrimeForEvent(eEventType type, int32, bool);
static void ReportCrimeForEvent(eEventType type, size_t, bool);
};
extern CEvent gaEvent[NUMEVENTS];

View File

@ -163,7 +163,7 @@ myfgets(char *buf, int len, int fd)
return buf;
}
static int
static size_t
myfread(void *buf, size_t elt, size_t n, int fd)
{
if(myfiles[fd].isText){
@ -184,7 +184,7 @@ myfread(void *buf, size_t elt, size_t n, int fd)
return fread(buf, elt, n, myfiles[fd].file);
}
static int
static size_t
myfwrite(void *buf, size_t elt, size_t n, int fd)
{
if(myfiles[fd].isText){
@ -265,11 +265,11 @@ CFileMgr::SetDirMyDocuments(void)
mychdir(_psGetUserFilesFolder());
}
int
size_t
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
{
int fd;
int n, len;
size_t n, len;
fd = myfopen(file, mode);
if(fd == 0)
@ -298,14 +298,14 @@ CFileMgr::OpenFileForWriting(const char *file)
return OpenFile(file, "wb");
}
int
CFileMgr::Read(int fd, const char *buf, int len)
size_t
CFileMgr::Read(int fd, const char *buf, size_t len)
{
return myfread((void*)buf, 1, len, fd);
}
int
CFileMgr::Write(int fd, const char *buf, int len)
size_t
CFileMgr::Write(int fd, const char *buf, size_t len)
{
return myfwrite((void*)buf, 1, len, fd);
}

View File

@ -9,12 +9,12 @@ public:
static void ChangeDir(const char *dir);
static void SetDir(const char *dir);
static void SetDirMyDocuments(void);
static int LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static size_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static int OpenFile(const char *file, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);
static int Read(int fd, const char *buf, int len);
static int Write(int fd, const char *buf, int len);
static size_t Read(int fd, const char *buf, size_t len);
static size_t Write(int fd, const char *buf, size_t len);
static bool Seek(int fd, int offset, int whence);
static bool ReadLine(int fd, char *buf, int len);
static int CloseFile(int fd);

View File

@ -2653,7 +2653,7 @@ CMenuManager::DrawPlayerSetupScreen()
char nameTemp[256];
for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin; m_pSelectedSkin = m_pSelectedSkin->nextSkin) {
// Drop extension
int oldLength = strlen(m_pSelectedSkin->skinNameDisplayed);
int oldLength = (int)strlen(m_pSelectedSkin->skinNameDisplayed);
m_pSelectedSkin->skinNameDisplayed[oldLength - 4] = '\0';
m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0';

View File

@ -362,7 +362,7 @@ bool CGame::Initialise(const char* datFile)
CStreaming::LoadInitialPeds();
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
printf("Streaming uses %dK of its memory", CStreaming::ms_memoryUsed / 1024);
printf("Streaming uses %zuK of its memory", CStreaming::ms_memoryUsed / 1024); // original modifier was %d
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
CAnimManager::LoadAnimFiles();
CStreaming::LoadInitialWeapons();

View File

@ -3028,7 +3028,7 @@ void CPad::ResetCheats(void)
char *CPad::EditString(char *pStr, int32 nSize)
{
int32 pos = strlen(pStr);
int32 pos = (int32)strlen(pStr);
// letters
for ( int32 i = 0; i < ('Z' - 'A' + 1); i++ )

View File

@ -44,7 +44,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;
@ -61,7 +61,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;
@ -200,9 +200,9 @@ CStreaming::Init2(void)
debug("Streaming buffer size is %d sectors", ms_streamingBufferSize);
#define MB (1024*1024)
ms_memoryAvailable = 65*MB;
ms_memoryAvailable = 65 * MB;
desiredNumVehiclesLoaded = 25;
debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable/MB);
debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable / MB);
#undef MB
// find island LODs
@ -2385,7 +2385,7 @@ CStreaming::DeleteRwObjectsAfterDeath(const CVector &pos)
}
void
CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
{
int ix, iy;
int x, y;
@ -2560,7 +2560,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;
@ -2581,7 +2581,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;
@ -2608,7 +2608,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(STREAMFLAGS_20)){
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
return;
@ -2699,7 +2699,8 @@ CStreaming::UpdateForAnimViewer(void)
if (CStreaming::ms_channelError == -1) {
CStreaming::AddModelsToRequestList(CVector(0.0f, 0.0f, 0.0f));
CStreaming::LoadRequestedModels();
sprintf(gString, "Requested %d, memory size %dK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
// original modifier was %d
sprintf(gString, "Requested %d, memory size %zuK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
}
else {
CStreaming::RetryLoadFile(CStreaming::ms_channelError);

View File

@ -89,7 +89,7 @@ public:
static int32 ms_oldSectorY;
static int32 ms_streamingBufferSize;
static int8 *ms_pStreamingBuffer[2];
static int32 ms_memoryUsed;
static size_t ms_memoryUsed;
static CStreamingChannel ms_channel[2];
static int32 ms_channelError;
static int32 ms_numVehiclesLoaded;
@ -106,7 +106,7 @@ public:
static int32 ms_imageOffsets[NUMCDIMAGES];
static int32 ms_lastImageRead;
static int32 ms_imageSize;
static uint32 ms_memoryAvailable;
static size_t ms_memoryAvailable;
static void Init(void);
static void Init2(void);
@ -193,11 +193,11 @@ public:
static void DeleteFarAwayRwObjects(const CVector &pos);
static void DeleteAllRwObjects(void);
static void DeleteRwObjectsAfterDeath(const CVector &pos);
static void DeleteRwObjectsBehindCamera(int32 mem);
static void DeleteRwObjectsBehindCamera(size_t mem);
static void DeleteRwObjectsInSectorList(CPtrList &list);
static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y);
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem);
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem);
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem);
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem);
static void LoadScene(const CVector &pos);
static void LoadSceneCollision(const CVector &pos);

View File

@ -17,7 +17,11 @@
#if defined _WIN32 && defined WITHD3D
#include <windows.h>
#ifndef USE_D3D9
#include <d3d8types.h>
#else
#include <d3d9types.h>
#endif
#endif
#include <rwcore.h>