mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 19:34:39 +01:00
Implement the disassembly mode too
This commit is contained in:
1 parent
08d251b5bc
commit
23954f5403
8 files changed
+119
-143
No files matched your search
@@ -841,7 +841,7 @@ void ImMemView::setHighlightType(MemBlockFlags flags) {
|
||||
}
|
||||
}
|
||||
|
||||
void ImMemDumpWindow::Draw(ImConfig &cfg) {
|
||||
void ImMemDumpWindow::Draw(ImConfig &cfg, MIPSDebugInterface *debug) {
|
||||
ImGui::SetNextWindowSize(ImVec2(200, 300), ImGuiCond_FirstUseEver);
|
||||
|
||||
if (!ImGui::Begin(Title(), &cfg.memDumpOpen)) {
|
||||
@@ -854,12 +854,19 @@ void ImMemDumpWindow::Draw(ImConfig &cfg) {
|
||||
size_ = 0x01800000; // 24MB
|
||||
}
|
||||
|
||||
ImGui::InputScalar("Starting address: ", ImGuiDataType_U32, &address_, NULL, NULL, "%08X");
|
||||
ImGui::InputScalar("Size: ", ImGuiDataType_U32, &size_, NULL, NULL, "%08X");
|
||||
ImGui::InputScalar("Starting address", ImGuiDataType_U32, &address_, NULL, NULL, "%08X");
|
||||
ImGui::InputScalar("Size", ImGuiDataType_U32, &size_, NULL, NULL, "%08X");
|
||||
|
||||
ImGui::InputText("Filename: ", filename_, ARRAY_SIZE(filename_));
|
||||
ImGui::InputText("Filename", filename_, ARRAY_SIZE(filename_));
|
||||
|
||||
if (ImGui::Button("Dump!")) {
|
||||
const char* modes[] = { "Raw", "Disassembly" };
|
||||
int modeIndex = static_cast<int>(mode_);
|
||||
if (ImGui::Combo("Memory Dump Mode", &modeIndex, modes, IM_ARRAYSIZE(modes))) {
|
||||
// Update the current mode if the user selects a new one
|
||||
mode_ = static_cast<MemDumpMode>(modeIndex);
|
||||
}
|
||||
|
||||
if (ImGui::Button(mode_ == MemDumpMode::Raw ? "Dump to file" : "Disassemble to file")) {
|
||||
uint32_t validSize = Memory::ValidSize(address_, size_);
|
||||
if (validSize != size_) {
|
||||
errorMsg_ = "Address range out of bounds";
|
||||
@@ -873,10 +880,15 @@ void ImMemDumpWindow::Draw(ImConfig &cfg) {
|
||||
if (!file) {
|
||||
errorMsg_ = "Couldn't open file for writing";
|
||||
} else {
|
||||
const uint8_t *ptr = Memory::GetPointer(address_);
|
||||
fwrite(ptr, 1, size_, file);
|
||||
fclose(file);
|
||||
if (mode_ == MemDumpMode::Raw) {
|
||||
const uint8_t *ptr = Memory::GetPointer(address_);
|
||||
fwrite(ptr, 1, size_, file);
|
||||
} else {
|
||||
std::string disassembly = DisassembleRange(address_, size_, true, debug);
|
||||
fprintf(file, "%s", disassembly.c_str());
|
||||
}
|
||||
errorMsg_.clear();
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user