Implement sceAtracGetInternalError

This commit is contained in:
Henrik Rydgård committed 2025-03-18 09:36:33 +01:00
1 parent 86d661f312
commit bab09ea30a
4 files changed
+22 -3

No files matched your search

+2
View File
@@ -190,6 +190,8 @@ public:
virtual int GetID() const = 0;
virtual u32 GetInternalCodecError() const { return 0; }
PSPPointer<SceAtracContext> context_{};
virtual AtracStatus BufferState() const = 0;
+10
View File
@@ -450,6 +450,7 @@ u32 Atrac2::DecodeData(u8 *outbuf, u32 outbufPtr, u32 *SamplesNum, u32 *finish,
// Decode failed.
*SamplesNum = 0;
*finish = 0;
context_->codec.err = 0x20b; // checked on hardware for 0xFF corruption. it's possible that there are more codes.
return SCE_ERROR_ATRAC_API_FAIL; // tested.
}
@@ -482,6 +483,7 @@ u32 Atrac2::DecodeData(u8 *outbuf, u32 outbufPtr, u32 *SamplesNum, u32 *finish,
if (info.curOff >= info.dataEnd) {
*finish = 1;
}
context_->codec.err = 0;
return 0;
}
@@ -590,6 +592,14 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer
return 0;
}
u32 Atrac2::GetInternalCodecError() const {
if (context_.IsValid()) {
return context_->codec.err;
} else {
return 0;
}
}
u32 Atrac2::SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) {
return 0;
}
+2
View File
@@ -53,6 +53,8 @@ public:
bool IsNewAtracImpl() const override { return true; }
u32 GetInternalCodecError() const override;
private:
void SeekToSample(int sample);
+8 -3
View File
@@ -304,6 +304,7 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32
return hleNoLog(ret);
}
// Likely a bogus brute-forced name?
static u32 sceAtracEndEntry() {
ERROR_LOG_REPORT(Log::ME, "UNIMPL sceAtracEndEntry()");
return hleNoLog(0);
@@ -385,10 +386,14 @@ static u32 sceAtracGetInternalErrorInfo(int atracID, u32 errorAddr) {
if (err != 0) {
return hleLogError(Log::ME, err);
}
ERROR_LOG(Log::ME, "UNIMPL sceAtracGetInternalErrorInfo(%i, %08x)", atracID, errorAddr);
u32 errorCode = atrac->GetInternalCodecError();
if (Memory::IsValidAddress(errorAddr))
Memory::WriteUnchecked_U32(0, errorAddr);
return 0;
Memory::WriteUnchecked_U32(errorCode, errorAddr);
if (errorCode) {
return hleLogError(Log::ME, 0, "code: %08x", errorCode);
} else {
return hleLogInfo(Log::ME, 0);
}
}
static u32 sceAtracGetMaxSample(int atracID, u32 maxSamplesAddr) {