Stub the rest of the known sceAudioCodec functions.

This commit is contained in:
Henrik Rydgard 2014-03-08 10:41:37 +01:00
parent 2eb6a4e2f2
commit ea3f5a10af

View file

@ -20,17 +20,67 @@
#include "sceAudiocodec.h"
#include "Core/Reporting.h"
int sceAudiocodecInit(u32 audioCodec, int codeType) {
ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecInit(%08x, %x)", audioCodec, codeType);
return 0;
enum {
PSP_CODEC_AT3PLUS = 0x00001000,
PSP_CODEC_AT3 = 0x00001001,
PSP_CODEC_MP3 = 0x00001002,
PSP_CODEC_AAC = 0x00001003,
};
static const char *const codecNames[4] = {
"AT3+", "AT3", "MP3", "AAC",
};
static const char *GetCodecName(int codec) {
if (codec >= PSP_CODEC_AT3PLUS && codec <= PSP_CODEC_AAC) {
return codecNames[codec - PSP_CODEC_AT3PLUS];
} else {
return "(unk)";
}
}
int sceAudiocodecDecode(u32 audioCodec, int codeType) {
ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecDecode(%08x, %x)", audioCodec, codeType);
// Following kaien_fr's sample code https://github.com/hrydgard/ppsspp/issues/5620#issuecomment-37086024
// Should probably store the EDRAM get/release status somewhere within here, etc.
struct AudioCodecContext {
u32_le unknown[6];
u32_le inDataPtr; // 6
u32_le inDataSize; // 7
u32_le outDataPtr; // 8
u32_le audioSamplesPerFrame; // 9
u32_le inDataSizeAgain; // 10 ??
};
int sceAudiocodecInit(u32 ctxPtr, int codec) {
ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecInit(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec));
return 0;
}
int sceAudiocodecGetInfo(u32 audioCodec, int codec) {
ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecGetInfo(%08x, %i)", audioCodec, codec);
int sceAudiocodecDecode(u32 ctxPtr, int codec) {
ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecDecode(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec));
if (!ctxPtr) {
return -1;
}
auto ctx = PSPPointer<AudioCodecContext>::Create(ctxPtr);
return 0;
}
int sceAudiocodecGetInfo(u32 ctxPtr, int codec) {
ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecGetInfo(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec));
return 0;
}
int sceAudiocodecCheckNeedMem(u32 ctxPtr, int codec) {
WARN_LOG(ME, "UNIMPL sceAudiocodecCheckNeedMem(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec));
return 0;
}
int sceAudiocodecGetEDRAM(u32 ctxPtr, int codec) {
WARN_LOG(ME, "UNIMPL sceAudiocodecGetEDRAM(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec));
return 0;
}
int sceAudiocodecReleaseEDRAM(u32 ctxPtr, int codec) {
WARN_LOG(ME, "UNIMPL sceAudiocodecReleaseEDRAM(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec));
return 0;
}
@ -38,9 +88,9 @@ const HLEFunction sceAudiocodec[] = {
{0x70A703F8, WrapI_UI<sceAudiocodecDecode>, "sceAudiocodecDecode"},
{0x5B37EB1D, WrapI_UI<sceAudiocodecInit>, "sceAudiocodecInit"},
{0x8ACA11D5, WrapI_UI<sceAudiocodecGetInfo>, "sceAudiocodecGetInfo"},
{0x3A20A200, 0, "sceAudiocodecGetEDRAM"},
{0x29681260, 0, "sceAudiocodecReleaseEDRAM"},
{0x9D3F790C, 0, "sceAudiocodecCheckNeedMem"},
{0x3A20A200, WrapI_UI<sceAudiocodecGetEDRAM>, "sceAudiocodecGetEDRAM" },
{0x29681260, WrapI_UI<sceAudiocodecReleaseEDRAM>, "sceAudiocodecReleaseEDRAM" },
{0x9D3F790C, WrapI_UI<sceAudiocodecCheckNeedMem>, "sceAudiocodecCheckNeedMem" },
{0x59176a0f, 0, "sceAudiocodec_59176A0F"},
};