diff --git a/Core/HLE/FunctionWrappers.h b/Core/HLE/FunctionWrappers.h index 442247a7b9..4e6c5c1f04 100644 --- a/Core/HLE/FunctionWrappers.h +++ b/Core/HLE/FunctionWrappers.h @@ -256,3 +256,13 @@ template void WrapU_UUUUUU() { u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); RETURN(retval); } + +template void WrapI_IUUU() { + int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); + RETURN(retval); +} + +template void WrapI_IUU() { + int retval = func(PARAM(0), PARAM(1), PARAM(2)); + RETURN(retval); +} \ No newline at end of file diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 3bf7b1e950..3243892c4b 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -28,19 +28,14 @@ #define ATRAC_ERROR_API_FAIL 0x80630002 #define ATRAC_ERROR_ALL_DATA_DECODED 0x80630024 -void sceAtracAddStreamData() +int sceAtracAddStreamData(int atracID, u32 bytesToAdd) { - ERROR_LOG(HLE, "UNIMPL sceAtracAddStreamData(%i, %i)", PARAM(0), PARAM(1)); - RETURN(0); + ERROR_LOG(HLE, "UNIMPL sceAtracAddStreamData(%i, %i)", atracID, bytesToAdd); + return 0; } -void sceAtracDecodeData() +int sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishFlagAddr, u32 remainAddr) { - u32 atracID = PARAM(0); - u32 outAddr = PARAM(1); - u32 numSamplesAddr = PARAM(2); - u32 finishFlagAddr = PARAM(3); - u32 remainAddr = PARAM(4); ERROR_LOG(HLE, "FAKE sceAtracDecodeData(%i, %08x, %08x, %08x, %08x)", atracID, outAddr, numSamplesAddr, finishFlagAddr, remainAddr); Memory::Write_U16(0, outAddr); // Write a single 16-bit stereo @@ -50,7 +45,7 @@ void sceAtracDecodeData() Memory::Write_U32(1, finishFlagAddr); // Lie that decoding is finished Memory::Write_U32(0, remainAddr); // Lie that decoding is finished - RETURN(0); + return 0; } void sceAtracEndEntry() @@ -71,10 +66,10 @@ void sceAtracGetBufferInfoForReseting() RETURN(0); } -void sceAtracGetBitrate() +int sceAtracGetBitrate(int atracID, u32 outBitrateAddr) { ERROR_LOG(HLE, "UNIMPL sceAtracGetBitrate"); - RETURN(0); + return 0; } void sceAtracGetChannel() @@ -101,57 +96,51 @@ void sceAtracGetMaxSample() RETURN(0); } -void sceAtracGetNextDecodePosition() +int sceAtracGetNextDecodePosition(int atracID, u32 outposAddr) { - ERROR_LOG(HLE, "UNIMPL sceAtracGetNextDecodePosition(%i, %08x)", PARAM(0), PARAM(1)); - Memory::Write_U32(1, PARAM(1)); // outpos - RETURN(0); + ERROR_LOG(HLE, "UNIMPL sceAtracGetNextDecodePosition(%i, %08x)", atracID, outposAddr); + Memory::Write_U32(1, outposAddr); // outpos + return 0; } -void sceAtracGetNextSample() +int sceAtracGetNextSample(int atracID, u32 outNAddr) { - u32 atracID = PARAM(0); - u32 outN = PARAM(1); - ERROR_LOG(HLE, "FAKE sceAtracGetNextSample(%i, %08x)", atracID, outN); - Memory::Write_U32(0, outN); - RETURN(0); + ERROR_LOG(HLE, "FAKE sceAtracGetNextSample(%i, %08x)", atracID, outNAddr); + Memory::Write_U32(0, outNAddr); + return 0; } -void sceAtracGetRemainFrame() +int sceAtracGetRemainFrame(int atracID, u32 outposAddr) { - ERROR_LOG(HLE, "sceAtracGetRemainFrame(%i, %08x)",PARAM(0),PARAM(1)); - Memory::Write_U32(12, PARAM(1)); // outpos - RETURN(0); + ERROR_LOG(HLE, "sceAtracGetRemainFrame(%i, %08x)", atracID, outposAddr); + Memory::Write_U32(12, outposAddr); // outpos + return 0; } -void sceAtracGetSecondBufferInfo() +int sceAtracGetSecondBufferInfo(int atracID, u32 outposAddr, u32 outBytesAddr) { - ERROR_LOG(HLE, "sceAtracGetSecondBufferInfo(%i, %08x, %08x)",PARAM(0),PARAM(1),PARAM(2)); - Memory::Write_U32(0, PARAM(1)); // outpos - Memory::Write_U32(0x10000, PARAM(2)); // outBytes - RETURN(0); + ERROR_LOG(HLE, "sceAtracGetSecondBufferInfo(%i, %08x, %08x)", atracID, outposAddr, outBytesAddr); + Memory::Write_U32(0, outposAddr); // outpos + Memory::Write_U32(0x10000, outBytesAddr); // outBytes + return 0; } -void sceAtracGetSoundSample() +int sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoopStartSampleAddr, u32 outLoopEndSampleAddr) { - ERROR_LOG(HLE, "UNIMPL sceAtracGetSoundSample(%i, %08x, %08x, %08x)",PARAM(0),PARAM(1),PARAM(2),PARAM(3)); - Memory::Write_U32(0x10000, PARAM(1)); // outEndSample - Memory::Write_U32(-1, PARAM(2)); // outLoopStartSample - Memory::Write_U32(-1, PARAM(3)); // outLoopEndSample - RETURN(0); + ERROR_LOG(HLE, "UNIMPL sceAtracGetSoundSample(%i, %08x, %08x, %08x)", atracID, outEndSampleAddr, outLoopStartSampleAddr, outLoopEndSampleAddr); + Memory::Write_U32(0x10000, outEndSampleAddr); // outEndSample + Memory::Write_U32(-1, outLoopStartSampleAddr); // outLoopStartSample + Memory::Write_U32(-1, outLoopEndSampleAddr); // outLoopEndSample + return 0; } -void sceAtracGetStreamDataInfo() +int sceAtracGetStreamDataInfo(int atracID, u32 writePointerAddr, u32 availableBytesAddr, u32 readOffsetAddr) { - u32 atracID = PARAM(0); - u32 writePointerAddr = PARAM(1); - u32 availableBytesAddr = PARAM(2); - u32 readOffsetAddr = PARAM(3); ERROR_LOG(HLE, "FAKE sceAtracGetStreamDataInfo(%i, %08x, %08x, %08x)", atracID, writePointerAddr, availableBytesAddr, readOffsetAddr); Memory::Write_U32(0, readOffsetAddr); Memory::Write_U32(0, availableBytesAddr); Memory::Write_U32(0, writePointerAddr); - RETURN(0); + return 0; } void sceAtracReleaseAtracID() @@ -211,22 +200,22 @@ void sceAtracSetLoopNum() const HLEFunction sceAtrac3plus[] = { - {0x7db31251,sceAtracAddStreamData,"sceAtracAddStreamData"}, - {0x6a8c3cd5,sceAtracDecodeData,"sceAtracDecodeData"}, + {0x7db31251,WrapI_IU,"sceAtracAddStreamData"}, + {0x6a8c3cd5,WrapI_IUUUU,"sceAtracDecodeData"}, {0xd5c28cc0,sceAtracEndEntry,"sceAtracEndEntry"}, {0x780f88d1,sceAtracGetAtracID,"sceAtracGetAtracID"}, {0xca3ca3d2,sceAtracGetBufferInfoForReseting,"sceAtracGetBufferInfoForReseting"}, - {0xa554a158,sceAtracGetBitrate,"sceAtracGetBitrate"}, + {0xa554a158,WrapI_IU,"sceAtracGetBitrate"}, {0x31668baa,sceAtracGetChannel,"sceAtracGetChannel"}, {0xfaa4f89b,sceAtracGetLoopStatus,"sceAtracGetLoopStatus"}, {0xe88f759b,sceAtracGetInternalErrorInfo,"sceAtracGetInternalErrorInfo"}, {0xd6a5f2f7,sceAtracGetMaxSample,"sceAtracGetMaxSample"}, - {0xe23e3a35,sceAtracGetNextDecodePosition,"sceAtracGetNextDecodePosition"}, - {0x36faabfb,sceAtracGetNextSample,"sceAtracGetNextSample"}, - {0x9ae849a7,sceAtracGetRemainFrame,"sceAtracGetRemainFrame"}, - {0x83e85ea0,sceAtracGetSecondBufferInfo,"sceAtracGetSecondBufferInfo"}, - {0xa2bba8be,sceAtracGetSoundSample,"sceAtracGetSoundSample"}, - {0x5d268707,sceAtracGetStreamDataInfo,"sceAtracGetStreamDataInfo"}, + {0xe23e3a35,WrapI_IU,"sceAtracGetNextDecodePosition"}, + {0x36faabfb,WrapI_IU,"sceAtracGetNextSample"}, + {0x9ae849a7,WrapI_IU,"sceAtracGetRemainFrame"}, + {0x83e85ea0,WrapI_IUU,"sceAtracGetSecondBufferInfo"}, + {0xa2bba8be,WrapI_IUUU,"sceAtracGetSoundSample"}, + {0x5d268707,WrapI_IUUU,"sceAtracGetStreamDataInfo"}, {0x61eb33f5,sceAtracReleaseAtracID,"sceAtracReleaseAtracID"}, {0x644e5607,sceAtracResetPlayPosition,"sceAtracResetPlayPosition"}, {0x3f6e26b5,sceAtracSetHalfwayBuffer,"sceAtracSetHalfwayBuffer"}, diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 7a44243f59..35fadde9ec 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -212,7 +212,7 @@ u32 sceAudioChReserve(u32 channel, u32 sampleCount, u32 format) //.Allocate soun { WARN_LOG(HLE, "WARNING: Reserving already reserved channel. Error?"); } - DEBUG_LOG(HLE, "%i = sceAudioChReserve(%i, %i, %i)", channel, PARAM(0), sampleCount, format); + DEBUG_LOG(HLE, "%i = sceAudioChReserve(%i, %i, %i)", channel, sampleCount, format); chans[channel].sampleCount = sampleCount; chans[channel].reserved = true; @@ -300,46 +300,42 @@ u32 sceAudioChangeChannelVolume(u32 chan, u32 lvolume, u32 rvolume) } } -void sceAudioInit() +u32 sceAudioInit() { - DEBUG_LOG(HLE,"sceAudioInit()"); + DEBUG_LOG(HLE,"sceAudioInit()"); // Don't need to do anything - RETURN(0); + return 0; } -void sceAudioEnd() +u32 sceAudioEnd() { DEBUG_LOG(HLE,"sceAudioEnd()"); // Don't need to do anything - RETURN(0); + return 0; } -void sceAudioOutput2Reserve() +u32 sceAudioOutput2Reserve(u32 sampleCount) { - int sampleCount = PARAM(0); - ERROR_LOG(HLE,"sceAudioOutput2Reserve(%i)", sampleCount); + ERROR_LOG(HLE,"sceAudioOutput2Reserve(%i)", sampleCount); chans[0].sampleCount = sampleCount; chans[0].reserved = true; - RETURN(0); + return 0; } -void sceAudioOutput2OutputBlocking() +u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr) { - int vol = PARAM(0); - u32 dataPtr = PARAM(1); - - WARN_LOG(HLE,"FAKE sceAudioOutput2OutputBlocking(%i, %08x)", vol, dataPtr); + WARN_LOG(HLE,"FAKE sceAudioOutput2OutputBlocking(%i, %08x)", vol, dataPtr); chans[0].leftVolume = vol; chans[0].rightVolume = vol; chans[0].sampleAddress = dataPtr; - RETURN(0); - u32 retval = __AudioEnqueue(chans[0], 0, true); + return 0; + u32 retval = __AudioEnqueue(chans[0], 0, true); if (retval < 0) - RETURN(retval); + return retval; } u32 sceAudioOutput2ChangeLength(u32 sampleCount) { - WARN_LOG(HLE,"sceAudioOutput2ChangeLength(%i)", sampleCount); + WARN_LOG(HLE,"sceAudioOutput2ChangeLength(%i)", sampleCount); chans[0].sampleCount = sampleCount; return 0; } @@ -350,11 +346,11 @@ u32 sceAudioOutput2GetRestSample() return chans[0].sampleQueue.size() * 2; } -void sceAudioOutput2Release() +u32 sceAudioOutput2Release() { - WARN_LOG(HLE,"sceAudioOutput2Release()"); + WARN_LOG(HLE,"sceAudioOutput2Release()"); chans[0].reserved = false; - RETURN(0); + return 0; } u32 sceAudioSetFrequency(u32 freq) { @@ -372,14 +368,14 @@ const HLEFunction sceAudio[] = { // Newer simplified single channel audio output. Presumably for games that use Atrac3 // directly from Sas instead of playing it on a separate audio channel. - {0x01562ba3, sceAudioOutput2Reserve, "sceAudioOutput2Reserve"}, - {0x2d53f36e, sceAudioOutput2OutputBlocking, "sceAudioOutput2OutputBlocking"}, + {0x01562ba3, WrapU_U, "sceAudioOutput2Reserve"}, + {0x2d53f36e, WrapU_UU, "sceAudioOutput2OutputBlocking"}, {0x63f2889c, WrapU_U, "sceAudioOutput2ChangeLength"}, {0x647cef33, WrapU_V, "sceAudioOutput2GetRestSample"}, - {0x43196845, sceAudioOutput2Release, "sceAudioOutput2Release"}, + {0x43196845, WrapU_V, "sceAudioOutput2Release"}, - {0x80F1F7E0, sceAudioInit, "sceAudioInit"}, - {0x210567F7, sceAudioEnd, "sceAudioEnd"}, + {0x80F1F7E0, WrapU_V, "sceAudioInit"}, + {0x210567F7, WrapU_V, "sceAudioEnd"}, {0xA2BEAA6C, WrapU_U, "sceAudioSetFrequency"}, {0x927AC32B, 0, "sceAudioSetVolumeOffset"},