mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Show sceAac contexts in ImDebugger
This commit is contained in:
+13
-13
@@ -26,19 +26,19 @@
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HW/SimpleAudioDec.h"
|
||||
|
||||
static std::map<u32, AuCtx*> aacMap;
|
||||
std::map<u32, AuCtx*> g_aacMap;
|
||||
|
||||
static AuCtx *getAacCtx(u32 id) {
|
||||
if (aacMap.find(id) == aacMap.end())
|
||||
if (g_aacMap.find(id) == g_aacMap.end())
|
||||
return NULL;
|
||||
return aacMap[id];
|
||||
return g_aacMap[id];
|
||||
}
|
||||
|
||||
void __AACShutdown() {
|
||||
for (auto it = aacMap.begin(), end = aacMap.end(); it != end; it++) {
|
||||
for (auto it = g_aacMap.begin(), end = g_aacMap.end(); it != end; it++) {
|
||||
delete it->second;
|
||||
}
|
||||
aacMap.clear();
|
||||
g_aacMap.clear();
|
||||
}
|
||||
|
||||
void __AACDoState(PointerWrap &p) {
|
||||
@@ -46,13 +46,13 @@ void __AACDoState(PointerWrap &p) {
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
Do(p, aacMap);
|
||||
Do(p, g_aacMap);
|
||||
}
|
||||
|
||||
static u32 sceAacExit(u32 id) {
|
||||
if (aacMap.find(id) != aacMap.end()) {
|
||||
delete aacMap[id];
|
||||
aacMap.erase(id);
|
||||
if (g_aacMap.find(id) != g_aacMap.end()) {
|
||||
delete g_aacMap[id];
|
||||
g_aacMap.erase(id);
|
||||
} else {
|
||||
return hleLogError(Log::ME, -1, "bad aac ID");
|
||||
}
|
||||
@@ -105,11 +105,11 @@ static u32 sceAacInit(u32 id)
|
||||
aac->decoder = CreateAudioDecoder(PSP_CODEC_AAC);
|
||||
|
||||
// close the audio if id already exist.
|
||||
if (aacMap.find(id) != aacMap.end()) {
|
||||
delete aacMap[id];
|
||||
aacMap.erase(id);
|
||||
if (g_aacMap.find(id) != g_aacMap.end()) {
|
||||
delete g_aacMap[id];
|
||||
g_aacMap.erase(id);
|
||||
}
|
||||
aacMap[id] = aac;
|
||||
g_aacMap[id] = aac;
|
||||
|
||||
return hleNoLog(id);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
|
||||
|
||||
enum {
|
||||
ERROR_AAC_INVALID_ADDRESS = 0x80691002,
|
||||
ERROR_AAC_INVALID_PARAMETER = 0x80691003,
|
||||
@@ -10,3 +13,7 @@ void __AACShutdown();
|
||||
void __AACDoState(PointerWrap &p);
|
||||
|
||||
void Register_sceAac();
|
||||
|
||||
class AuCtx;
|
||||
// Just for the debugger
|
||||
extern std::map<u32, AuCtx*> g_aacMap;
|
||||
|
||||
@@ -458,6 +458,7 @@ static u32 MpegRequiredMem() {
|
||||
return MPEG_MEMSIZE_0105;
|
||||
}
|
||||
|
||||
// ddrTop is currently ignored.
|
||||
static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr, u32 frameWidth, u32 mode, u32 ddrTop) {
|
||||
if (!Memory::IsValidAddress(mpegAddr)) {
|
||||
return hleLogWarning(Log::Mpeg, -1, "invalid addresses");
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "Core/HLE/SocketManager.h"
|
||||
#include "Core/HLE/NetInetConstants.h"
|
||||
#include "Core/HLE/sceKernelModule.h"
|
||||
#include "Core/HLE/sceAac.h"
|
||||
#include "Core/HLE/sceMpeg.h"
|
||||
#include "Core/HLE/sceNp.h"
|
||||
#include "Core/HLE/sceNet.h"
|
||||
@@ -1272,6 +1273,47 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeaderWithCount("sceAac", (int)g_aacMap.size(), ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (ImGui::BeginTable("aac", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
|
||||
ImGui::TableSetupColumn("Handle", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Channels", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("ReadPos", ImGuiTableColumnFlags_WidthFixed);
|
||||
|
||||
for (auto &iter : g_aacMap) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID(iter.first);
|
||||
ImGui::SetNextItemAllowOverlap();
|
||||
char temp[16];
|
||||
snprintf(temp, sizeof(temp), "%d", iter.first);
|
||||
if (ImGui::Selectable(temp, iter.first == cfg.selectedAacCtx, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
cfg.selectedAacCtx = iter.first;
|
||||
}
|
||||
if (!iter.second) {
|
||||
continue;
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", iter.second->Channels);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", (int)iter.second->ReadPos());
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
auto iter = mp3Map.find(cfg.selectedAacCtx);
|
||||
if (iter != mp3Map.end() && ImGui::CollapsingHeader("AAC %d", iter->first)) {
|
||||
ImGui::Text("AAC Context %d", iter->first);
|
||||
if (iter->second) {
|
||||
AuCtx *ctx = iter->second;
|
||||
ImGui::Text("%d Hz, %d channels", ctx->SamplingRate, ctx->Channels);
|
||||
ImGui::Text("AUBuf: %08x AUSize: %08x", ctx->AuBuf, ctx->AuBufSize);
|
||||
ImGui::Text("PCMBuf: %08x PCMSize: %08x", ctx->PCMBuf, ctx->PCMBufSize);
|
||||
ImGui::Text("Pos: %d (%d -> %d)", ctx->ReadPos(), (int)ctx->startPos, (int)ctx->endPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeaderWithCount("sceAudiocodec", (int)g_audioDecoderContexts.size(), ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (ImGui::BeginTable("codecs", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
|
||||
ImGui::TableSetupColumn("CtxAddr", ImGuiTableColumnFlags_WidthFixed);
|
||||
|
||||
@@ -101,6 +101,7 @@ struct ImConfig {
|
||||
int selectedMemCheck = -1;
|
||||
int selectedAtracCtx = 0;
|
||||
int selectedMp3Ctx = 0;
|
||||
int selectedAacCtx = 0;
|
||||
int selectedMemoryBlock = 0;
|
||||
u32 selectedMpegCtx = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user