fix missing calls to DSStream_Packet_Process

This commit is contained in:
RadWolfie 2020-03-13 23:49:49 -05:00
parent 178ec004c8
commit da9e727330
2 changed files with 12 additions and 5 deletions

View File

@ -253,7 +253,8 @@ bool DSStream_Packet_Process(
DWORD writePos = 0;
hRet = pThis->EmuDirectSoundBuffer8->GetCurrentPosition(nullptr, &writePos);
if (hRet == DS_OK) {
do {
// Disabled do/while loop since xbox thread will be processing as well.
//do {
int bufPlayed = writePos - packetCurrent->lastWritePos;
// Correct it if buffer was playing and is at beginning.
@ -320,9 +321,9 @@ bool DSStream_Packet_Process(
// Otherwise, continue upload partial of the packet's data to host if there are any left.
else {
DSStream_Packet_UploadPartial(pThis, packetCurrent);
break; // Leave loop since there is more buffer haven't been process in the current packet.
//break; // Leave loop since there is more buffer haven't been process in the current packet.
}
} while (true);
//} while (true);
DSStream_Packet_Prefill(pThis, packetCurrent);
}
@ -333,9 +334,12 @@ bool DSStream_Packet_Process(
}
}
// The only place when Host_isProcessing is set to true to start play Host's audio buffer.
if (pThis->Host_isProcessing == false) {
pThis->EmuDirectSoundBuffer8->Play(0, 0, pThis->EmuPlayFlags);
pThis->Host_isProcessing = true;
// Add debug log for verify if Host_isProcessing has set to true.
EmuLog(LOG_LEVEL::DEBUG, "pStream = %08X:Host_isProcessing is set to true.", pThis);
}
return 1;
}

View File

@ -466,8 +466,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_GetStatus)
// Convert host to xbox status flag.
if (hRet == DS_OK) {
DWORD testSize = pThis->Host_BufferPacketArray.size();
if ((dwStatusHost & DSBSTATUS_PLAYING) > 0 && !(dwStatusXbox & X_DSSSTATUS_PAUSED)) {
if (pThis->Host_isProcessing && !(dwStatusXbox & X_DSSSTATUS_PAUSED)) {
dwStatusXbox |= X_DSSSTATUS_PLAYING;
}
@ -548,6 +547,9 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Pause)
}
}
}
else if (!pThis->Host_isProcessing) {
DSStream_Packet_Process(pThis);
}
return hRet;
}
@ -645,6 +647,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Process)
if ((pThis->EmuFlags & DSE_FLAG_IS_ACTIVATED) > 0 && (pThis->EmuFlags & DSE_FLAG_PAUSE) > 0) {
pThis->Xb_Status |= X_DSSSTATUS_PAUSED;
}
DSStream_Packet_Process(pThis);
// Once full it needs to change status to flushed when cannot hold any more packets.
} else {
if (pInputBuffer->pdwStatus != xbnullptr) {