From 1391d83afde12e5116cb9058bb15b7bf964f7b05 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Wed, 7 Nov 2012 16:05:39 +0100 Subject: [PATCH] Never do RETURN() after blocking (Wait etc), as it will zero out a register in the wrong thread. --- .gitignore | 1 + Core/HLE/FunctionWrappers.h | 4 ++++ Core/HLE/sceAudio.cpp | 14 +++++++------- Core/HLE/sceDisplay.cpp | 1 - Core/HLE/sceKernelThread.cpp | 4 ++-- Core/HLE/sceUtility.cpp | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index b1395caa32..ebcff6c418 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ gen libs obj *.exp +GameLogNotes.txt Windows/x64 Windows/ipch Memstick diff --git a/Core/HLE/FunctionWrappers.h b/Core/HLE/FunctionWrappers.h index 0059edc8b1..e0a43585cf 100644 --- a/Core/HLE/FunctionWrappers.h +++ b/Core/HLE/FunctionWrappers.h @@ -75,6 +75,10 @@ template void WrapV_UUU() { func(PARAM(0), PARAM(1), PARAM(2)); } +template void WrapV_UUUU() { + func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); +} + template void WrapU_UUUU() { u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); RETURN(retval); diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 3dfc56138d..e564a3fbc2 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -30,24 +30,24 @@ AudioChannel chans[8]; // Not sure about the range of volume, I often see 0x800 so that might be either // max or 50%? -u32 sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 samplePtr) +void sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 samplePtr) { DEBUG_LOG(HLE,"sceAudioOutputPannedBlocking(%d,%d,%d, %08x )", chan, volume1, volume2, samplePtr); if (samplePtr == 0) { ERROR_LOG(HLE, "Sample pointer null"); - return 0; + RETURN(0); } if (chan < 0 || chan >= MAX_CHANNEL) { ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - BAD CHANNEL"); - return SCE_ERROR_AUDIO_INVALID_CHANNEL; + RETURN(SCE_ERROR_AUDIO_INVALID_CHANNEL); } else if (!chans[chan].reserved) { - return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; + RETURN(SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED); } else { @@ -55,7 +55,7 @@ u32 sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 sampleP chans[chan].leftVolume = volume1; chans[chan].rightVolume = volume2; chans[chan].sampleAddress = samplePtr; - return __AudioEnqueue(chans[chan], chan, true); + __AudioEnqueue(chans[chan], chan, true); } } @@ -70,7 +70,7 @@ u32 sceAudioOutputPanned(u32 chan, u32 leftVol, u32 rightVol, u32 samplePtr) { if (chan < 0 || chan >= MAX_CHANNEL) { - ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - BAD CHANNEL"); + ERROR_LOG(HLE,"sceAudioOutputPanned() - BAD CHANNEL"); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) @@ -258,7 +258,7 @@ const HLEFunction sceAudio[] = {0x8c1009b2, 0, "sceAudioOutput"}, {0x136CAF51, WrapU_UUU, "sceAudioOutputBlocking"}, {0xE2D56B2D, WrapU_UUUU, "sceAudioOutputPanned"}, - {0x13F592BC, WrapU_UUUU, "sceAudioOutputPannedBlocking"}, //(u32, u32, u32, void *)Output sound, blocking + {0x13F592BC, WrapV_UUUU, "sceAudioOutputPannedBlocking"}, //(u32, u32, u32, void *)Output sound, blocking {0x5EC81C55, WrapU_UUU, "sceAudioChReserve"}, //(u32, u32 samplecount, u32) Initialize channel and allocate buffer long, long samplecount, long);//init buffer? returns handle, minus if error {0x6FC46853, WrapU_U, "sceAudioChRelease"}, //(long handle)Terminate channel and deallocate buffer //free buffer? {0xE9D97901, sceAudioGetChannelRestLen, "sceAudioGetChannelRestLen"}, diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 9edd172532..a3c4ab1c16 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -233,7 +233,6 @@ void sceDisplayWaitVblankStart() { DEBUG_LOG(HLE,"sceDisplayWaitVblankStart()"); __KernelWaitCurThread(WAITTYPE_VBLANK, 0, 0, 0, false); - RETURN(0); } void sceDisplayWaitVblank() diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 2b52bb6af5..624b204ed3 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1089,8 +1089,8 @@ void sceKernelDelayThreadCB() SceUID curThread = __KernelGetCurThread(); __KernelScheduleWakeup(curThread, usec); __KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, true); - __KernelCheckCallbacks(); - __KernelExecutePendingMipsCalls(); + if (__KernelCheckCallbacks()) + __KernelExecutePendingMipsCalls(); } void sceKernelDelayThread() diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 530fa203cd..80ab1e7251 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -252,15 +252,15 @@ void sceUtilitySavedataUpdate() void sceUtilityLoadAvModule() { DEBUG_LOG(HLE,"sceUtilityLoadAvModule(%i)", PARAM(0)); - __KernelReSchedule("utilityloadavmodule"); RETURN(0); + __KernelReSchedule("utilityloadavmodule"); } void sceUtilityLoadModule() { DEBUG_LOG(HLE,"sceUtilityLoadModule(%i)", PARAM(0)); - __KernelReSchedule("utilityloadmodule"); RETURN(0); + __KernelReSchedule("utilityloadmodule"); } typedef struct