mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #20120 from hrydgard/more-atrac-prep
More Atrac prep
This commit is contained in:
commit
72daaac168
8 changed files with 23 additions and 31 deletions
|
@ -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;
|
||||
|
|
|
@ -356,6 +356,5 @@ private:
|
|||
u32 bufferValidBytes_ = 0;
|
||||
u32 bufferHeaderSize_ = 0;
|
||||
|
||||
// Refactor?
|
||||
int atracID_ = -1;
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -227,13 +227,18 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
// NOTE: The below is WRONG! See issue #20095.
|
||||
//
|
||||
// What we should be queueing here is just the sampleAddress and sampleCount. Then when dequeuing is when we should
|
||||
// read the actual data.
|
||||
|
||||
int leftVol = chan.leftVolume;
|
||||
int rightVol = chan.rightVolume;
|
||||
|
||||
if (leftVol == (1 << 15) && rightVol == (1 << 15) && chan.format == PSP_AUDIO_FORMAT_STEREO && IS_LITTLE_ENDIAN) {
|
||||
// TODO: Add mono->stereo conversion to this path.
|
||||
|
||||
// Good news: the volume doesn't affect the values at all.
|
||||
// Good news: the volume (1 << 15), specifically, doesn't affect the values at all.
|
||||
// We can just do a direct memory copy.
|
||||
const u32 totalSamples = chan.sampleCount * (chan.format == PSP_AUDIO_FORMAT_STEREO ? 2 : 1);
|
||||
s16 *buf1 = 0, *buf2 = 0;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -330,7 +330,9 @@ int main(int argc, const char* argv[])
|
|||
PROFILE_INIT();
|
||||
TimeInit();
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
SetCleanExitOnAssert();
|
||||
if (!IsDebuggerPresent()) {
|
||||
SetCleanExitOnAssert();
|
||||
}
|
||||
#else
|
||||
// Ignore sigpipe.
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
|
|
Loading…
Add table
Reference in a new issue