ps2 changes for renderer, rw, misc

This commit is contained in:
aap
2021-09-08 18:20:43 +02:00
parent b3b9db7ed6
commit 68c5795d65
12 changed files with 48 additions and 12 deletions
+5 -5
View File
@@ -60,21 +60,21 @@ public:
};
struct Particle {
int particleType;
CVector dir;
RwV3d dir;
float scale;
};
struct Attractor {
CVector dir;
RwV3d dir;
int8 type;
uint8 probability;
};
struct PedAttractor {
CVector queueDir;
CVector useDir;
RwV3d queueDir;
RwV3d useDir;
int8 type;
};
CVector pos;
RwV3d pos;
CRGBA col;
uint8 type;
union {
+4
View File
@@ -45,6 +45,10 @@ void cParticleSystemMgr::LoadParticleData()
++lineEnd;
int32 lineLength = lineEnd - lineStart;
#ifdef GTA_PS2
// CRs are left untouched. we assume every line ends in one
lineLength--;
#endif
ASSERT(lineLength < 500);
+1 -1
View File
@@ -63,7 +63,7 @@ int32 CRenderer::ms_nNoOfVisibleBuildings;
CEntity *CRenderer::ms_aVisibleBuildingPtrs[NUMVISIBLEENTITIES];
#endif
CVector CRenderer::ms_vecCameraPosition;
CVUVECTOR CRenderer::ms_vecCameraPosition;
CVehicle *CRenderer::m_pFirstPersonVehicle;
bool CRenderer::m_loadingPriority;
float CRenderer::ms_lodDistScale = 1.2f;
+1 -1
View File
@@ -47,7 +47,7 @@ class CRenderer
static CEntity *ms_aVisibleBuildingPtrs[NUMVISIBLEENTITIES];
#endif
static CVector ms_vecCameraPosition;
static CVUVECTOR ms_vecCameraPosition;
static CVehicle *m_pFirstPersonVehicle;
// unused
+3 -1
View File
@@ -5,6 +5,7 @@
#include "ModelInfo.h"
#include "Streaming.h"
#include "FileLoader.h"
#include "Collision.h"
#include "MemoryHeap.h"
// TODO(MIAMI)
@@ -41,6 +42,7 @@ CMemoryHeap::Init(uint32 total)
m_unkMemId = -1;
uint8 *mem = (uint8*)malloc(total);
assert(mem);
assert(((uintptr)mem & 0xF) == 0);
m_start = (HeapBlockDesc*)mem;
m_end = (HeapBlockDesc*)(mem + total - sizeof(HeapBlockDesc));
@@ -111,7 +113,7 @@ CMemoryHeap::Malloc(uint32 size)
// See if we can allocate from one of the fixed-size lists
for(int i = 0; i < NUM_FIXED_MEMBLOCKS; i++){
CommonSize *list = &m_fixedSize[i];
if(m_fixedSize[i].m_size == size){
if(list->m_size == size){
HeapBlockDesc *block = list->Malloc();
if(block){
RegisterMalloc(block);
+9 -1
View File
@@ -5,12 +5,20 @@
uint8 *pMemoryTop;
extern uint8 _end[];
extern uint8 _stack_size[];
void
InitMemoryMgr(void)
{
#ifdef USE_CUSTOM_ALLOCATOR
#ifdef GTA_PS2
#error "finish this"
// not quite clear what the 0x1000s and 0x10 are exactly
uint32 memUsed = (uint32)_end + (uint32)_stack_size + 0x1000 + 0x1000;
uint32 heapSize = 32*1024*1024 - memUsed - 0x10;
printf("Heap size: %d\n", heapSize);
gMainHeap.Init(heapSize);
#else
// randomly allocate 128mb
gMainHeap.Init(128*1024*1024);
+1 -1
View File
@@ -89,7 +89,7 @@ DefinedState(void)
rw::SetRenderState(rw::ALPHATESTREF, 3);
rw::SetRenderState(rw::GSALPHATEST, gPS2alphaTest);
#else
#elif defined(GTA_PC)
// D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
RwD3D8SetRenderState(D3DRS_ALPHAREF, 2);
+4
View File
@@ -46,15 +46,19 @@ RwTextureGtaStreamRead(RwStream *stream)
if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version))
return nil;
#ifdef GTA_PC
float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
#endif
if(!READNATIVE(stream, &tex, size))
return nil;
#ifdef GTA_PC
if (gGameState == GS_INIT_PLAYING_GAME) {
texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
texNumLoaded++;
}
#endif
#ifdef ANISOTROPIC_FILTERING
if(tex && RpAnisotGetMaxSupportedMaxAnisotropy() > 1) // BUG? this was RpAnisotTextureGetMaxAnisotropy, but that doesn't make much sense
+2
View File
@@ -143,7 +143,9 @@ CTxdStore::LoadTxd(int slot, const char *filename)
bool ret;
ret = false;
#ifdef GTA_PC
_rwD3D8TexDictionaryEnableRasterFormatConversion(true);
#endif
do
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, filename);
while(stream == nil);
+3
View File
@@ -1,3 +1,5 @@
#ifndef GTA_PS2
#include <time.h>
#include <limits.h>
@@ -186,3 +188,4 @@ void GetDateFormat(int, int, SYSTEMTIME*, int, char*, int);
#define GLFW_GAMEPAD_BUTTON_Y 2
#endif
#endif
+8
View File
@@ -39,7 +39,15 @@ CText::Load(void)
CFileMgr::SetDir("TEXT");
switch(FrontEndMenuManager.m_PrefsLanguage){
case CMenuManager::LANGUAGE_AMERICAN:
#ifdef GTA_PS2
#ifdef GTA_PAL
sprintf(filename, "ENGLISH.GXT");
#else
sprintf(filename, "AMERICAN.GXT");
#endif
#else
sprintf(filename, "AMERICAN.GXT");
#endif
break;
case CMenuManager::LANGUAGE_FRENCH:
sprintf(filename, "FRENCH.GXT");
+7 -2
View File
@@ -165,8 +165,13 @@ cHandlingDataMgr::LoadHandlingData(void)
while(*end != '\n') end++;
// get line
strncpy(line, start, end - start);
line[end - start] = '\0';
int32 lineLength = end - start;
#ifdef GTA_PS2
// CRs are left untouched. we assume every line ends in one
lineLength--;
#endif
strncpy(line, start, lineLength);
line[lineLength] = '\0';
start = end+1;
end = start+1;