mirror of
https://github.com/GTAmodding/re3.git
synced 2025-07-15 13:24:08 +00:00
Merge remote-tracking branch 'origin/miami' into lcs
# Conflicts: # .github/workflows/reLCS_msvc_amd64.yml # .github/workflows/reLCS_msvc_x86.yml # README.md # gamefiles/TEXT/american.gxt # gamefiles/TEXT/french.gxt # gamefiles/TEXT/german.gxt # gamefiles/TEXT/italian.gxt # gamefiles/TEXT/spanish.gxt # premake5.lua # src/animation/AnimManager.cpp # src/animation/AnimationId.h # src/audio/MusicManager.cpp # src/audio/audio_enums.h # src/control/Script7.cpp # src/core/FileLoader.cpp # src/core/re3.cpp # src/extras/custompipes_d3d9.cpp # src/extras/custompipes_gl.cpp # src/extras/postfx.cpp # src/extras/shaders/colourfilterVC.frag # src/extras/shaders/colourfilterVC_PS.hlsl # src/extras/shaders/make_hlsl.cmd # src/extras/shaders/obj/colourfilterVC_PS.cso # src/extras/shaders/obj/colourfilterVC_PS.inc # src/extras/shaders/obj/colourfilterVC_frag.inc # src/peds/PedFight.cpp # src/render/Font.cpp # src/render/Hud.cpp # src/render/Particle.cpp # src/render/WaterCannon.cpp # src/skel/win/gtavc.ico # src/vehicles/Automobile.cpp # utils/gxt/american.txt # utils/gxt/french.txt # utils/gxt/german.txt # utils/gxt/italian.txt # utils/gxt/spanish.txt
This commit is contained in:
commit
e38467ef3a
114 changed files with 5143 additions and 2112 deletions
|
@ -214,11 +214,15 @@ CStreaming::Init2(void)
|
|||
|
||||
// allocate streaming buffers
|
||||
if(ms_streamingBufferSize & 1) ms_streamingBufferSize++;
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
ms_pStreamingBuffer[0] = (int8*)RwMallocAlign(ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
ms_streamingBufferSize /= 2;
|
||||
ms_pStreamingBuffer[1] = ms_pStreamingBuffer[0] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
ms_pStreamingBuffer[2] = (int8*)RwMallocAlign(ms_streamingBufferSize*2*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
#else
|
||||
ms_pStreamingBuffer[0] = (int8*)RwMallocAlign(ms_streamingBufferSize*2*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
ms_streamingBufferSize /= 2;
|
||||
ms_pStreamingBuffer[1] = ms_pStreamingBuffer[0] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
ms_pStreamingBuffer[2] = ms_pStreamingBuffer[1] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
ms_pStreamingBuffer[3] = ms_pStreamingBuffer[2] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
#endif
|
||||
debug("Streaming buffer size is %d sectors", ms_streamingBufferSize);
|
||||
|
@ -2344,9 +2348,10 @@ CStreaming::LoadRequestedModels(void)
|
|||
}
|
||||
|
||||
|
||||
// Let's load models first, then process it. Unfortunately processing models are still single-threaded.
|
||||
// Let's load models in 4 threads; when one of them becomes idle, process the file, and fill thread with another file. Unfortunately processing models are still single-threaded.
|
||||
// Currently only supported on POSIX streamer.
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
// WIP - some files are loaded swapped (CdStreamPosix problem?)
|
||||
#if 0 //def ONE_THREAD_PER_CHANNEL
|
||||
void
|
||||
CStreaming::LoadAllRequestedModels(bool priority)
|
||||
{
|
||||
|
@ -2365,14 +2370,18 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
|||
int streamIds[ARRAY_SIZE(ms_pStreamingBuffer)];
|
||||
int streamSizes[ARRAY_SIZE(ms_pStreamingBuffer)];
|
||||
int streamPoses[ARRAY_SIZE(ms_pStreamingBuffer)];
|
||||
bool first = true;
|
||||
int readOrder[4] = {-1}; // Channel IDs ordered by read time
|
||||
int readI = 0;
|
||||
int processI = 0;
|
||||
bool first = true;
|
||||
|
||||
// All those "first" checks are because of variables aren't initialized in first pass.
|
||||
|
||||
while (true) {
|
||||
// Enumerate files and start reading
|
||||
for (int i=0; i<ARRAY_SIZE(ms_pStreamingBuffer); i++) {
|
||||
|
||||
// Channel has file to load
|
||||
if (!first && streamIds[i] != -1) {
|
||||
processI = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2385,12 +2394,16 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
|||
|
||||
if (ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)) {
|
||||
streamIds[i] = -1;
|
||||
|
||||
// Big file, needs 2 buffer
|
||||
if (size > (uint32)ms_streamingBufferSize) {
|
||||
if (i + 1 == ARRAY_SIZE(ms_pStreamingBuffer))
|
||||
continue;
|
||||
break;
|
||||
else if (!first && streamIds[i+1] != -1)
|
||||
continue;
|
||||
|
||||
} else {
|
||||
// Buffer of current channel is part of a "big file", pass
|
||||
if (i != 0 && streamIds[i-1] != -1 && streamSizes[i-1] > (uint32)ms_streamingBufferSize)
|
||||
continue;
|
||||
}
|
||||
|
@ -2400,8 +2413,18 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
|||
streamIds[i] = streamId;
|
||||
streamSizes[i] = size;
|
||||
streamPoses[i] = posn;
|
||||
|
||||
if (!first)
|
||||
assert(readOrder[readI] == -1);
|
||||
|
||||
//printf("read: order %d, ch %d, id %d, size %d\n", readI, i, streamId, size);
|
||||
|
||||
CdStreamRead(i, ms_pStreamingBuffer[i], imgOffset+posn, size);
|
||||
processI = i;
|
||||
readOrder[readI] = i;
|
||||
if (first && readI+1 != ARRAY_SIZE(readOrder))
|
||||
readOrder[readI+1] = -1;
|
||||
|
||||
readI = (readI + 1) % ARRAY_SIZE(readOrder);
|
||||
} else {
|
||||
ms_aInfoForModel[streamId].RemoveFromList();
|
||||
DecrementRef(streamId);
|
||||
|
@ -2409,33 +2432,40 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
|||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
streamIds[i] = -1;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
streamIds[i] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
first = false;
|
||||
int nextChannel = readOrder[processI];
|
||||
|
||||
// Now process
|
||||
if (streamIds[processI] == -1)
|
||||
// Now start processing
|
||||
if (nextChannel == -1 || streamIds[nextChannel] == -1)
|
||||
break;
|
||||
|
||||
// Try again on error
|
||||
while (CdStreamSync(processI) != STREAM_NONE) {
|
||||
CdStreamRead(processI, ms_pStreamingBuffer[processI], imgOffset+streamPoses[processI], streamSizes[processI]);
|
||||
}
|
||||
ms_aInfoForModel[streamIds[processI]].m_loadState = STREAMSTATE_READING;
|
||||
|
||||
MakeSpaceFor(streamSizes[processI] * CDSTREAM_SECTOR_SIZE);
|
||||
ConvertBufferToObject(ms_pStreamingBuffer[processI], streamIds[processI]);
|
||||
if(ms_aInfoForModel[streamIds[processI]].m_loadState == STREAMSTATE_STARTED)
|
||||
FinishLoadingLargeFile(ms_pStreamingBuffer[processI], streamIds[processI]);
|
||||
//printf("process: order %d, ch %d, id %d\n", processI, nextChannel, streamIds[nextChannel]);
|
||||
|
||||
if(streamIds[processI] < STREAM_OFFSET_TXD){
|
||||
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(streamIds[processI]);
|
||||
// Try again on error
|
||||
while (CdStreamSync(nextChannel) != STREAM_NONE) {
|
||||
CdStreamRead(nextChannel, ms_pStreamingBuffer[nextChannel], imgOffset+streamPoses[nextChannel], streamSizes[nextChannel]);
|
||||
}
|
||||
ms_aInfoForModel[streamIds[nextChannel]].m_loadState = STREAMSTATE_READING;
|
||||
|
||||
MakeSpaceFor(streamSizes[nextChannel] * CDSTREAM_SECTOR_SIZE);
|
||||
ConvertBufferToObject(ms_pStreamingBuffer[nextChannel], streamIds[nextChannel]);
|
||||
if(ms_aInfoForModel[streamIds[nextChannel]].m_loadState == STREAMSTATE_STARTED)
|
||||
FinishLoadingLargeFile(ms_pStreamingBuffer[nextChannel], streamIds[nextChannel]);
|
||||
|
||||
if(streamIds[nextChannel] < STREAM_OFFSET_TXD){
|
||||
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(streamIds[nextChannel]);
|
||||
if(mi->IsSimple())
|
||||
mi->m_alpha = 255;
|
||||
}
|
||||
streamIds[processI] = -1;
|
||||
streamIds[nextChannel] = -1;
|
||||
readOrder[processI] = -1;
|
||||
processI = (processI + 1) % ARRAY_SIZE(readOrder);
|
||||
}
|
||||
|
||||
ms_bLoadingBigModel = false;
|
||||
|
@ -2482,7 +2512,7 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
|||
status = CdStreamRead(0, ms_pStreamingBuffer[0], imgOffset+posn, size);
|
||||
while(CdStreamSync(0) || status == STREAM_NONE);
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_READING;
|
||||
|
||||
|
||||
MakeSpaceFor(size * CDSTREAM_SECTOR_SIZE);
|
||||
ConvertBufferToObject(ms_pStreamingBuffer[0], streamId);
|
||||
if(ms_aInfoForModel[streamId].m_loadState == STREAMSTATE_STARTED)
|
||||
|
@ -2539,7 +2569,7 @@ CStreaming::FlushRequestList(void)
|
|||
next = si->m_next;
|
||||
RemoveModel(si - ms_aInfoForModel);
|
||||
}
|
||||
#ifndef _WIN32
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
if(ms_channel[0].state == CHANNELSTATE_READING) {
|
||||
flushStream[0] = 1;
|
||||
}
|
||||
|
@ -3295,4 +3325,4 @@ CStreaming::PrintStreamingBufferState()
|
|||
DoRWStuffEndOfFrame();
|
||||
}
|
||||
CTimer::Update();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue