[Kernel] Allow specifying of additional command-line passed to guest.

This commit is contained in:
gibbed 2018-06-06 19:56:03 -05:00
parent 43b987da1e
commit 40e8d78d16
1 changed files with 13 additions and 4 deletions

View File

@ -27,6 +27,8 @@
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
#include "xenia/kernel/xthread.h"
DEFINE_string(cl, "", "Specify additional command-line provided to guest.");
DEFINE_bool(kernel_debug_monitor, false, "Enable debug monitor.");
DEFINE_bool(kernel_cert_monitor, false, "Enable cert monitor.");
DEFINE_bool(kernel_pix, false, "Enable PIX.");
@ -174,13 +176,20 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
// The name of the xex. Not sure this is ever really used on real devices.
// Perhaps it's how swap disc/etc data is sent?
// Always set to "default.xex" (with quotes) for now.
uint32_t pExLoadedCommandLine = memory_->SystemHeapAlloc(1024);
// TODO(gibbed): set this to the actual module name.
std::string command_line("\"default.xex\"");
if (FLAGS_cl.length()) {
command_line += " " + FLAGS_cl;
}
uint32_t command_line_length =
xe::align(static_cast<uint32_t>(command_line.length()) + 1, 1024u);
uint32_t pExLoadedCommandLine = memory_->SystemHeapAlloc(command_line_length);
auto lpExLoadedCommandLine = memory_->TranslateVirtual(pExLoadedCommandLine);
export_resolver_->SetVariableMapping(
"xboxkrnl.exe", ordinals::ExLoadedCommandLine, pExLoadedCommandLine);
char command_line[] = "\"default.xex\"";
std::memcpy(lpExLoadedCommandLine, command_line,
xe::countof(command_line) + 1);
std::memset(lpExLoadedCommandLine, 0, command_line_length);
std::memcpy(lpExLoadedCommandLine, command_line.c_str(),
command_line.length());
// XboxKrnlVersion (8b)
// Kernel version, looks like 2b.2b.2b.2b.