summaryrefslogtreecommitdiffstats
path: root/src/core/CdStreamPosix.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-10-09 01:19:49 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-09 01:19:49 +0200
commited82c55475f4cda6d1ed0644ea1609e08b5b0e64 (patch)
treefe9b8f5616adf9cf76cbdc84425c3ec3eee67a5d /src/core/CdStreamPosix.cpp
parentMerge branch 'miami' of https://github.com/GTAmodding/re3 into new (diff)
downloadre3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.tar
re3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.tar.gz
re3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.tar.bz2
re3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.tar.lz
re3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.tar.xz
re3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.tar.zst
re3-ed82c55475f4cda6d1ed0644ea1609e08b5b0e64.zip
Diffstat (limited to 'src/core/CdStreamPosix.cpp')
-rw-r--r--src/core/CdStreamPosix.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index 04a5de4b..a6ab62bc 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -240,14 +240,17 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != nil );
- pChannel->hFile = hImage - 1;
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
+ if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
+ return STREAM_SUCCESS;
+
flushStream[channel] = 1;
CdStreamSync(channel);
//return STREAM_NONE;
}
+ pChannel->hFile = hImage - 1;
pChannel->nStatus = STREAM_NONE;
pChannel->nSectorOffset = _GET_OFFSET(offset);
pChannel->nSectorsToRead = size;
@@ -316,7 +319,7 @@ CdStreamSync(int32 channel)
if (flushStream[channel]) {
#ifdef ONE_THREAD_PER_CHANNEL
pChannel->nSectorsToRead = 0;
- pthread_kill(pChannel->pChannelThread, SIGINT);
+ pthread_kill(pChannel->pChannelThread, SIGUSR1);
if (pChannel->bReading) {
pChannel->bLocked = true;
sem_wait(pChannel->pDoneSemaphore);
@@ -325,8 +328,9 @@ CdStreamSync(int32 channel)
pChannel->nSectorsToRead = 0;
if (pChannel->bReading) {
pChannel->bLocked = true;
- pthread_kill(_gCdStreamThread, SIGINT);
+ pthread_kill(_gCdStreamThread, SIGUSR1);
sem_wait(pChannel->pDoneSemaphore);
+
}
#endif
pChannel->bReading = false;