mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-02 14:04:14 +01:00
Fix POSIX streaming
This commit is contained in:
parent
7f330bfbf9
commit
22c9e8b581
@ -240,14 +240,17 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
|||||||
CdReadInfo *pChannel = &gpReadInfo[channel];
|
CdReadInfo *pChannel = &gpReadInfo[channel];
|
||||||
ASSERT( pChannel != nil );
|
ASSERT( pChannel != nil );
|
||||||
|
|
||||||
pChannel->hFile = hImage - 1;
|
|
||||||
|
|
||||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
||||||
|
if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
||||||
|
return STREAM_SUCCESS;
|
||||||
|
|
||||||
flushStream[channel] = 1;
|
flushStream[channel] = 1;
|
||||||
CdStreamSync(channel);
|
CdStreamSync(channel);
|
||||||
//return STREAM_NONE;
|
//return STREAM_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pChannel->hFile = hImage - 1;
|
||||||
pChannel->nStatus = STREAM_NONE;
|
pChannel->nStatus = STREAM_NONE;
|
||||||
pChannel->nSectorOffset = _GET_OFFSET(offset);
|
pChannel->nSectorOffset = _GET_OFFSET(offset);
|
||||||
pChannel->nSectorsToRead = size;
|
pChannel->nSectorsToRead = size;
|
||||||
@ -316,7 +319,7 @@ CdStreamSync(int32 channel)
|
|||||||
if (flushStream[channel]) {
|
if (flushStream[channel]) {
|
||||||
#ifdef ONE_THREAD_PER_CHANNEL
|
#ifdef ONE_THREAD_PER_CHANNEL
|
||||||
pChannel->nSectorsToRead = 0;
|
pChannel->nSectorsToRead = 0;
|
||||||
pthread_kill(pChannel->pChannelThread, SIGINT);
|
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
||||||
if (pChannel->bReading) {
|
if (pChannel->bReading) {
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
@ -325,8 +328,9 @@ CdStreamSync(int32 channel)
|
|||||||
pChannel->nSectorsToRead = 0;
|
pChannel->nSectorsToRead = 0;
|
||||||
if (pChannel->bReading) {
|
if (pChannel->bReading) {
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
pthread_kill(_gCdStreamThread, SIGINT);
|
pthread_kill(_gCdStreamThread, SIGUSR1);
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
|
@ -1207,7 +1207,9 @@ void terminateHandler(int sig, siginfo_t *info, void *ucontext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dummyHandler(int sig){
|
void dummyHandler(int sig){
|
||||||
|
// Don't kill the app pls
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void resizeCB(GLFWwindow* window, int width, int height) {
|
void resizeCB(GLFWwindow* window, int width, int height) {
|
||||||
@ -1454,9 +1456,10 @@ main(int argc, char *argv[])
|
|||||||
act.sa_flags = SA_SIGINFO;
|
act.sa_flags = SA_SIGINFO;
|
||||||
sigaction(SIGTERM, &act, NULL);
|
sigaction(SIGTERM, &act, NULL);
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_handler = dummyHandler;
|
sa.sa_handler = dummyHandler;
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
sigaction(SIGINT, &sa, NULL); // Needed for CdStreamPosix
|
sigaction(SIGUSR1, &sa, NULL); // Needed for CdStreamPosix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user