mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
[Debug] Add cvar to support dumping xex file for debugging
This commit is contained in:
@@ -91,6 +91,9 @@ DEFINE_CVar(launch_data, "",
|
||||
"Used internally for title-to-title launches.",
|
||||
"General", true, std::string);
|
||||
|
||||
DEFINE_bool(dump_xex, false, "Dump the main XEX to current directory on launch",
|
||||
"General");
|
||||
|
||||
DEFINE_bool(allow_game_relative_writes, false,
|
||||
"Not useful to non-developers. Allows code to write to paths "
|
||||
"relative to game://. Used for "
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
#include "xenia/kernel/user_module.h"
|
||||
|
||||
#include "xenia/base/byte_stream.h"
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/xxhash.h"
|
||||
#include "xenia/cpu/elf_module.h"
|
||||
#include "xenia/emulator.h"
|
||||
|
||||
DECLARE_bool(dump_xex);
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
@@ -156,6 +159,16 @@ X_STATUS UserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
// Runtime takes ownership.
|
||||
auto xex_module =
|
||||
std::make_unique<cpu::XexModule>(processor, kernel_state());
|
||||
if (cvars::dump_xex) {
|
||||
auto dump_name = name_ + ".xex";
|
||||
auto dump_file = xe::filesystem::OpenFile(dump_name, "wb");
|
||||
if (dump_file) {
|
||||
fwrite(addr, 1, length, dump_file);
|
||||
fclose(dump_file);
|
||||
XELOGI("Dumped XEX '{}' ({} bytes)", dump_name, length);
|
||||
}
|
||||
}
|
||||
|
||||
if (!xex_module->Load(name_, path_, addr, length)) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user