mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Break out sceAac from sceMp4.cpp/h
This commit is contained in:
@@ -2276,6 +2276,8 @@ add_library(${CoreLibName} ${CoreLinkType}
|
||||
Core/HLE/sceMt19937.h
|
||||
Core/HLE/sceMd5.cpp
|
||||
Core/HLE/sceMd5.h
|
||||
Core/HLE/sceAac.cpp
|
||||
Core/HLE/sceAac.h
|
||||
Core/HLE/sceMp4.cpp
|
||||
Core/HLE/sceMp4.h
|
||||
Core/HLE/sceMp3.cpp
|
||||
|
||||
@@ -572,6 +572,7 @@
|
||||
<ClCompile Include="HLE\KUBridge.cpp" />
|
||||
<ClCompile Include="HLE\NetInetConstants.cpp" />
|
||||
<ClCompile Include="HLE\Plugins.cpp" />
|
||||
<ClCompile Include="HLE\sceAac.cpp" />
|
||||
<ClCompile Include="HLE\sceKernelHeap.cpp" />
|
||||
<ClCompile Include="HLE\sceNetApctl.cpp" />
|
||||
<ClCompile Include="HLE\sceNetInet.cpp" />
|
||||
@@ -1191,6 +1192,7 @@
|
||||
<ClInclude Include="HLE\KUBridge.h" />
|
||||
<ClInclude Include="HLE\NetInetConstants.h" />
|
||||
<ClInclude Include="HLE\Plugins.h" />
|
||||
<ClInclude Include="HLE\sceAac.h" />
|
||||
<ClInclude Include="HLE\sceKernelHeap.h" />
|
||||
<ClInclude Include="HLE\sceNetApctl.h" />
|
||||
<ClInclude Include="HLE\sceNetInet.h" />
|
||||
|
||||
@@ -1339,6 +1339,9 @@
|
||||
<ClCompile Include="HLE\SocketManager.cpp">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HLE\sceAac.cpp">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ELF\ElfReader.h">
|
||||
@@ -2157,6 +2160,9 @@
|
||||
<ClInclude Include="HLE\SocketManager.h">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HLE\sceAac.h">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\LICENSE.TXT" />
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "sceKernelTime.h"
|
||||
#include "sceMd5.h"
|
||||
#include "sceMp4.h"
|
||||
#include "sceAac.h"
|
||||
#include "sceMp3.h"
|
||||
#include "sceNet.h"
|
||||
#include "sceNetAdhoc.h"
|
||||
@@ -275,6 +276,7 @@ void RegisterAllModules() {
|
||||
Register_sceGameUpdate();
|
||||
Register_sceDeflt();
|
||||
Register_sceMp4();
|
||||
Register_sceAac();
|
||||
Register_scePauth();
|
||||
Register_sceNp();
|
||||
Register_sceNpCommerce2();
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Core/HLE/sceAac.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HW/SimpleAudioDec.h"
|
||||
|
||||
static std::map<u32, AuCtx*> aacMap;
|
||||
|
||||
static AuCtx *getAacCtx(u32 id) {
|
||||
if (aacMap.find(id) == aacMap.end())
|
||||
return NULL;
|
||||
return aacMap[id];
|
||||
}
|
||||
|
||||
void __AACShutdown() {
|
||||
for (auto it = aacMap.begin(), end = aacMap.end(); it != end; it++) {
|
||||
delete it->second;
|
||||
}
|
||||
aacMap.clear();
|
||||
}
|
||||
|
||||
void __AACDoState(PointerWrap &p) {
|
||||
auto s = p.Section("sceAAC", 0, 1);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
Do(p, aacMap);
|
||||
}
|
||||
static u32 sceAacExit(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacExit(id %i)", id);
|
||||
if (aacMap.find(id) != aacMap.end()) {
|
||||
delete aacMap[id];
|
||||
aacMap.erase(id);
|
||||
} else {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceAacInit(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "UNIMPL sceAacInit(%08x)", id);
|
||||
if (!Memory::IsValidAddress(id)) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC Invalid id address %08x", id);
|
||||
return ERROR_AAC_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
AuCtx *aac = new AuCtx();
|
||||
aac->startPos = Memory::Read_U64(id); // AUDIO stream start position.
|
||||
aac->endPos = Memory::Read_U32(id + 8); // AUDIO stream end position.
|
||||
aac->AuBuf = Memory::Read_U32(id + 16); // Input AAC data buffer.
|
||||
aac->AuBufSize = Memory::Read_U32(id + 20); // Input AAC data buffer size.
|
||||
aac->PCMBuf = Memory::Read_U32(id + 24); // Output PCM data buffer.
|
||||
aac->PCMBufSize = Memory::Read_U32(id + 28); // Output PCM data buffer size.
|
||||
aac->freq = Memory::Read_U32(id + 32); // Frequency.
|
||||
if (aac->AuBuf == 0 || aac->PCMBuf == 0) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID ADDRESS AuBuf %08x PCMBuf %08x", aac->AuBuf, aac->PCMBuf);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_ADDRESS;
|
||||
}
|
||||
if (aac->startPos > aac->endPos) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID startPos %lli endPos %lli", aac->startPos, aac->endPos);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_PARAMETER;
|
||||
}
|
||||
if (aac->AuBufSize < 8192 || aac->PCMBufSize < 8192) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID PARAMETER, bufferSize %i outputSize %i", aac->AuBufSize, aac->PCMBufSize);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_PARAMETER;
|
||||
}
|
||||
if (aac->freq != 24000 && aac->freq != 32000 && aac->freq != 44100 && aac->freq != 48000) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID freq %i", aac->freq);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::ME, "startPos %llx endPos %llx AuBuf %08x AuBufSize %08x PCMbuf %08x PCMbufSize %08x freq %d",
|
||||
aac->startPos, aac->endPos, aac->AuBuf, aac->AuBufSize, aac->PCMBuf, aac->PCMBufSize, aac->freq);
|
||||
|
||||
aac->Channels = 2;
|
||||
aac->MaxOutputSample = aac->PCMBufSize / 4;
|
||||
aac->SetReadPos((int)aac->startPos);
|
||||
|
||||
// create aac decoder
|
||||
aac->decoder = CreateAudioDecoder(PSP_CODEC_AAC);
|
||||
|
||||
// close the audio if id already exist.
|
||||
if (aacMap.find(id) != aacMap.end()) {
|
||||
delete aacMap[id];
|
||||
aacMap.erase(id);
|
||||
}
|
||||
aacMap[id] = aac;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
static u32 sceAacInitResource(u32 numberIds)
|
||||
{
|
||||
// Do nothing here
|
||||
INFO_LOG_REPORT(Log::ME, "sceAacInitResource(%i)", numberIds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceAacTermResource()
|
||||
{
|
||||
ERROR_LOG(Log::ME, "UNIMPL sceAacTermResource()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceAacDecode(u32 id, u32 pcmAddr)
|
||||
{
|
||||
// return the size of output pcm, <0 error
|
||||
DEBUG_LOG(Log::ME, "sceAacDecode(id %i, bufferAddress %08x)", id, pcmAddr);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuDecode(pcmAddr);
|
||||
}
|
||||
|
||||
static u32 sceAacGetLoopNum(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacGetLoopNum(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
return ctx->LoopNum;
|
||||
}
|
||||
|
||||
static u32 sceAacSetLoopNum(u32 id, int loop)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacSetLoopNum(id %i,loop %d)", id, loop);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->LoopNum = loop;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sceAacCheckStreamDataNeeded(u32 id)
|
||||
{
|
||||
// return 1 to read more data stream, 0 don't read, <0 error
|
||||
DEBUG_LOG(Log::ME, "sceAacCheckStreamDataNeeded(%i)", id);
|
||||
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuCheckStreamDataNeeded();
|
||||
}
|
||||
|
||||
static u32 sceAacNotifyAddStreamData(u32 id, int size)
|
||||
{
|
||||
// check how many bytes we have read from source file
|
||||
DEBUG_LOG(Log::ME, "sceAacNotifyAddStreamData(%i, %08x)", id, size);
|
||||
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuNotifyAddStreamData(size);
|
||||
}
|
||||
|
||||
static u32 sceAacGetInfoToAddStreamData(u32 id, u32 buff, u32 size, u32 srcPos)
|
||||
{
|
||||
// read from stream position srcPos of size bytes into buff
|
||||
DEBUG_LOG(Log::ME, "sceAacGetInfoToAddStreamData(%08X, %08X, %08X, %08X)", id, buff, size, srcPos);
|
||||
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac handle %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuGetInfoToAddStreamData(buff, size, srcPos);
|
||||
}
|
||||
|
||||
static u32 sceAacGetMaxOutputSample(u32 id)
|
||||
{
|
||||
DEBUG_LOG(Log::ME, "sceAacGetMaxOutputSample(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->MaxOutputSample;
|
||||
}
|
||||
|
||||
static u32 sceAacGetSumDecodedSample(u32 id)
|
||||
{
|
||||
DEBUG_LOG(Log::ME, "sceAacGetSumDecodedSample(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->SumDecodedSamples;
|
||||
}
|
||||
|
||||
static u32 sceAacResetPlayPosition(u32 id) {
|
||||
INFO_LOG(Log::ME, "sceAacResetPlayPosition(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuResetPlayPosition();
|
||||
}
|
||||
|
||||
// 395
|
||||
const HLEFunction sceAac[] = {
|
||||
{0XE0C89ACA, &WrapU_U<sceAacInit>, "sceAacInit", 'x', "x" },
|
||||
{0X33B8C009, &WrapU_U<sceAacExit>, "sceAacExit", 'x', "x" },
|
||||
{0X5CFFC57C, &WrapU_U<sceAacInitResource>, "sceAacInitResource", 'x', "x" },
|
||||
{0X23D35CAE, &WrapU_V<sceAacTermResource>, "sceAacTermResource", 'x', "" },
|
||||
{0X7E4CFEE4, &WrapU_UU<sceAacDecode>, "sceAacDecode", 'x', "xx" },
|
||||
{0X523347D9, &WrapU_U<sceAacGetLoopNum>, "sceAacGetLoopNum", 'x', "x" },
|
||||
{0XBBDD6403, &WrapU_UI<sceAacSetLoopNum>, "sceAacSetLoopNum", 'x', "xi" },
|
||||
{0XD7C51541, &WrapI_U<sceAacCheckStreamDataNeeded>, "sceAacCheckStreamDataNeeded", 'i', "x" },
|
||||
{0XAC6DCBE3, &WrapU_UI<sceAacNotifyAddStreamData>, "sceAacNotifyAddStreamData", 'x', "xi" },
|
||||
{0X02098C69, &WrapU_UUUU<sceAacGetInfoToAddStreamData>, "sceAacGetInfoToAddStreamData", 'x', "xxxx" },
|
||||
{0X6DC7758A, &WrapU_U<sceAacGetMaxOutputSample>, "sceAacGetMaxOutputSample", 'x', "x" },
|
||||
{0X506BF66C, &WrapU_U<sceAacGetSumDecodedSample>, "sceAacGetSumDecodedSample", 'x', "x" },
|
||||
{0XD2DA2BBA, &WrapU_U<sceAacResetPlayPosition>, "sceAacResetPlayPosition", 'x', "x" },
|
||||
};
|
||||
|
||||
void Register_sceAac() {
|
||||
RegisterModule("sceAac", ARRAY_SIZE(sceAac), sceAac);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
|
||||
enum {
|
||||
ERROR_AAC_INVALID_ADDRESS = 0x80691002,
|
||||
ERROR_AAC_INVALID_PARAMETER = 0x80691003,
|
||||
};
|
||||
void __AACShutdown();
|
||||
void __AACDoState(PointerWrap &p);
|
||||
|
||||
void Register_sceAac();
|
||||
@@ -25,29 +25,6 @@
|
||||
#include "Core/HLE/sceMp4.h"
|
||||
#include "Core/HW/SimpleAudioDec.h"
|
||||
|
||||
static std::map<u32, AuCtx*> aacMap;
|
||||
|
||||
static AuCtx *getAacCtx(u32 id) {
|
||||
if (aacMap.find(id) == aacMap.end())
|
||||
return NULL;
|
||||
return aacMap[id];
|
||||
}
|
||||
|
||||
void __AACShutdown() {
|
||||
for (auto it = aacMap.begin(), end = aacMap.end(); it != end; it++) {
|
||||
delete it->second;
|
||||
}
|
||||
aacMap.clear();
|
||||
}
|
||||
|
||||
void __AACDoState(PointerWrap &p) {
|
||||
auto s = p.Section("sceAAC", 0, 1);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
Do(p, aacMap);
|
||||
}
|
||||
|
||||
static u32 sceMp4Init()
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceMp4Init()");
|
||||
@@ -194,207 +171,6 @@ static u32 sceMp4SearchSyncSampleNum()
|
||||
}
|
||||
|
||||
|
||||
// sceAac module starts from here
|
||||
|
||||
static u32 sceAacExit(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacExit(id %i)", id);
|
||||
if (aacMap.find(id) != aacMap.end()) {
|
||||
delete aacMap[id];
|
||||
aacMap.erase(id);
|
||||
}
|
||||
else{
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceAacInit(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "UNIMPL sceAacInit(%08x)", id);
|
||||
if (!Memory::IsValidAddress(id)){
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC Invalid id address %08x", id);
|
||||
return ERROR_AAC_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
AuCtx *aac = new AuCtx();
|
||||
aac->startPos = Memory::Read_U64(id); // AUDIO stream start position.
|
||||
aac->endPos = Memory::Read_U32(id + 8); // AUDIO stream end position.
|
||||
aac->AuBuf = Memory::Read_U32(id + 16); // Input AAC data buffer.
|
||||
aac->AuBufSize = Memory::Read_U32(id + 20); // Input AAC data buffer size.
|
||||
aac->PCMBuf = Memory::Read_U32(id + 24); // Output PCM data buffer.
|
||||
aac->PCMBufSize = Memory::Read_U32(id + 28); // Output PCM data buffer size.
|
||||
aac->freq = Memory::Read_U32(id + 32); // Frequency.
|
||||
if (aac->AuBuf == 0 || aac->PCMBuf == 0) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID ADDRESS AuBuf %08x PCMBuf %08x", aac->AuBuf, aac->PCMBuf);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_ADDRESS;
|
||||
}
|
||||
if (aac->startPos > aac->endPos) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID startPos %lli endPos %lli", aac->startPos, aac->endPos);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_PARAMETER;
|
||||
}
|
||||
if (aac->AuBufSize < 8192 || aac->PCMBufSize < 8192) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID PARAMETER, bufferSize %i outputSize %i", aac->AuBufSize, aac->PCMBufSize);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_PARAMETER;
|
||||
}
|
||||
if (aac->freq != 24000 && aac->freq != 32000 && aac->freq != 44100 && aac->freq != 48000) {
|
||||
ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID freq %i", aac->freq);
|
||||
delete aac;
|
||||
return ERROR_AAC_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::ME, "startPos %llx endPos %llx AuBuf %08x AuBufSize %08x PCMbuf %08x PCMbufSize %08x freq %d",
|
||||
aac->startPos, aac->endPos, aac->AuBuf, aac->AuBufSize, aac->PCMBuf, aac->PCMBufSize, aac->freq);
|
||||
|
||||
aac->Channels = 2;
|
||||
aac->MaxOutputSample = aac->PCMBufSize / 4;
|
||||
aac->SetReadPos((int)aac->startPos);
|
||||
|
||||
// create aac decoder
|
||||
aac->decoder = CreateAudioDecoder(PSP_CODEC_AAC);
|
||||
|
||||
// close the audio if id already exist.
|
||||
if (aacMap.find(id) != aacMap.end()) {
|
||||
delete aacMap[id];
|
||||
aacMap.erase(id);
|
||||
}
|
||||
aacMap[id] = aac;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
static u32 sceAacInitResource(u32 numberIds)
|
||||
{
|
||||
// Do nothing here
|
||||
INFO_LOG_REPORT(Log::ME, "sceAacInitResource(%i)", numberIds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceAacTermResource()
|
||||
{
|
||||
ERROR_LOG(Log::ME, "UNIMPL sceAacTermResource()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceAacDecode(u32 id, u32 pcmAddr)
|
||||
{
|
||||
// return the size of output pcm, <0 error
|
||||
DEBUG_LOG(Log::ME, "sceAacDecode(id %i, bufferAddress %08x)", id, pcmAddr);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuDecode(pcmAddr);
|
||||
}
|
||||
|
||||
static u32 sceAacGetLoopNum(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacGetLoopNum(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
return ctx->LoopNum;
|
||||
}
|
||||
|
||||
static u32 sceAacSetLoopNum(u32 id, int loop)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacSetLoopNum(id %i,loop %d)", id, loop);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->LoopNum = loop;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sceAacCheckStreamDataNeeded(u32 id)
|
||||
{
|
||||
// return 1 to read more data stream, 0 don't read, <0 error
|
||||
DEBUG_LOG(Log::ME, "sceAacCheckStreamDataNeeded(%i)", id);
|
||||
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuCheckStreamDataNeeded();
|
||||
}
|
||||
|
||||
static u32 sceAacNotifyAddStreamData(u32 id, int size)
|
||||
{
|
||||
// check how many bytes we have read from source file
|
||||
DEBUG_LOG(Log::ME, "sceAacNotifyAddStreamData(%i, %08x)", id, size);
|
||||
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuNotifyAddStreamData(size);
|
||||
}
|
||||
|
||||
static u32 sceAacGetInfoToAddStreamData(u32 id, u32 buff, u32 size, u32 srcPos)
|
||||
{
|
||||
// read from stream position srcPos of size bytes into buff
|
||||
DEBUG_LOG(Log::ME, "sceAacGetInfoToAddStreamData(%08X, %08X, %08X, %08X)", id, buff, size, srcPos);
|
||||
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac handle %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuGetInfoToAddStreamData(buff, size, srcPos);
|
||||
}
|
||||
|
||||
static u32 sceAacGetMaxOutputSample(u32 id)
|
||||
{
|
||||
DEBUG_LOG(Log::ME, "sceAacGetMaxOutputSample(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->MaxOutputSample;
|
||||
}
|
||||
|
||||
static u32 sceAacGetSumDecodedSample(u32 id)
|
||||
{
|
||||
DEBUG_LOG(Log::ME, "sceAacGetSumDecodedSample(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->SumDecodedSamples;
|
||||
}
|
||||
|
||||
static u32 sceAacResetPlayPosition(u32 id)
|
||||
{
|
||||
INFO_LOG(Log::ME, "sceAacResetPlayPosition(id %i)", id);
|
||||
auto ctx = getAacCtx(id);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctx->AuResetPlayPosition();
|
||||
}
|
||||
|
||||
static u32 mp4msv_3C2183C7(u32 unknown1, u32 unknown2) {
|
||||
ERROR_LOG(Log::ME, "UNIMPL mp4msv_3C2183C7(%d, %x)", unknown1, unknown2);
|
||||
return 0;
|
||||
@@ -448,23 +224,6 @@ const HLEFunction sceMp4[] =
|
||||
{0X9CA13D1A, nullptr, "mp4msv_9CA13D1A", '?', "" },
|
||||
};
|
||||
|
||||
// 395
|
||||
const HLEFunction sceAac[] = {
|
||||
{0XE0C89ACA, &WrapU_U<sceAacInit>, "sceAacInit", 'x', "x" },
|
||||
{0X33B8C009, &WrapU_U<sceAacExit>, "sceAacExit", 'x', "x" },
|
||||
{0X5CFFC57C, &WrapU_U<sceAacInitResource>, "sceAacInitResource", 'x', "x" },
|
||||
{0X23D35CAE, &WrapU_V<sceAacTermResource>, "sceAacTermResource", 'x', "" },
|
||||
{0X7E4CFEE4, &WrapU_UU<sceAacDecode>, "sceAacDecode", 'x', "xx" },
|
||||
{0X523347D9, &WrapU_U<sceAacGetLoopNum>, "sceAacGetLoopNum", 'x', "x" },
|
||||
{0XBBDD6403, &WrapU_UI<sceAacSetLoopNum>, "sceAacSetLoopNum", 'x', "xi" },
|
||||
{0XD7C51541, &WrapI_U<sceAacCheckStreamDataNeeded>, "sceAacCheckStreamDataNeeded", 'i', "x" },
|
||||
{0XAC6DCBE3, &WrapU_UI<sceAacNotifyAddStreamData>, "sceAacNotifyAddStreamData", 'x', "xi" },
|
||||
{0X02098C69, &WrapU_UUUU<sceAacGetInfoToAddStreamData>, "sceAacGetInfoToAddStreamData", 'x', "xxxx" },
|
||||
{0X6DC7758A, &WrapU_U<sceAacGetMaxOutputSample>, "sceAacGetMaxOutputSample", 'x', "x" },
|
||||
{0X506BF66C, &WrapU_U<sceAacGetSumDecodedSample>, "sceAacGetSumDecodedSample", 'x', "x" },
|
||||
{0XD2DA2BBA, &WrapU_U<sceAacResetPlayPosition>, "sceAacResetPlayPosition", 'x', "x" },
|
||||
};
|
||||
|
||||
const HLEFunction mp4msv[] = {
|
||||
{0x3C2183C7, &WrapU_UU<mp4msv_3C2183C7>, "mp4msv_3C2183C7", 'x', "xx" },
|
||||
{0x9CA13D1A, &WrapU_UU<mp4msv_9CA13D1A>, "mp4msv_9CA13D1A", 'x', "xx" },
|
||||
@@ -474,7 +233,6 @@ const HLEFunction mp4msv[] = {
|
||||
void Register_sceMp4()
|
||||
{
|
||||
RegisterModule("sceMp4", ARRAY_SIZE(sceMp4), sceMp4);
|
||||
RegisterModule("sceAac", ARRAY_SIZE(sceAac), sceAac);
|
||||
}
|
||||
|
||||
void Register_mp4msv()
|
||||
|
||||
@@ -17,12 +17,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
enum {
|
||||
ERROR_AAC_INVALID_ADDRESS = 0x80691002,
|
||||
ERROR_AAC_INVALID_PARAMETER = 0x80691003,
|
||||
};
|
||||
|
||||
void Register_sceMp4();
|
||||
void __AACShutdown();
|
||||
void __AACDoState(PointerWrap &p);
|
||||
void Register_mp4msv();
|
||||
|
||||
@@ -231,6 +231,7 @@
|
||||
<ClInclude Include="..\..\Core\HLE\sceMd5.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceMp3.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceMp4.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceAac.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceMpeg.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceMt19937.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceNet.h" />
|
||||
@@ -491,6 +492,7 @@
|
||||
<ClCompile Include="..\..\Core\HLE\sceMd5.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceMp3.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceMp4.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceAac.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceMpeg.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceMt19937.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceNet.cpp" />
|
||||
|
||||
@@ -450,6 +450,9 @@
|
||||
<ClCompile Include="..\..\Core\HLE\sceMp4.cpp">
|
||||
<Filter>HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Core\HLE\sceAac.cpp">
|
||||
<Filter>HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Core\HLE\sceMpeg.cpp">
|
||||
<Filter>HLE</Filter>
|
||||
</ClCompile>
|
||||
@@ -1540,6 +1543,9 @@
|
||||
<ClInclude Include="..\..\Core\HLE\sceMp4.h">
|
||||
<Filter>HLE</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Core\HLE\sceAac.h">
|
||||
<Filter>HLE</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Core\HLE\sceMpeg.h">
|
||||
<Filter>HLE</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -705,6 +705,7 @@ EXEC_AND_LIB_FILES := \
|
||||
$(SRC)/Core/HLE/sceMpeg.cpp \
|
||||
$(SRC)/Core/HLE/sceMd5.cpp \
|
||||
$(SRC)/Core/HLE/sceMp4.cpp \
|
||||
$(SRC)/Core/HLE/sceAac.cpp \
|
||||
$(SRC)/Core/HLE/sceMp3.cpp \
|
||||
$(SRC)/Core/HLE/sceNet.cpp \
|
||||
$(SRC)/Core/HLE/sceNet_lib.cpp \
|
||||
|
||||
@@ -751,6 +751,7 @@ SOURCES_CXX += \
|
||||
$(COREDIR)/HLE/sceP3da.cpp \
|
||||
$(COREDIR)/HLE/sceMt19937.cpp \
|
||||
$(COREDIR)/HLE/sceMd5.cpp \
|
||||
$(COREDIR)/HLE/sceAac.cpp \
|
||||
$(COREDIR)/HLE/sceMp4.cpp \
|
||||
$(COREDIR)/HLE/sceMp3.cpp \
|
||||
$(COREDIR)/HLE/sceParseHttp.cpp \
|
||||
|
||||
Reference in New Issue
Block a user