From b0051b2203d8319e57603ee6cbfaa5cd798de060 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 18 May 2014 19:59:36 +0200 Subject: Refine command list debugging functionality and its qt interface. --- src/video_core/gpu_debugger.h | 23 +++++++++++++++-------- src/video_core/pica.h | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index 7ad595493..5ece0a8b7 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -22,7 +22,8 @@ public: { Pica::CommandHeader& GetHeader() { - return *(Pica::CommandHeader*)&(front()); + u32& val = at(1); + return *(Pica::CommandHeader*)&val; } }; @@ -90,14 +91,20 @@ public: void CommandListCalled(u32 address, u32* command_list, u32 size_in_words) { - // TODO: Decoding fun - - // For now, just treating the whole command list as a single command PicaCommandList cmdlist; - cmdlist.push_back(PicaCommand()); - auto& cmd = cmdlist[0]; - cmd.reserve(size_in_words); - std::copy(command_list, command_list+size_in_words, std::back_inserter(cmd)); + for (u32* parse_pointer = command_list; parse_pointer < command_list + size_in_words;) + { + const Pica::CommandHeader header = static_cast(parse_pointer[1]); + + cmdlist.push_back(PicaCommand()); + auto& cmd = cmdlist.back(); + + size_t size = 2 + header.extra_data_length; + cmd.reserve(size); + std::copy(parse_pointer, parse_pointer + size, std::back_inserter(cmd)); + + parse_pointer += size; + } auto obj = std::pair(address, cmdlist); auto it = std::find(command_lists.begin(), command_lists.end(), obj); diff --git a/src/video_core/pica.h b/src/video_core/pica.h index dab861408..8ebe0dc3c 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -24,6 +24,8 @@ enum class CommandId : u32 }; union CommandHeader { + CommandHeader(u32 h) : hex(h) {} + u32 hex; BitField< 0, 16, CommandId> cmd_id; -- cgit v1.2.3