ImDebugger: Add more atrac information

This commit is contained in:
Henrik Rydgård 2025-03-11 10:29:59 +01:00
parent 67c8703302
commit 54acb07ded
4 changed files with 40 additions and 7 deletions

View file

@ -232,6 +232,8 @@ public:
virtual int GetSoundSample(int *endSample, int *loopStartSample, int *loopEndSample) const = 0;
virtual bool IsNewAtracImpl() const { return false; }
protected:
Track track_{};
u16 outputChannels_ = 2;

View file

@ -51,6 +51,8 @@ public:
void UpdateContextFromPSPMem() override {}
void NotifyGetContextAddress() override {}
bool IsNewAtracImpl() const override { return true; }
private:
void SeekToSample(int sample);
@ -61,5 +63,5 @@ private:
// We skip some samples at the start.
// TODO: This is ugly, I want a stateless solution..
int discardedSamples_;
int discardedSamples_ = 0;
};

View file

@ -64,8 +64,8 @@ struct SceAtracIdInfo {
u32_le endSample; // 4
u32_le loopStart; // 8
u32_le loopEnd; // 12
s32_le firstValidSample; // 16 // This seems to be the number of skipped samples at the start.
char numFrame; // 20 // This seems to just stay at zero.
s32_le firstValidSample; // 16 // This seems to be the number of skipped samples at the start.
char numFrame; // 20 // This seems to just stay at zero, not sure what it's for.
AtracStatus_le state; // 21
char unk22;
char numChan; // 23

View file

@ -958,13 +958,14 @@ void DrawAudioDecodersView(ImConfig &cfg, ImControl &control) {
}
if (ImGui::CollapsingHeader("sceAtrac", ImGuiTreeNodeFlags_DefaultOpen)) {
if (ImGui::BeginTable("atracs", 6, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
if (ImGui::BeginTable("atracs", 7, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("Index", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Status", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("OutChans", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("CurrentSample", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("RemainingFrames", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Impl", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableHeadersRow();
@ -1004,6 +1005,8 @@ void DrawAudioDecodersView(ImConfig &cfg, ImControl &control) {
ImGui::Text("%d", pos);
ImGui::TableNextColumn();
ImGui::Text("%d", ctx->RemainingFrames());
ImGui::TableNextColumn();
ImGui::TextUnformatted(ctx->IsNewAtracImpl() ? "NewImpl" : "Legacy");
}
ImGui::EndTable();
@ -1022,9 +1025,35 @@ void DrawAudioDecodersView(ImConfig &cfg, ImControl &control) {
ctx->GetSoundSample(&endSample, &loopStart, &loopEnd);
ImGui::ProgressBar((float)pos / (float)endSample, ImVec2(200.0f, 0.0f));
ImGui::Text("Status: %s", AtracStatusToString(ctx->BufferState()));
ImGui::Text("cur/end sample: %d/%d", pos, endSample);
ImGui::Text("ctx addr: "); ImGui::SameLine(); ImClickableValue("addr", ctx->Decoder()->GetCtxPtr(), control, ImCmd::SHOW_IN_MEMORY_VIEWER);
ImGui::Text("loop: %d", ctx->LoopNum());
ImGui::Text("cur/end sample: %d/%d/%d", pos, endSample);
if (ctx->context_.IsValid()) {
ImGui::Text("ctx addr: ");
ImGui::SameLine();
ImClickableValue("ctx", ctx->context_.ptr, control, ImCmd::SHOW_IN_MEMORY_VIEWER);
}
if (ctx->context_.IsValid() && ctx->IsNewAtracImpl()) {
const auto &info = ctx->context_->info;
ImGui::Text("Buffer: (size: %d / %08x) Frame: %d", info.bufferByte, info.bufferByte, info.sampleSize);
ImGui::SameLine();
ImClickableValue("buffer", info.buffer, control, ImCmd::SHOW_IN_MEMORY_VIEWER);
if (info.secondBuffer || info.secondBufferByte) {
ImGui::Text("Second: (size: %d / %08x)", info.secondBufferByte, info.secondBufferByte);
ImGui::SameLine();
ImClickableValue("second", info.secondBuffer, control, ImCmd::SHOW_IN_MEMORY_VIEWER);
}
ImGui::Text("Data: %d/%d", info.dataOff, info.dataEnd);
if (info.state != ATRAC_STATUS_STREAMED_WITHOUT_LOOP) {
ImGui::Text("LoopNum: %d (%d-%d)", info.loopNum, info.loopStart, info.loopEnd);
}
ImGui::Text("DecodePos: %d EndSample: %d", info.decodePos, info.dataEnd);
if (AtracStatusIsStreaming(info.state)) {
ImGui::Text("Stream: offset %d, streamDataBytes: %d", info.streamOff, info.streamDataByte);
}
// Display unknown vars.
ImGui::Text("numFrame: %d unk22: %d unk52: %d", info.numFrame, info.unk22, info.unk52);
} else {
ImGui::Text("loop: %d", ctx->LoopNum());
}
}
}
}