minor refactor

This commit is contained in:
Henrik Rydgård 2025-03-08 23:52:35 +01:00
parent 526394dbaa
commit 818e7a99bd
6 changed files with 14 additions and 29 deletions

View file

@ -234,6 +234,14 @@ void Track::DebugLog() {
}
int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) {
// 72 is about the size of the minimum required data to even be valid.
// TODO: Validate stuff more.
if (Memory::ReadUnchecked_U32(addr) != RIFF_CHUNK_MAGIC) {
ERROR_LOG(Log::ME, "Couldn't find RIFF header");
return SCE_ERROR_ATRAC_UNKNOWN_FORMAT;
}
struct RIFFFmtChunk {
u16_le fmtTag;
u16_le channels;

View file

@ -356,6 +356,5 @@ private:
u32 bufferValidBytes_ = 0;
u32 bufferHeaderSize_ = 0;
// Refactor?
int atracID_ = -1;
};

View file

@ -9,31 +9,6 @@
// Windows\x64\debug\PPSSPPHeadless.exe --root pspautotests/tests/../ -o --compare --timeout=30 --graphics=software pspautotests/tests/audio/atrac/... --ignore pspautotests/tests/audio/atrac/second/resetting.prx --ignore pspautotests/tests/audio/atrac/second/replay.prx
//
// See the big comment in sceAtrac.cpp for an overview of the different modes of operation.
//
// Test cases
//
// Halfway buffer
//
// * None found yet
//
// All-data-loaded
//
// * MotoGP (menu music with specified loop). Simple repeated calls to sceAtracDecodeData
// * Archer MacLean's Mercury (in-game, not menu)
// * Crisis Core
//
// Streaming
//
// - Good ones (early)
// * Everybody's Golf 2 (0x2000 buffer size, loop from end)
// * Burnout Legends (no loop, 0x1800 buffer size)
// * Suicide Barbie
// - Others
// * Bleach
// * God of War: Chains of Olympus
// * Ape Academy 2 (bufsize 8192)
// * Half Minute Hero (bufsize 65536)
// * Flatout (tricky! needs investigation)
Atrac2::Atrac2(int atracID, u32 contextAddr, int codecType) {
@ -85,7 +60,7 @@ int Atrac2::SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize
} else {
bufferState_ = ATRAC_STATUS_HALFWAY_BUFFER;
}
return hleLogDebug(Log::ME, 0);
return 0;
}
u32 Atrac2::SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) {

View file

@ -4,10 +4,10 @@
#include "Core/HLE/AtracCtx.h"
class Atrac2 : public AtracBase {
public:
Atrac2(int atracID, u32 contextAddr, int codecType);
void DoState(PointerWrap &p) override;
int GetID() const override { return 0; }

View file

@ -129,6 +129,7 @@ void __AtracNotifyLoadModule(int version, u32 crc, u32 bssAddr, int bssSize) {
g_atracBSS = bssAddr;
g_atracMaxContexts = atracLibVersion <= 0x101 ? 4 : 6; // Need to figure out where the cutoff is.
_dbg_assert_(bssSize >= g_atracMaxContexts * sizeof(SceAtracContext));
NotifyMemInfo(MemBlockFlags::ALLOC, g_atracBSS, g_atracMaxContexts * sizeof(SceAtracContext), "AtracContext");
}
void __AtracNotifyUnloadModule() {
@ -137,6 +138,7 @@ void __AtracNotifyUnloadModule() {
INFO_LOG(Log::ME, "Atrac module unloaded.");
g_atracBSS = 0;
g_atracMaxContexts = 6; // TODO: We should make this zero here.
NotifyMemInfo(MemBlockFlags::FREE, g_atracBSS, g_atracMaxContexts * sizeof(SceAtracContext), "AtracContext");
}
static u32 GetAtracContextAddress(int atracID) {

View file

@ -79,7 +79,8 @@ struct SceAtracIdInfo {
u32_le bufferByte; // 64
u32_le secondBufferByte; // 68
// make sure the size is 128
u8 unk[56];
u8 unk[52];
u32_le atracID;
};
struct SceAtracContext {