Cleans up the JIT block viewer in the WX UI.

This code was an absolute mess. It had allocated an arbitrarily large string buffer to hold instructions that were disassembled.

Strip out all of the nasty raw C string manipulation and replaces it with ostringstream usage.
Fixes an issue where if you didn't have a JIT recompiler running then Dolphin would instantly crash if you tried comparing PPC to x86 code.
Changed the disassembly of the host side code from being inline to the function to instead being in a class, this will be required when I add support
for ARMv7 and AArch64 to this window.
This commit is contained in:
Ryan Houdek
2014-10-21 01:53:01 -05:00
parent c048691a57
commit ecf65d6f1f
2 changed files with 126 additions and 70 deletions

View File

@ -4,7 +4,10 @@
#pragma once
#include <disasm.h> // Bochs
#include <memory>
#include <vector>
#include <wx/defs.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
@ -30,6 +33,26 @@ public:
void Update() override;
};
class HostDisassembler
{
public:
std::string DisassembleBlock(u32* address, u32* host_instructions_count, u32* code_size);
private:
virtual std::string DisassembleHostBlock(const u8* code_start, const u32 code_size, u32* host_instructions_count) { return ""; }
};
class HostDisassemblerX86 : public HostDisassembler
{
public:
HostDisassemblerX86();
private:
disassembler m_disasm;
std::string DisassembleHostBlock(const u8* code_start, const u32 code_size, u32* host_instructions_count) override;
};
class CJitWindow : public wxPanel
{
public:
@ -48,6 +71,7 @@ private:
void Compare(u32 em_address);
JitBlockList* block_list;
std::unique_ptr<HostDisassembler> m_disassembler;
wxButton* button_refresh;
wxTextCtrl* ppc_box;
wxTextCtrl* x86_box;