diff --git a/Core/HLE/AtracCtx.h b/Core/HLE/AtracCtx.h index ccd4fcfbd9..c68fef738a 100644 --- a/Core/HLE/AtracCtx.h +++ b/Core/HLE/AtracCtx.h @@ -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; diff --git a/Core/HLE/AtracCtx2.h b/Core/HLE/AtracCtx2.h index caf2883d0d..04688c64a9 100644 --- a/Core/HLE/AtracCtx2.h +++ b/Core/HLE/AtracCtx2.h @@ -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; }; diff --git a/Core/HLE/sceAtrac.h b/Core/HLE/sceAtrac.h index cf550d176b..aae8e224eb 100644 --- a/Core/HLE/sceAtrac.h +++ b/Core/HLE/sceAtrac.h @@ -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 diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 2e81cc4e82..30ecbe4d10 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -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()); + } } } }