From c643345c71c025452e89ced390a9543a2a5e7c5f Mon Sep 17 00:00:00 2001 From: jacky400 Date: Fri, 7 Dec 2012 12:45:16 +0800 Subject: [PATCH 01/17] Implement sceSasGetGrain and sceSasSetGrain --- Core/HLE/sceSas.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 66eab7c98b..2ef6bf1e0e 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -41,6 +41,8 @@ static const int PSP_SAS_ADSR_DECAY=2; static const int PSP_SAS_ADSR_SUSTAIN=4; static const int PSP_SAS_ADSR_RELEASE=8; +int grainSamples; + static const double f[5][2] = { { 0.0, 0.0 }, { 60.0 / 64.0, 0.0 }, @@ -461,6 +463,20 @@ void sceSasRevVON(u32 core, int param1, int param2) RETURN(0); } +u32 sceSasGetGrain(u32 core) +{ + DEBUG_LOG(HLE,"0=sceSasGetGrain(core=%08x)", core); + return grainSamples; +} + +u32 sceSasSetGrain(u32 core, int grain) +{ + DEBUG_LOG(HLE,"0=sceSasSetGrain(core=%08x, grain=%i)", core, grain); + grainSamples=grain; + return(0); +} + + void sceSasGetOutputMode(u32 core, int param1, int param2) { DEBUG_LOG(HLE,"UNIMPL 0=sceSasGetOutputMode(core=%08x, param1=%i, param2=%i)", core, param1, param2); @@ -493,8 +509,8 @@ const HLEFunction sceSasCore[] = {0x787d04d5, 0, "__sceSasSetPause"}, {0xa232cbe6, 0, "__sceSasSetTriangularWave"}, // (int sasCore, int voice, int unknown) {0xd5ebbbcd, 0, "__sceSasSetSteepWave"}, // (int sasCore, int voice, int unknown) // square wave? - {0xBD11B7C2, 0, "__sceSasGetGrain"}, - {0xd1e0a01e, 0, "__sceSasSetGrain"}, + {0xBD11B7C2, WrapU_U, "__sceSasGetGrain"}, + {0xd1e0a01e, WrapU_UI, "__sceSasSetGrain"}, {0xe175ef66, WrapV_UII, "__sceSasGetOutputmode"}, {0xe855bf76, 0, "__sceSasSetOutputmode"}, {0x07f58c24, 0, "__sceSasGetAllEnvelopeHeights"}, // (int sasCore, int heightAddr) 32-bit heights, 0-0x40000000 From b61a672449feeab645c8b829600be9a527da7cbc Mon Sep 17 00:00:00 2001 From: jacky400 Date: Fri, 7 Dec 2012 12:59:30 +0800 Subject: [PATCH 02/17] Add WrapU_UIC for sceSasSetPause --- Core/HLE/FunctionWrappers.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/HLE/FunctionWrappers.h b/Core/HLE/FunctionWrappers.h index a0561526f7..43bd31e6a1 100644 --- a/Core/HLE/FunctionWrappers.h +++ b/Core/HLE/FunctionWrappers.h @@ -103,6 +103,10 @@ template void WrapU_I() { RETURN(retval); } +template void WrapU_UIC() { + func(PARAM(0), PARAM(1), Memory::GetCharPointer(PARAM(2))); +} + template void WrapI_I() { int retval = func(PARAM(0)); RETURN(retval); From a24cc1dd9a33468e6962d4c908ed0d25cbe26665 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Fri, 7 Dec 2012 13:23:26 +0800 Subject: [PATCH 03/17] Implement sceSasSetPause --- Core/HLE/sceSas.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 2ef6bf1e0e..1da1cac099 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -156,6 +156,7 @@ struct Voice bool endFlag; bool PauseFlag; bool playing; + bool setPaused; VagDecoder vag; }; @@ -262,6 +263,17 @@ void sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) RETURN(0); } +u32 sceSasSetPause(u32 core, int voicebit, const char *pause) +{ + DEBUG_LOG(HLE,"0=sceSasSetPause(core=%08x, voicebit=%i, pause=%c)", core, voicebit, pause); + for (int i = 0; voicebit != 0; i++, voicebit >>= 1) { + if ((voicebit & 1) != 0) { + sas.voices[i].setPaused=pause; + } + } + return(0); +} + void sceSasSetVolume(u32 core, int voiceNum, int l, int r, int el, int er) { DEBUG_LOG(HLE,"UNIMPL 0=sceSasSetVolume(core=%08x, voicenum=%i, l=%i, r=%i, el=%i, er=%i", core, voiceNum, l, r, el, er); @@ -506,7 +518,7 @@ const HLEFunction sceSasCore[] = {0x33d4ab37, WrapV_UI, "__sceSasRevType"}, // (int sasCore, int type) {0x267a6dd2, WrapV_UII, "__sceSasRevParam"}, // (int sasCore, int delay, int feedback) {0x2c8e6ab3, WrapU_V, "__sceSasGetPauseFlag"}, // int sasCore - {0x787d04d5, 0, "__sceSasSetPause"}, + {0x787d04d5, WrapU_UIC, "__sceSasSetPause"}, {0xa232cbe6, 0, "__sceSasSetTriangularWave"}, // (int sasCore, int voice, int unknown) {0xd5ebbbcd, 0, "__sceSasSetSteepWave"}, // (int sasCore, int voice, int unknown) // square wave? {0xBD11B7C2, WrapU_U, "__sceSasGetGrain"}, From 17d32c2606284bee069c882861fc82b6d832c081 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Fri, 7 Dec 2012 20:41:51 +0800 Subject: [PATCH 04/17] Add 3 functions in sceVaudio --- Core/HLE/sceVaudio.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 6ca72b69d0..d384a95c88 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -19,11 +19,29 @@ #include "sceVaudio.h" +void sceVaudioOutputBlockingFunction() +{ + WARN_LOG(HLE, "HACK sceVaudioOutputBlockingFunction(...)"); + RETURN(0); +} + +void sceVaudioChReserveFunction() +{ + WARN_LOG(HLE, "HACK sceVaudioChReserveFunction(...)"); + RETURN(0); +} + +void sceVaudioChReleaseFunction() +{ + WARN_LOG(HLE, "HACK sceVaudioChReleaseFunction(...)"); + RETURN(0); +} + const HLEFunction sceVaudio[] = { - {0x03b6807d, 0, "sceVaudio_0x03b6807d"}, - {0x67585dfd, 0, "sceVaudio_0x67585dfd"}, - {0x8986295e, 0, "sceVaudio_0x8986295e"}, + {0x03b6807d, sceVaudioOutputBlockingFunction, "sceVaudioOutputBlockingFunction"}, + {0x67585dfd, sceVaudioChReserveFunction, "sceVaudioChReserveFunction"}, + {0x8986295e, sceVaudioChReleaseFunction, "sceVaudioChReleaseFunction"}, }; void Register_sceVaudio() From 414f103211f3a095eb7c436ee81e667252cff5c0 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 11:36:07 +0800 Subject: [PATCH 05/17] Cleanup and new function in SasCore --- Core/HLE/sceSas.cpp | 84 +++++++++++++++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 21 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 1da1cac099..b0654f60dd 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -42,6 +42,14 @@ static const int PSP_SAS_ADSR_SUSTAIN=4; static const int PSP_SAS_ADSR_RELEASE=8; int grainSamples; +int output; +int waveformEffectType; +int waveformEffectDelay; +int waveformEffectFeedback ; +int waveformEffectLeftVol; +int waveformEffectRightVol; +bool waveformEffectIsDryOn; +bool waveformEffectIsWetOn; static const double f[5][2] = { { 0.0, 0.0 }, @@ -135,6 +143,7 @@ bool VagDecoder::Decode() struct Voice { u32 vagAddr; + u32 pcmAddr; int samplePos; int size; int loop; @@ -169,6 +178,7 @@ public: int grainSize; int maxVoices; int sampleRate; + int output; void mix(u32 outAddr); }; @@ -208,20 +218,21 @@ void SasInstance::mix(u32 outAddr) } } -u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 unknown, u32 sampleRate) +u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 outputMode, u32 sampleRate) { DEBUG_LOG(HLE,"0=sceSasInit()"); memset(&sas, 0, sizeof(sas)); sas.grainSize = grainSize; sas.maxVoices = maxVoices; sas.sampleRate = sampleRate; + sas.output = outputMode; for (int i = 0; i < 32; i++) { sas.voices[i].playing = false; } return 0; } -u32 sceSasGetEndFlag() +u32 sceSasGetEndFlag(u32 core) { u32 endFlag = 0; for (int i = 0; i < sas.maxVoices; i++) { @@ -440,17 +451,20 @@ u32 sceSasGetEnvelopeHeight(u32 core, u32 voiceNum) void sceSasRevType(u32 core, int type) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevType(core=%08x, type=%i)", core, type); + DEBUG_LOG(HLE,"0=sceSasRevType(core=%08x, type=%i)", core, type); + waveformEffectType=type; RETURN(0); } -void sceSasRevParam(u32 core, int param1, int param2) +void sceSasRevParam(u32 core, int delay, int feedback) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevParam(core=%08x, param1=%i, param2=%i)", core, param1, param2); + DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevParam(core=%08x, delay=%i, feedback=%i)", core, delay, feedback); + waveformEffectDelay = delay; + waveformEffectFeedback = feedback; RETURN(0); } -u32 sceSasGetPauseFlag() +u32 sceSasGetPauseFlag(u32 core) { u32 PauseFlag = 0; for (int i = 0; i < sas.maxVoices; i++) { @@ -461,17 +475,19 @@ u32 sceSasGetPauseFlag() return PauseFlag; } - - -void sceSasRevEVOL(u32 core, int param1, int param2) +void sceSasRevEVOL(u32 core, int lv, int rv) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevEVOL(core=%08x, param1=%i, param2=%i)", core, param1, param2); + DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, leftVolume=%i, rightVolume=%i)", core, lv, rv); + waveformEffectLeftVol = lv; + waveformEffectRightVol = rv; RETURN(0); } -void sceSasRevVON(u32 core, int param1, int param2) +void sceSasRevVON(u32 core, int dry, int wet) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevEVOL(core=%08x, param1=%i, param2=%i)", core, param1, param2); + DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, dry=%i, param2=%i)", core, dry, wet); + waveformEffectIsDryOn = (dry > 0); + waveformEffectIsWetOn = (wet > 0); RETURN(0); } @@ -489,19 +505,45 @@ u32 sceSasSetGrain(u32 core, int grain) } -void sceSasGetOutputMode(u32 core, int param1, int param2) +u32 sceSasGetOutputMode(u32 core) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasGetOutputMode(core=%08x, param1=%i, param2=%i)", core, param1, param2); - RETURN(0); + DEBUG_LOG(HLE,"0=sceSasGetOutputMode(core=%08x)", core); + RETURN output; } +u32 sceSasSetOutputMode(u32 core, u32 outputMode) +{ + DEBUG_LOG(HLE,"0=sceSasSetOutputMode(core=%08x, outputMode=%i)", core, outputMode); + output=outputMode; + return(0); +} + +u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) +{ + Memory::Memset(heightsAddr, 0 , sas.length * 4); + for (int i = 0; i < sas.length ; i++) { + int voiceHeight = sas.voices[i].height; + } + return 0; +} + +void sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop) +{ + DEBUG_LOG(HLE,"0=sceSasSetVoice(core=%08x, voicenum=%i, pcm=%08x, size=%i, loop=%i)",core, voiceNum, pcmAddr, size, loop); + Voice &v = sas.voices[voiceNum]; + v.pcmAddr = pcmAddr; + v.size = size; + v.loop = loop; + v.playing = true; + RETURN(0); +} const HLEFunction sceSasCore[] = { {0x42778a9f, WrapU_UUUUU, "__sceSasInit"}, // (SceUID * sasCore, int grain, int maxVoices, int outputMode, int sampleRate) {0xa3589d81, WrapV_U<_sceSasCore>, "__sceSasCore"}, {0x50a14dfc, WrapV_U<_sceSasCoreWithMix>, "__sceSasCoreWithMix"}, // Process and mix into buffer (int sasCore, int sasInOut, int leftVolume, int rightVolume) - {0x68a46b95, WrapU_V, "__sceSasGetEndFlag"}, // int sasCore + {0x68a46b95, WrapU_U, "__sceSasGetEndFlag"}, // int sasCore {0x440ca7d8, WrapV_UIIIII, "__sceSasSetVolume"}, {0xad84d37f, WrapV_UII, "__sceSasSetPitch"}, {0x99944089, WrapV_UIUII, "__sceSasSetVoice"}, // (int sasCore, int voice, int vagAddr, int size, int loopmode) @@ -517,16 +559,16 @@ const HLEFunction sceSasCore[] = {0xd5a229c9, WrapV_UII, "__sceSasRevEVOL"}, // (int sasCore, int leftVol, int rightVol) // effect volume {0x33d4ab37, WrapV_UI, "__sceSasRevType"}, // (int sasCore, int type) {0x267a6dd2, WrapV_UII, "__sceSasRevParam"}, // (int sasCore, int delay, int feedback) - {0x2c8e6ab3, WrapU_V, "__sceSasGetPauseFlag"}, // int sasCore + {0x2c8e6ab3, WrapU_U, "__sceSasGetPauseFlag"}, // int sasCore {0x787d04d5, WrapU_UIC, "__sceSasSetPause"}, {0xa232cbe6, 0, "__sceSasSetTriangularWave"}, // (int sasCore, int voice, int unknown) {0xd5ebbbcd, 0, "__sceSasSetSteepWave"}, // (int sasCore, int voice, int unknown) // square wave? {0xBD11B7C2, WrapU_U, "__sceSasGetGrain"}, {0xd1e0a01e, WrapU_UI, "__sceSasSetGrain"}, - {0xe175ef66, WrapV_UII, "__sceSasGetOutputmode"}, - {0xe855bf76, 0, "__sceSasSetOutputmode"}, - {0x07f58c24, 0, "__sceSasGetAllEnvelopeHeights"}, // (int sasCore, int heightAddr) 32-bit heights, 0-0x40000000 - {0xE1CD9561, 0, "__sceSasSetVoicePCM"}, + {0xe175ef66, WrapU_U, "__sceSasGetOutputmode"}, + {0xe855bf76, WrapU_UU, "__sceSasSetOutputmode"}, + {0x07f58c24, WrapU_UU, "__sceSasGetAllEnvelopeHeights"}, // (int sasCore, int heightAddr) 32-bit heights, 0-0x40000000 + {0xE1CD9561, WrapV_UIUII, "__sceSasSetVoicePCM"}, }; void Register_sceSasCore() From e7cb558cb94587afac84052b6622a31faadb4161 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 14:13:41 +0800 Subject: [PATCH 06/17] Update Core/HLE/sceSas.cpp --- Core/HLE/sceSas.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index b0654f60dd..46595534ee 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -48,8 +48,8 @@ int waveformEffectDelay; int waveformEffectFeedback ; int waveformEffectLeftVol; int waveformEffectRightVol; -bool waveformEffectIsDryOn; -bool waveformEffectIsWetOn; +int waveformEffectIsDryOn; +int waveformEffectIsWetOn; static const double f[5][2] = { { 0.0, 0.0 }, @@ -162,10 +162,9 @@ struct Voice int sustainLevel; int releaseType; int pitch; - bool endFlag; - bool PauseFlag; + int setPaused; + int height; bool playing; - bool setPaused; VagDecoder vag; }; @@ -178,7 +177,8 @@ public: int grainSize; int maxVoices; int sampleRate; - int output; + int outputMode; + int length; void mix(u32 outAddr); }; @@ -225,7 +225,7 @@ u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 outputMode, u32 sampl sas.grainSize = grainSize; sas.maxVoices = maxVoices; sas.sampleRate = sampleRate; - sas.output = outputMode; + sas.outputMode = outputMode; for (int i = 0; i < 32; i++) { sas.voices[i].playing = false; } @@ -274,7 +274,7 @@ void sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) RETURN(0); } -u32 sceSasSetPause(u32 core, int voicebit, const char *pause) +u32 sceSasSetPause(u32 core, int voicebit, int pause) { DEBUG_LOG(HLE,"0=sceSasSetPause(core=%08x, voicebit=%i, pause=%c)", core, voicebit, pause); for (int i = 0; voicebit != 0; i++, voicebit >>= 1) { @@ -282,7 +282,7 @@ u32 sceSasSetPause(u32 core, int voicebit, const char *pause) sas.voices[i].setPaused=pause; } } - return(0); + return 0; } void sceSasSetVolume(u32 core, int voiceNum, int l, int r, int el, int er) @@ -326,7 +326,7 @@ u32 sceSasSetNoise(u32 core, int voiceNum, int freq) DEBUG_LOG(HLE,"0=sceSasSetVoice(core=%08x, voiceNum=%i, freq=%i)", core, voiceNum, freq); Voice &v = sas.voices[voiceNum]; v.freq = freq; - return(0); + return 0; } u32 sceSasSetSL(u32 core, int voiceNum, int level) @@ -334,7 +334,7 @@ u32 sceSasSetSL(u32 core, int voiceNum, int level) DEBUG_LOG(HLE,"0=sceSasSetSL(core=%08x, voicenum=%i, level=%i)", core, voiceNum, level); Voice &v = sas.voices[voiceNum]; v.sustainLevel = level; - return(0); + return 0; } u32 sceSasSetADSR(u32 core, int voiceNum,int flag ,int a, int d, int s, int r) @@ -356,7 +356,7 @@ u32 sceSasSetADSRMode(u32 core, int voiceNum,int flag ,int a, int d, int s, int if ((flag & 0x2) != 0) v.decayType = d; if ((flag & 0x4) != 0) v.sustainType = s; if ((flag & 0x8) != 0) v.releaseType = r; - return 0; + return 0 ; } // http://code.google.com/p/jpcsp/source/browse/trunk/src/jpcsp/HLE/modules150/sceSasCore.java @@ -501,21 +501,21 @@ u32 sceSasSetGrain(u32 core, int grain) { DEBUG_LOG(HLE,"0=sceSasSetGrain(core=%08x, grain=%i)", core, grain); grainSamples=grain; - return(0); + return 0; } u32 sceSasGetOutputMode(u32 core) { DEBUG_LOG(HLE,"0=sceSasGetOutputMode(core=%08x)", core); - RETURN output; + return output; } u32 sceSasSetOutputMode(u32 core, u32 outputMode) { DEBUG_LOG(HLE,"0=sceSasSetOutputMode(core=%08x, outputMode=%i)", core, outputMode); output=outputMode; - return(0); + return 0; } u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) @@ -560,13 +560,13 @@ const HLEFunction sceSasCore[] = {0x33d4ab37, WrapV_UI, "__sceSasRevType"}, // (int sasCore, int type) {0x267a6dd2, WrapV_UII, "__sceSasRevParam"}, // (int sasCore, int delay, int feedback) {0x2c8e6ab3, WrapU_U, "__sceSasGetPauseFlag"}, // int sasCore - {0x787d04d5, WrapU_UIC, "__sceSasSetPause"}, + {0x787d04d5, WrapU_UII, "__sceSasSetPause"}, {0xa232cbe6, 0, "__sceSasSetTriangularWave"}, // (int sasCore, int voice, int unknown) {0xd5ebbbcd, 0, "__sceSasSetSteepWave"}, // (int sasCore, int voice, int unknown) // square wave? {0xBD11B7C2, WrapU_U, "__sceSasGetGrain"}, {0xd1e0a01e, WrapU_UI, "__sceSasSetGrain"}, {0xe175ef66, WrapU_U, "__sceSasGetOutputmode"}, - {0xe855bf76, WrapU_UU, "__sceSasSetOutputmode"}, + {0xe855bf76, WrapU_UU, "__sceSasSetOutputmode"}, {0x07f58c24, WrapU_UU, "__sceSasGetAllEnvelopeHeights"}, // (int sasCore, int heightAddr) 32-bit heights, 0-0x40000000 {0xE1CD9561, WrapV_UIUII, "__sceSasSetVoicePCM"}, }; From 453182b7bc99e197fb7013e7d8cd654bdfe5c365 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 14:22:47 +0800 Subject: [PATCH 07/17] Update Core/HLE/FunctionWrappers.h --- Core/HLE/FunctionWrappers.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Core/HLE/FunctionWrappers.h b/Core/HLE/FunctionWrappers.h index 43bd31e6a1..29d7fd3701 100644 --- a/Core/HLE/FunctionWrappers.h +++ b/Core/HLE/FunctionWrappers.h @@ -103,9 +103,7 @@ template void WrapU_I() { RETURN(retval); } -template void WrapU_UIC() { - func(PARAM(0), PARAM(1), Memory::GetCharPointer(PARAM(2))); -} + template void WrapI_I() { int retval = func(PARAM(0)); From 43a89fe4b7f9e04d93187f309b662ed491803ba2 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 15:33:19 +0800 Subject: [PATCH 08/17] Update Core/HLE/sceSas.cpp --- Core/HLE/sceSas.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 46595534ee..c0d66cf05c 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -244,7 +244,7 @@ u32 sceSasGetEndFlag(u32 core) } // Runs the mixer -void _sceSasCore(u32 outAddr) +void _sceSasCore(u32 core, u32 outAddr) { DEBUG_LOG(HLE,"0=sceSasCore(, %08x) (grain: %i samples)", outAddr, sas.grainSize); Memory::Memset(outAddr, 0, sas.grainSize * 2 * 2); @@ -253,7 +253,7 @@ void _sceSasCore(u32 outAddr) } // Another way of running the mixer, what was the difference again? -void _sceSasCoreWithMix(u32 outAddr) +void _sceSasCoreWithMix(u32 core, u32 outAddr) { DEBUG_LOG(HLE,"0=sceSasCoreWithMix(, %08x)", outAddr); sas.mix(outAddr); @@ -541,8 +541,8 @@ void sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop) const HLEFunction sceSasCore[] = { {0x42778a9f, WrapU_UUUUU, "__sceSasInit"}, // (SceUID * sasCore, int grain, int maxVoices, int outputMode, int sampleRate) - {0xa3589d81, WrapV_U<_sceSasCore>, "__sceSasCore"}, - {0x50a14dfc, WrapV_U<_sceSasCoreWithMix>, "__sceSasCoreWithMix"}, // Process and mix into buffer (int sasCore, int sasInOut, int leftVolume, int rightVolume) + {0xa3589d81, WrapV_UU<_sceSasCore>, "__sceSasCore"}, + {0x50a14dfc, WrapV_UU<_sceSasCoreWithMix>, "__sceSasCoreWithMix"}, // Process and mix into buffer (int sasCore, int sasInOut, int leftVolume, int rightVolume) {0x68a46b95, WrapU_U, "__sceSasGetEndFlag"}, // int sasCore {0x440ca7d8, WrapV_UIIIII, "__sceSasSetVolume"}, {0xad84d37f, WrapV_UII, "__sceSasSetPitch"}, From 0739fd23707bf4539cddf8aac48672e32d991d1f Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 15:43:31 +0800 Subject: [PATCH 09/17] Update Core/HLE/sceSas.cpp --- Core/HLE/sceSas.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index c0d66cf05c..17313749f1 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -520,11 +520,11 @@ u32 sceSasSetOutputMode(u32 core, u32 outputMode) u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) { - Memory::Memset(heightsAddr, 0 , sas.length * 4); - for (int i = 0; i < sas.length ; i++) { - int voiceHeight = sas.voices[i].height; - } - return 0; + Memory::Memset(heightsAddr, 0 , sas.length * 4); + for (int i = 0; i < sas.length ; i++) { + int voiceHeight = sas.voices[i].height; + } + return 0; } void sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop) From 86e21c248a4f84c0df8691d57f9dfc4db8e15840 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 15:53:11 +0800 Subject: [PATCH 10/17] Update Core/HLE/sceSas.cpp --- Core/HLE/sceSas.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 17313749f1..cf0706ccd3 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -276,7 +276,7 @@ void sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) u32 sceSasSetPause(u32 core, int voicebit, int pause) { - DEBUG_LOG(HLE,"0=sceSasSetPause(core=%08x, voicebit=%i, pause=%c)", core, voicebit, pause); + DEBUG_LOG(HLE,"0=sceSasSetPause(core=%08x, voicebit=%i, pause=%i)", core, voicebit, pause); for (int i = 0; voicebit != 0; i++, voicebit >>= 1) { if ((voicebit & 1) != 0) { sas.voices[i].setPaused=pause; @@ -485,7 +485,7 @@ void sceSasRevEVOL(u32 core, int lv, int rv) void sceSasRevVON(u32 core, int dry, int wet) { - DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, dry=%i, param2=%i)", core, dry, wet); + DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, dry=%i, wet=%i)", core, dry, wet); waveformEffectIsDryOn = (dry > 0); waveformEffectIsWetOn = (wet > 0); RETURN(0); @@ -520,6 +520,7 @@ u32 sceSasSetOutputMode(u32 core, u32 outputMode) u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) { + DEBUG_LOG(HLE,"0=sceSasGetAllEnvelopeHeights(core=%08x, heightsAddr=%i)", core, heightsAddr); Memory::Memset(heightsAddr, 0 , sas.length * 4); for (int i = 0; i < sas.length ; i++) { int voiceHeight = sas.voices[i].height; From 5231dc0dda0e2b718e2a3377012bc980460db21f Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 16:02:21 +0800 Subject: [PATCH 11/17] Update Core/HLE/sceSas.cpp --- Core/HLE/sceSas.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index cf0706ccd3..4ab6fc0876 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -287,7 +287,7 @@ u32 sceSasSetPause(u32 core, int voicebit, int pause) void sceSasSetVolume(u32 core, int voiceNum, int l, int r, int el, int er) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasSetVolume(core=%08x, voicenum=%i, l=%i, r=%i, el=%i, er=%i", core, voiceNum, l, r, el, er); + DEBUG_LOG(HLE,"0=sceSasSetVolume(core=%08x, voiceNum=%i, l=%i, r=%i, el=%i, er=%i", core, voiceNum, l, r, el, er); Voice &v = sas.voices[voiceNum]; v.volumeLeft = l; v.volumeRight = r; @@ -298,13 +298,13 @@ void sceSasSetPitch(u32 core, int voiceNum, int pitch) { Voice &v = sas.voices[voiceNum]; v.pitch = pitch; - DEBUG_LOG(HLE,"UNIMPL 0=sceSasSetPitch(core=%08x, voicenum=%i, pitch=%i)", core, voiceNum, pitch); + DEBUG_LOG(HLE,"0=sceSasSetPitch(core=%08x, voiceNum=%i, pitch=%i)", core, voiceNum, pitch); RETURN(0); } void sceSasSetKeyOn(u32 core, int voiceNum) { - DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voicenum=%i)", core, voiceNum); + DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voiceNum=%i)", core, voiceNum); Voice &v = sas.voices[voiceNum]; v.vag.Start(Memory::GetPointer(v.vagAddr)); v.playing = true; @@ -315,7 +315,7 @@ void sceSasSetKeyOn(u32 core, int voiceNum) // sceSasSetKeyOff can be used to start sounds, that just sound during the Release phase! void sceSasSetKeyOff(u32 core, int voiceNum) { - DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voicenum=%i)", core, voiceNum); + DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voiceNum=%i)", core, voiceNum); Voice &v = sas.voices[voiceNum]; v.playing = false; // not right! Should directly enter Release envelope stage instead! RETURN(0); @@ -331,7 +331,7 @@ u32 sceSasSetNoise(u32 core, int voiceNum, int freq) u32 sceSasSetSL(u32 core, int voiceNum, int level) { - DEBUG_LOG(HLE,"0=sceSasSetSL(core=%08x, voicenum=%i, level=%i)", core, voiceNum, level); + DEBUG_LOG(HLE,"0=sceSasSetSL(core=%08x, voiceNum=%i, level=%i)", core, voiceNum, level); Voice &v = sas.voices[voiceNum]; v.sustainLevel = level; return 0; @@ -458,7 +458,7 @@ void sceSasRevType(u32 core, int type) void sceSasRevParam(u32 core, int delay, int feedback) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevParam(core=%08x, delay=%i, feedback=%i)", core, delay, feedback); + DEBUG_LOG(HLE,"0=sceSasRevParam(core=%08x, delay=%i, feedback=%i)", core, delay, feedback); waveformEffectDelay = delay; waveformEffectFeedback = feedback; RETURN(0); @@ -485,7 +485,7 @@ void sceSasRevEVOL(u32 core, int lv, int rv) void sceSasRevVON(u32 core, int dry, int wet) { - DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, dry=%i, wet=%i)", core, dry, wet); + DEBUG_LOG(HLE,"0=sceSasRevVON(core=%08x, dry=%i, wet=%i)", core, dry, wet); waveformEffectIsDryOn = (dry > 0); waveformEffectIsWetOn = (wet > 0); RETURN(0); @@ -530,7 +530,7 @@ u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) void sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop) { - DEBUG_LOG(HLE,"0=sceSasSetVoice(core=%08x, voicenum=%i, pcm=%08x, size=%i, loop=%i)",core, voiceNum, pcmAddr, size, loop); + DEBUG_LOG(HLE,"0=sceSasSetVoicePCM(core=%08x, voicenum=%i, pcmAddr=%08x, size=%i, loop=%i)",core, voiceNum, pcmAddr, size, loop); Voice &v = sas.voices[voiceNum]; v.pcmAddr = pcmAddr; v.size = size; From be167141dd5c701ed3d19d524257351da24cf4bf Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 16:05:11 +0800 Subject: [PATCH 12/17] Update Core/HLE/sceSas.cpp --- Core/HLE/sceSas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 4ab6fc0876..ef75567d18 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -304,7 +304,7 @@ void sceSasSetPitch(u32 core, int voiceNum, int pitch) void sceSasSetKeyOn(u32 core, int voiceNum) { - DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voiceNum=%i)", core, voiceNum); + DEBUG_LOG(HLE,"0=sceSasSetKeyOn(core=%08x, voiceNum=%i)", core, voiceNum); Voice &v = sas.voices[voiceNum]; v.vag.Start(Memory::GetPointer(v.vagAddr)); v.playing = true; @@ -323,7 +323,7 @@ void sceSasSetKeyOff(u32 core, int voiceNum) u32 sceSasSetNoise(u32 core, int voiceNum, int freq) { - DEBUG_LOG(HLE,"0=sceSasSetVoice(core=%08x, voiceNum=%i, freq=%i)", core, voiceNum, freq); + DEBUG_LOG(HLE,"0=sceSasSetNoise(core=%08x, voiceNum=%i, freq=%i)", core, voiceNum, freq); Voice &v = sas.voices[voiceNum]; v.freq = freq; return 0; From b6b26e38f6fc24cb8315f60c55ba90f40b1211f8 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Fri, 7 Dec 2012 12:45:16 +0800 Subject: [PATCH 13/17] New functions for sceSas/sceVaudio .Massive checkup on all functions parameters and return value. --- Core/HLE/sceSas.cpp | 149 ++++++++++++++++++++++++++++++----------- Core/HLE/sceVaudio.cpp | 24 ++++++- 2 files changed, 131 insertions(+), 42 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 66eab7c98b..ef75567d18 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -41,6 +41,16 @@ static const int PSP_SAS_ADSR_DECAY=2; static const int PSP_SAS_ADSR_SUSTAIN=4; static const int PSP_SAS_ADSR_RELEASE=8; +int grainSamples; +int output; +int waveformEffectType; +int waveformEffectDelay; +int waveformEffectFeedback ; +int waveformEffectLeftVol; +int waveformEffectRightVol; +int waveformEffectIsDryOn; +int waveformEffectIsWetOn; + static const double f[5][2] = { { 0.0, 0.0 }, { 60.0 / 64.0, 0.0 }, @@ -133,6 +143,7 @@ bool VagDecoder::Decode() struct Voice { u32 vagAddr; + u32 pcmAddr; int samplePos; int size; int loop; @@ -151,8 +162,8 @@ struct Voice int sustainLevel; int releaseType; int pitch; - bool endFlag; - bool PauseFlag; + int setPaused; + int height; bool playing; VagDecoder vag; @@ -166,6 +177,8 @@ public: int grainSize; int maxVoices; int sampleRate; + int outputMode; + int length; void mix(u32 outAddr); }; @@ -205,20 +218,21 @@ void SasInstance::mix(u32 outAddr) } } -u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 unknown, u32 sampleRate) +u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 outputMode, u32 sampleRate) { DEBUG_LOG(HLE,"0=sceSasInit()"); memset(&sas, 0, sizeof(sas)); sas.grainSize = grainSize; sas.maxVoices = maxVoices; sas.sampleRate = sampleRate; + sas.outputMode = outputMode; for (int i = 0; i < 32; i++) { sas.voices[i].playing = false; } return 0; } -u32 sceSasGetEndFlag() +u32 sceSasGetEndFlag(u32 core) { u32 endFlag = 0; for (int i = 0; i < sas.maxVoices; i++) { @@ -230,7 +244,7 @@ u32 sceSasGetEndFlag() } // Runs the mixer -void _sceSasCore(u32 outAddr) +void _sceSasCore(u32 core, u32 outAddr) { DEBUG_LOG(HLE,"0=sceSasCore(, %08x) (grain: %i samples)", outAddr, sas.grainSize); Memory::Memset(outAddr, 0, sas.grainSize * 2 * 2); @@ -239,7 +253,7 @@ void _sceSasCore(u32 outAddr) } // Another way of running the mixer, what was the difference again? -void _sceSasCoreWithMix(u32 outAddr) +void _sceSasCoreWithMix(u32 core, u32 outAddr) { DEBUG_LOG(HLE,"0=sceSasCoreWithMix(, %08x)", outAddr); sas.mix(outAddr); @@ -260,9 +274,20 @@ void sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) RETURN(0); } +u32 sceSasSetPause(u32 core, int voicebit, int pause) +{ + DEBUG_LOG(HLE,"0=sceSasSetPause(core=%08x, voicebit=%i, pause=%i)", core, voicebit, pause); + for (int i = 0; voicebit != 0; i++, voicebit >>= 1) { + if ((voicebit & 1) != 0) { + sas.voices[i].setPaused=pause; + } + } + return 0; +} + void sceSasSetVolume(u32 core, int voiceNum, int l, int r, int el, int er) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasSetVolume(core=%08x, voicenum=%i, l=%i, r=%i, el=%i, er=%i", core, voiceNum, l, r, el, er); + DEBUG_LOG(HLE,"0=sceSasSetVolume(core=%08x, voiceNum=%i, l=%i, r=%i, el=%i, er=%i", core, voiceNum, l, r, el, er); Voice &v = sas.voices[voiceNum]; v.volumeLeft = l; v.volumeRight = r; @@ -273,13 +298,13 @@ void sceSasSetPitch(u32 core, int voiceNum, int pitch) { Voice &v = sas.voices[voiceNum]; v.pitch = pitch; - DEBUG_LOG(HLE,"UNIMPL 0=sceSasSetPitch(core=%08x, voicenum=%i, pitch=%i)", core, voiceNum, pitch); + DEBUG_LOG(HLE,"0=sceSasSetPitch(core=%08x, voiceNum=%i, pitch=%i)", core, voiceNum, pitch); RETURN(0); } void sceSasSetKeyOn(u32 core, int voiceNum) { - DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voicenum=%i)", core, voiceNum); + DEBUG_LOG(HLE,"0=sceSasSetKeyOn(core=%08x, voiceNum=%i)", core, voiceNum); Voice &v = sas.voices[voiceNum]; v.vag.Start(Memory::GetPointer(v.vagAddr)); v.playing = true; @@ -290,7 +315,7 @@ void sceSasSetKeyOn(u32 core, int voiceNum) // sceSasSetKeyOff can be used to start sounds, that just sound during the Release phase! void sceSasSetKeyOff(u32 core, int voiceNum) { - DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voicenum=%i)", core, voiceNum); + DEBUG_LOG(HLE,"0=sceSasSetKeyOff(core=%08x, voiceNum=%i)", core, voiceNum); Voice &v = sas.voices[voiceNum]; v.playing = false; // not right! Should directly enter Release envelope stage instead! RETURN(0); @@ -298,18 +323,18 @@ void sceSasSetKeyOff(u32 core, int voiceNum) u32 sceSasSetNoise(u32 core, int voiceNum, int freq) { - DEBUG_LOG(HLE,"0=sceSasSetVoice(core=%08x, voiceNum=%i, freq=%i)", core, voiceNum, freq); + DEBUG_LOG(HLE,"0=sceSasSetNoise(core=%08x, voiceNum=%i, freq=%i)", core, voiceNum, freq); Voice &v = sas.voices[voiceNum]; v.freq = freq; - return(0); + return 0; } u32 sceSasSetSL(u32 core, int voiceNum, int level) { - DEBUG_LOG(HLE,"0=sceSasSetSL(core=%08x, voicenum=%i, level=%i)", core, voiceNum, level); + DEBUG_LOG(HLE,"0=sceSasSetSL(core=%08x, voiceNum=%i, level=%i)", core, voiceNum, level); Voice &v = sas.voices[voiceNum]; v.sustainLevel = level; - return(0); + return 0; } u32 sceSasSetADSR(u32 core, int voiceNum,int flag ,int a, int d, int s, int r) @@ -331,7 +356,7 @@ u32 sceSasSetADSRMode(u32 core, int voiceNum,int flag ,int a, int d, int s, int if ((flag & 0x2) != 0) v.decayType = d; if ((flag & 0x4) != 0) v.sustainType = s; if ((flag & 0x8) != 0) v.releaseType = r; - return 0; + return 0 ; } // http://code.google.com/p/jpcsp/source/browse/trunk/src/jpcsp/HLE/modules150/sceSasCore.java @@ -426,17 +451,20 @@ u32 sceSasGetEnvelopeHeight(u32 core, u32 voiceNum) void sceSasRevType(u32 core, int type) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevType(core=%08x, type=%i)", core, type); + DEBUG_LOG(HLE,"0=sceSasRevType(core=%08x, type=%i)", core, type); + waveformEffectType=type; RETURN(0); } -void sceSasRevParam(u32 core, int param1, int param2) +void sceSasRevParam(u32 core, int delay, int feedback) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevParam(core=%08x, param1=%i, param2=%i)", core, param1, param2); + DEBUG_LOG(HLE,"0=sceSasRevParam(core=%08x, delay=%i, feedback=%i)", core, delay, feedback); + waveformEffectDelay = delay; + waveformEffectFeedback = feedback; RETURN(0); } -u32 sceSasGetPauseFlag() +u32 sceSasGetPauseFlag(u32 core) { u32 PauseFlag = 0; for (int i = 0; i < sas.maxVoices; i++) { @@ -447,33 +475,76 @@ u32 sceSasGetPauseFlag() return PauseFlag; } - - -void sceSasRevEVOL(u32 core, int param1, int param2) +void sceSasRevEVOL(u32 core, int lv, int rv) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevEVOL(core=%08x, param1=%i, param2=%i)", core, param1, param2); + DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, leftVolume=%i, rightVolume=%i)", core, lv, rv); + waveformEffectLeftVol = lv; + waveformEffectRightVol = rv; RETURN(0); } -void sceSasRevVON(u32 core, int param1, int param2) +void sceSasRevVON(u32 core, int dry, int wet) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasRevEVOL(core=%08x, param1=%i, param2=%i)", core, param1, param2); + DEBUG_LOG(HLE,"0=sceSasRevVON(core=%08x, dry=%i, wet=%i)", core, dry, wet); + waveformEffectIsDryOn = (dry > 0); + waveformEffectIsWetOn = (wet > 0); RETURN(0); } -void sceSasGetOutputMode(u32 core, int param1, int param2) +u32 sceSasGetGrain(u32 core) { - DEBUG_LOG(HLE,"UNIMPL 0=sceSasGetOutputMode(core=%08x, param1=%i, param2=%i)", core, param1, param2); - RETURN(0); + DEBUG_LOG(HLE,"0=sceSasGetGrain(core=%08x)", core); + return grainSamples; } +u32 sceSasSetGrain(u32 core, int grain) +{ + DEBUG_LOG(HLE,"0=sceSasSetGrain(core=%08x, grain=%i)", core, grain); + grainSamples=grain; + return 0; +} + + +u32 sceSasGetOutputMode(u32 core) +{ + DEBUG_LOG(HLE,"0=sceSasGetOutputMode(core=%08x)", core); + return output; +} + +u32 sceSasSetOutputMode(u32 core, u32 outputMode) +{ + DEBUG_LOG(HLE,"0=sceSasSetOutputMode(core=%08x, outputMode=%i)", core, outputMode); + output=outputMode; + return 0; +} + +u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) +{ + DEBUG_LOG(HLE,"0=sceSasGetAllEnvelopeHeights(core=%08x, heightsAddr=%i)", core, heightsAddr); + Memory::Memset(heightsAddr, 0 , sas.length * 4); + for (int i = 0; i < sas.length ; i++) { + int voiceHeight = sas.voices[i].height; + } + return 0; +} + +void sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop) +{ + DEBUG_LOG(HLE,"0=sceSasSetVoicePCM(core=%08x, voicenum=%i, pcmAddr=%08x, size=%i, loop=%i)",core, voiceNum, pcmAddr, size, loop); + Voice &v = sas.voices[voiceNum]; + v.pcmAddr = pcmAddr; + v.size = size; + v.loop = loop; + v.playing = true; + RETURN(0); +} const HLEFunction sceSasCore[] = { {0x42778a9f, WrapU_UUUUU, "__sceSasInit"}, // (SceUID * sasCore, int grain, int maxVoices, int outputMode, int sampleRate) - {0xa3589d81, WrapV_U<_sceSasCore>, "__sceSasCore"}, - {0x50a14dfc, WrapV_U<_sceSasCoreWithMix>, "__sceSasCoreWithMix"}, // Process and mix into buffer (int sasCore, int sasInOut, int leftVolume, int rightVolume) - {0x68a46b95, WrapU_V, "__sceSasGetEndFlag"}, // int sasCore + {0xa3589d81, WrapV_UU<_sceSasCore>, "__sceSasCore"}, + {0x50a14dfc, WrapV_UU<_sceSasCoreWithMix>, "__sceSasCoreWithMix"}, // Process and mix into buffer (int sasCore, int sasInOut, int leftVolume, int rightVolume) + {0x68a46b95, WrapU_U, "__sceSasGetEndFlag"}, // int sasCore {0x440ca7d8, WrapV_UIIIII, "__sceSasSetVolume"}, {0xad84d37f, WrapV_UII, "__sceSasSetPitch"}, {0x99944089, WrapV_UIUII, "__sceSasSetVoice"}, // (int sasCore, int voice, int vagAddr, int size, int loopmode) @@ -489,16 +560,16 @@ const HLEFunction sceSasCore[] = {0xd5a229c9, WrapV_UII, "__sceSasRevEVOL"}, // (int sasCore, int leftVol, int rightVol) // effect volume {0x33d4ab37, WrapV_UI, "__sceSasRevType"}, // (int sasCore, int type) {0x267a6dd2, WrapV_UII, "__sceSasRevParam"}, // (int sasCore, int delay, int feedback) - {0x2c8e6ab3, WrapU_V, "__sceSasGetPauseFlag"}, // int sasCore - {0x787d04d5, 0, "__sceSasSetPause"}, + {0x2c8e6ab3, WrapU_U, "__sceSasGetPauseFlag"}, // int sasCore + {0x787d04d5, WrapU_UII, "__sceSasSetPause"}, {0xa232cbe6, 0, "__sceSasSetTriangularWave"}, // (int sasCore, int voice, int unknown) {0xd5ebbbcd, 0, "__sceSasSetSteepWave"}, // (int sasCore, int voice, int unknown) // square wave? - {0xBD11B7C2, 0, "__sceSasGetGrain"}, - {0xd1e0a01e, 0, "__sceSasSetGrain"}, - {0xe175ef66, WrapV_UII, "__sceSasGetOutputmode"}, - {0xe855bf76, 0, "__sceSasSetOutputmode"}, - {0x07f58c24, 0, "__sceSasGetAllEnvelopeHeights"}, // (int sasCore, int heightAddr) 32-bit heights, 0-0x40000000 - {0xE1CD9561, 0, "__sceSasSetVoicePCM"}, + {0xBD11B7C2, WrapU_U, "__sceSasGetGrain"}, + {0xd1e0a01e, WrapU_UI, "__sceSasSetGrain"}, + {0xe175ef66, WrapU_U, "__sceSasGetOutputmode"}, + {0xe855bf76, WrapU_UU, "__sceSasSetOutputmode"}, + {0x07f58c24, WrapU_UU, "__sceSasGetAllEnvelopeHeights"}, // (int sasCore, int heightAddr) 32-bit heights, 0-0x40000000 + {0xE1CD9561, WrapV_UIUII, "__sceSasSetVoicePCM"}, }; void Register_sceSasCore() diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 6ca72b69d0..d384a95c88 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -19,11 +19,29 @@ #include "sceVaudio.h" +void sceVaudioOutputBlockingFunction() +{ + WARN_LOG(HLE, "HACK sceVaudioOutputBlockingFunction(...)"); + RETURN(0); +} + +void sceVaudioChReserveFunction() +{ + WARN_LOG(HLE, "HACK sceVaudioChReserveFunction(...)"); + RETURN(0); +} + +void sceVaudioChReleaseFunction() +{ + WARN_LOG(HLE, "HACK sceVaudioChReleaseFunction(...)"); + RETURN(0); +} + const HLEFunction sceVaudio[] = { - {0x03b6807d, 0, "sceVaudio_0x03b6807d"}, - {0x67585dfd, 0, "sceVaudio_0x67585dfd"}, - {0x8986295e, 0, "sceVaudio_0x8986295e"}, + {0x03b6807d, sceVaudioOutputBlockingFunction, "sceVaudioOutputBlockingFunction"}, + {0x67585dfd, sceVaudioChReserveFunction, "sceVaudioChReserveFunction"}, + {0x8986295e, sceVaudioChReleaseFunction, "sceVaudioChReleaseFunction"}, }; void Register_sceVaudio() From eff0f8663f3369f8db61594736b9e2c6a80c8923 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 17:24:44 +0800 Subject: [PATCH 14/17] Change HACK to UNIMPL in sceAudio --- Core/HLE/sceVaudio.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index d384a95c88..f1f2519f24 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -21,19 +21,19 @@ void sceVaudioOutputBlockingFunction() { - WARN_LOG(HLE, "HACK sceVaudioOutputBlockingFunction(...)"); + WARN_LOG(HLE, "UNIMPL sceVaudioOutputBlockingFunction(...)"); RETURN(0); } void sceVaudioChReserveFunction() { - WARN_LOG(HLE, "HACK sceVaudioChReserveFunction(...)"); + WARN_LOG(HLE, "UNIMPL sceVaudioChReserveFunction(...)"); RETURN(0); } void sceVaudioChReleaseFunction() { - WARN_LOG(HLE, "HACK sceVaudioChReleaseFunction(...)"); + WARN_LOG(HLE, "UNIMPL sceVaudioChReleaseFunction(...)"); RETURN(0); } From bfb0108959c021e5a2d90540746299b0de4232d0 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 17:26:04 +0800 Subject: [PATCH 15/17] Change HACK to UNIMPL in sceAudio --- Core/HLE/sceVaudio.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index d384a95c88..f1f2519f24 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -21,19 +21,19 @@ void sceVaudioOutputBlockingFunction() { - WARN_LOG(HLE, "HACK sceVaudioOutputBlockingFunction(...)"); + WARN_LOG(HLE, "UNIMPL sceVaudioOutputBlockingFunction(...)"); RETURN(0); } void sceVaudioChReserveFunction() { - WARN_LOG(HLE, "HACK sceVaudioChReserveFunction(...)"); + WARN_LOG(HLE, "UNIMPL sceVaudioChReserveFunction(...)"); RETURN(0); } void sceVaudioChReleaseFunction() { - WARN_LOG(HLE, "HACK sceVaudioChReleaseFunction(...)"); + WARN_LOG(HLE, "UNIMPL sceVaudioChReleaseFunction(...)"); RETURN(0); } From ba83f0041a0f669b56e96dfb1a9c9e9dfd4f9c67 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 17:29:53 +0800 Subject: [PATCH 16/17] Make struct WaveformEffect --- Core/HLE/sceSas.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index ef75567d18..11848edc82 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -43,6 +43,9 @@ static const int PSP_SAS_ADSR_RELEASE=8; int grainSamples; int output; + +struct WaveformEffect +{ int waveformEffectType; int waveformEffectDelay; int waveformEffectFeedback ; @@ -50,6 +53,7 @@ int waveformEffectLeftVol; int waveformEffectRightVol; int waveformEffectIsDryOn; int waveformEffectIsWetOn; +}; static const double f[5][2] = { { 0.0, 0.0 }, @@ -174,6 +178,7 @@ class SasInstance public: enum { NUM_VOICES = 32 }; Voice voices[NUM_VOICES]; + WaveformEffect waveformEffect; int grainSize; int maxVoices; int sampleRate; @@ -452,15 +457,15 @@ u32 sceSasGetEnvelopeHeight(u32 core, u32 voiceNum) void sceSasRevType(u32 core, int type) { DEBUG_LOG(HLE,"0=sceSasRevType(core=%08x, type=%i)", core, type); - waveformEffectType=type; + sas.waveformEffect.waveformEffectType=type; RETURN(0); } void sceSasRevParam(u32 core, int delay, int feedback) { DEBUG_LOG(HLE,"0=sceSasRevParam(core=%08x, delay=%i, feedback=%i)", core, delay, feedback); - waveformEffectDelay = delay; - waveformEffectFeedback = feedback; + sas.waveformEffect.waveformEffectDelay = delay; + sas.waveformEffect.waveformEffectFeedback = feedback; RETURN(0); } @@ -478,16 +483,16 @@ u32 sceSasGetPauseFlag(u32 core) void sceSasRevEVOL(u32 core, int lv, int rv) { DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, leftVolume=%i, rightVolume=%i)", core, lv, rv); - waveformEffectLeftVol = lv; - waveformEffectRightVol = rv; + sas.waveformEffect.waveformEffectLeftVol = lv; + sas.waveformEffect.waveformEffectRightVol = rv; RETURN(0); } void sceSasRevVON(u32 core, int dry, int wet) { DEBUG_LOG(HLE,"0=sceSasRevVON(core=%08x, dry=%i, wet=%i)", core, dry, wet); - waveformEffectIsDryOn = (dry > 0); - waveformEffectIsWetOn = (wet > 0); + sas.waveformEffect.waveformEffectIsDryOn = (dry > 0); + sas.waveformEffect.waveformEffectIsWetOn = (wet > 0); RETURN(0); } From 6cef08fd72f82e25bc7c421ccc34b57ec4991c81 Mon Sep 17 00:00:00 2001 From: jacky400 Date: Sat, 8 Dec 2012 21:07:21 +0800 Subject: [PATCH 17/17] Remove prefix in struct WaveformEffect --- Core/HLE/sceSas.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 11848edc82..96d864b80d 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -46,13 +46,13 @@ int output; struct WaveformEffect { -int waveformEffectType; -int waveformEffectDelay; -int waveformEffectFeedback ; -int waveformEffectLeftVol; -int waveformEffectRightVol; -int waveformEffectIsDryOn; -int waveformEffectIsWetOn; + int type; + int delay; + int feedback ; + int leftVol; + int rightVol; + int isDryOn; + int isWetOn; }; static const double f[5][2] = @@ -457,15 +457,15 @@ u32 sceSasGetEnvelopeHeight(u32 core, u32 voiceNum) void sceSasRevType(u32 core, int type) { DEBUG_LOG(HLE,"0=sceSasRevType(core=%08x, type=%i)", core, type); - sas.waveformEffect.waveformEffectType=type; + sas.waveformEffect.type=type; RETURN(0); } void sceSasRevParam(u32 core, int delay, int feedback) { DEBUG_LOG(HLE,"0=sceSasRevParam(core=%08x, delay=%i, feedback=%i)", core, delay, feedback); - sas.waveformEffect.waveformEffectDelay = delay; - sas.waveformEffect.waveformEffectFeedback = feedback; + sas.waveformEffect.delay = delay; + sas.waveformEffect.feedback = feedback; RETURN(0); } @@ -483,16 +483,16 @@ u32 sceSasGetPauseFlag(u32 core) void sceSasRevEVOL(u32 core, int lv, int rv) { DEBUG_LOG(HLE,"0=sceSasRevEVOL(core=%08x, leftVolume=%i, rightVolume=%i)", core, lv, rv); - sas.waveformEffect.waveformEffectLeftVol = lv; - sas.waveformEffect.waveformEffectRightVol = rv; + sas.waveformEffect.leftVol = lv; + sas.waveformEffect.rightVol = rv; RETURN(0); } void sceSasRevVON(u32 core, int dry, int wet) { DEBUG_LOG(HLE,"0=sceSasRevVON(core=%08x, dry=%i, wet=%i)", core, dry, wet); - sas.waveformEffect.waveformEffectIsDryOn = (dry > 0); - sas.waveformEffect.waveformEffectIsWetOn = (wet > 0); + sas.waveformEffect.isDryOn = (dry > 0); + sas.waveformEffect.isWetOn = (wet > 0); RETURN(0); }