@@ -957,14 +957,14 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
957
957
return ;
958
958
}
959
959
960
- if ( ImGui::CollapsingHeader ( " sceMpeg " )) {
961
- const std::map<u32, MpegContext *> &ctxs = __MpegGetContexts ();
960
+ const std::map<u32, MpegContext *> &mpegCtxs = __MpegGetContexts ();
961
+ if ( ImGui::CollapsingHeaderWithCount ( " sceMpeg " , mpegCtxs. size ())) {
962
962
if (ImGui::BeginTable (" mpegs" , 2 , ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
963
963
ImGui::TableSetupColumn (" Addr" , ImGuiTableColumnFlags_WidthFixed);
964
964
ImGui::TableSetupColumn (" VFrames" , ImGuiTableColumnFlags_WidthFixed);
965
965
966
966
ImGui::TableHeadersRow ();
967
- for (auto iter : ctxs ) {
967
+ for (auto iter : mpegCtxs ) {
968
968
ImGui::TableNextRow ();
969
969
ImGui::TableNextColumn ();
970
970
ImGui::PushID (iter.first );
@@ -987,8 +987,8 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
987
987
ImGui::EndTable ();
988
988
}
989
989
990
- auto iter = ctxs .find (cfg.selectedMpegCtx );
991
- if (iter != ctxs .end ()) {
990
+ auto iter = mpegCtxs .find (cfg.selectedMpegCtx );
991
+ if (iter != mpegCtxs .end ()) {
992
992
const MpegContext *ctx = iter->second ;
993
993
char temp[16 ];
994
994
snprintf (temp, sizeof (temp), " sceMpeg context at %08x" , iter->first );
@@ -1003,7 +1003,17 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
1003
1003
}
1004
1004
}
1005
1005
1006
- if (ImGui::CollapsingHeader (" sceAtrac" , ImGuiTreeNodeFlags_DefaultOpen)) {
1006
+ // Count the active atrac contexts so we can display it.
1007
+ const int maxAtracContexts = __AtracMaxContexts ();
1008
+ int atracCount = 0 ;
1009
+ for (int i = 0 ; i < maxAtracContexts; i++) {
1010
+ u32 type;
1011
+ if (__AtracGetCtx (i, &type)) {
1012
+ atracCount++;
1013
+ }
1014
+ }
1015
+
1016
+ if (ImGui::CollapsingHeaderWithCount (" sceAtrac" , atracCount, ImGuiTreeNodeFlags_DefaultOpen)) {
1007
1017
ImGui::Checkbox (" Force FFMPEG" , &g_Config.bForceFfmpegForAudioDec );
1008
1018
if (ImGui::BeginTable (" atracs" , 8 , ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
1009
1019
ImGui::TableSetupColumn (" Index" , ImGuiTableColumnFlags_WidthFixed);
@@ -1016,8 +1026,7 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
1016
1026
ImGui::TableSetupColumn (" Impl" , ImGuiTableColumnFlags_WidthFixed);
1017
1027
1018
1028
ImGui::TableHeadersRow ();
1019
- const int maxContexts = __AtracMaxContexts ();
1020
- for (int i = 0 ; i < maxContexts; i++) {
1029
+ for (int i = 0 ; i < maxAtracContexts; i++) {
1021
1030
u32 codecType = 0 ;
1022
1031
1023
1032
ImGui::TableNextRow ();
@@ -1164,7 +1173,48 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
1164
1173
}
1165
1174
}
1166
1175
1167
- if (ImGui::CollapsingHeader (" sceAudiocodec" , ImGuiTreeNodeFlags_DefaultOpen)) {
1176
+ if (ImGui::CollapsingHeaderWithCount (" sceMp3" , (int )mp3Map.size (), ImGuiTreeNodeFlags_DefaultOpen)) {
1177
+ if (ImGui::BeginTable (" mp3" , 3 , ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
1178
+ ImGui::TableSetupColumn (" Handle" , ImGuiTableColumnFlags_WidthFixed);
1179
+ ImGui::TableSetupColumn (" Channels" , ImGuiTableColumnFlags_WidthFixed);
1180
+ ImGui::TableSetupColumn (" ReadPos" , ImGuiTableColumnFlags_WidthFixed);
1181
+
1182
+ for (auto &iter : mp3Map) {
1183
+ ImGui::TableNextRow ();
1184
+ ImGui::TableNextColumn ();
1185
+ ImGui::PushID (iter.first );
1186
+ ImGui::SetNextItemAllowOverlap ();
1187
+ char temp[16 ];
1188
+ snprintf (temp, sizeof (temp), " %d" , iter.first );
1189
+ if (ImGui::Selectable (temp, iter.first == cfg.selectedMp3Ctx , ImGuiSelectableFlags_SpanAllColumns)) {
1190
+ cfg.selectedMp3Ctx = iter.first ;
1191
+ }
1192
+ if (!iter.second ) {
1193
+ continue ;
1194
+ }
1195
+ ImGui::TableNextColumn ();
1196
+ ImGui::Text (" %d" , iter.second ->Channels );
1197
+ ImGui::TableNextColumn ();
1198
+ ImGui::Text (" %d" , (int )iter.second ->ReadPos ());
1199
+ ImGui::PopID ();
1200
+ }
1201
+ ImGui::EndTable ();
1202
+ }
1203
+
1204
+ auto iter = mp3Map.find (cfg.selectedMp3Ctx );
1205
+ if (iter != mp3Map.end () && ImGui::CollapsingHeader (" MP3 %d" , iter->first )) {
1206
+ ImGui::Text (" MP3 Context %d" , iter->first );
1207
+ if (iter->second ) {
1208
+ AuCtx *ctx = iter->second ;
1209
+ ImGui::Text (" %d Hz, %d channels" , ctx->SamplingRate , ctx->Channels );
1210
+ ImGui::Text (" AUBuf: %08x AUSize: %08x" , ctx->AuBuf , ctx->AuBufSize );
1211
+ ImGui::Text (" PCMBuf: %08x PCMSize: %08x" , ctx->PCMBuf , ctx->PCMBufSize );
1212
+ ImGui::Text (" Pos: %d (%d -> %d)" , ctx->ReadPos (), ctx->startPos , ctx->endPos );
1213
+ }
1214
+ }
1215
+ }
1216
+
1217
+ if (ImGui::CollapsingHeaderWithCount (" sceAudiocodec" , (int )g_audioDecoderContexts.size (), ImGuiTreeNodeFlags_DefaultOpen)) {
1168
1218
if (ImGui::BeginTable (" codecs" , 2 , ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
1169
1219
ImGui::TableSetupColumn (" CtxAddr" , ImGuiTableColumnFlags_WidthFixed);
1170
1220
ImGui::TableSetupColumn (" Type" , ImGuiTableColumnFlags_WidthFixed);
@@ -1186,29 +1236,6 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
1186
1236
}
1187
1237
}
1188
1238
1189
- if (ImGui::CollapsingHeader (" sceMp3" , ImGuiTreeNodeFlags_DefaultOpen)) {
1190
- if (ImGui::BeginTable (" mp3" , 3 , ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
1191
- ImGui::TableSetupColumn (" Handle" , ImGuiTableColumnFlags_WidthFixed);
1192
- ImGui::TableSetupColumn (" Channels" , ImGuiTableColumnFlags_WidthFixed);
1193
- ImGui::TableSetupColumn (" StartPos" , ImGuiTableColumnFlags_WidthFixed);
1194
- // TODO: more..
1195
-
1196
- for (auto &iter : mp3Map) {
1197
- ImGui::TableNextRow ();
1198
- ImGui::TableNextColumn ();
1199
- ImGui::Text (" %d" , iter.first );
1200
- if (!iter.second ) {
1201
- continue ;
1202
- }
1203
- ImGui::TableNextColumn ();
1204
- ImGui::Text (" %d" , iter.second ->Channels );
1205
- ImGui::TableNextColumn ();
1206
- ImGui::Text (" %d" , (int )iter.second ->startPos );
1207
- }
1208
- ImGui::EndTable ();
1209
- }
1210
- }
1211
-
1212
1239
ImGui::End ();
1213
1240
}
1214
1241
0 commit comments