From 4c8584da710811a682d33f994da37e5f0c6a6dc7 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 5 Jan 2013 18:10:13 +0100 Subject: [PATCH] Add the correct spelling of sceAtracGetBufferInfoForResetting. Add a psmf function. --- Core/HLE/sceAtrac.cpp | 36 +++++++++++++++++++++++++++++------- Core/HLE/scePsmf.cpp | 32 ++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index b996633261..ac63743253 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -29,10 +29,36 @@ #define ATRAC_ERROR_ALL_DATA_DECODED 0x80630024 +struct Atrac { + +}; + +Atrac globalAtrac; + +// TODO: Properly. +Atrac *getAtrac(int atracID) { + if (atracID == 1) { + return &globalAtrac; + } else { + return 0; + } +} + + +u32 sceAtracGetAtracID(int codecType) +{ + ERROR_LOG(HLE, "FAKE sceAtracGetAtracID(%i)", codecType); + return 1; +} u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) { ERROR_LOG(HLE, "UNIMPL sceAtracAddStreamData(%i, %08x)", atracID, bytesToAdd); + Atrac *atrac = getAtrac(atracID); + if (!atrac) { + return -1; + } + // TODO return 0; } @@ -56,15 +82,11 @@ u32 sceAtracEndEntry() return 0; } -u32 sceAtracGetAtracID(int codecType) -{ - ERROR_LOG(HLE, "UNIMPL sceAtracGetAtracID(%i)", codecType); - return 1; -} - u32 sceAtracGetBufferInfoForReseting(int atracID, int sample, u32 bufferInfoAddr) { ERROR_LOG(HLE, "UNIMPL sceAtracGetBufferInfoForReseting(%i, %i, %08x)",atracID, sample, bufferInfoAddr); + // TODO: Write the right stuff instead. + Memory::Memset(bufferInfoAddr, 0, 32); return 0; } @@ -254,7 +276,7 @@ const HLEFunction sceAtrac3plus[] = {0x132f1eca,WrapI_V,"sceAtracReinit"}, {0xeca32a99,WrapI_I,"sceAtracIsSecondBufferNeeded"}, {0x0fae370e,WrapI_IUUU,"sceAtracSetHalfwayBufferAndGetID"}, - {0x2DD3E298,0,"sceAtracGetBufferInfoForResetting"}, + {0x2DD3E298,WrapU_IIU,"sceAtracGetBufferInfoForResetting"}, {0x5CF9D852,0,"sceAtracSetMOutHalfwayBuffer"}, {0xB3B5D042,WrapI_IU,"sceAtracGetOutputChannel"}, {0xF6837A1A,0,"sceAtracSetMOutData"}, diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index f54ff71c43..c11a9df580 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -57,6 +57,7 @@ class PsmfStream; // TODO: Change to work directly with the data in RAM instead of this // JPSCP-esque class. typedef std::map PsmfStreamMap; + class Psmf { public: Psmf(u32 data); @@ -324,8 +325,7 @@ u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamType, u32 return 0; } -u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) -{ +u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) { INFO_LOG(HLE, "scePsmfGetVideoInfo(%08x, %08x)", psmfStruct, videoInfoAddr); Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { @@ -339,8 +339,7 @@ u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) return 0; } -u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) -{ +u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) { INFO_LOG(HLE, "scePsmfGetAudioInfo(%08x, %08x)", psmfStruct, audioInfoAddr); Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { @@ -354,11 +353,28 @@ u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) return 0; } +u32 scePsmfGetCurrentStreamType(u32 psmfStruct, u32 typeAddr, u32 channelAddr) { + INFO_LOG(HLE, "scePsmfGetCurrentStreamType(%08x, %08x, %08x)", psmfStruct, typeAddr, channelAddr); + Psmf *psmf = getPsmf(psmfStruct); + if (!psmf) { + ERROR_LOG(HLE, "scePsmfGetCurrentStreamType - invalid psmf"); + return ERROR_PSMF_NOT_FOUND; + } + if (Memory::IsValidAddress(typeAddr)) { + u32 type = 0, channel = 0; + if (psmf->streamMap.find(psmf->currentStreamNum) != psmf->streamMap.end()) + type = psmf->streamMap[psmf->currentStreamNum]->type; + if (psmf->streamMap.find(psmf->currentStreamNum) != psmf->streamMap.end()) + channel = psmf->streamMap[psmf->currentStreamNum]->channel; + Memory::Write_U32(type, typeAddr); + Memory::Write_U32(channel, channelAddr); + } + return 0; +} -const HLEFunction scePsmf[] = -{ - {0xc22c8327,&WrapU_UU,"scePsmfSetPsmfFunction"}, - {0xC7DB3A5B,0,"scePsmfGetCurrentStreamTypeFunction"}, +const HLEFunction scePsmf[] = { + {0xc22c8327,WrapU_UU,"scePsmfSetPsmfFunction"}, + {0xC7DB3A5B,WrapU_UUU,"scePsmfGetCurrentStreamTypeFunction"}, {0x28240568,0,"scePsmfGetCurrentStreamNumberFunction"}, {0x1E6D9013,&WrapU_UUU,"scePsmfSpecifyStreamWithStreamTypeFunction"}, {0x0C120E1D,&WrapU_UUU,"scePsmfSpecifyStreamWithStreamTypeNumberFunction"},