From 1323ab2f5f1627b39e48b6f970ad8208fa7af71e Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Nov 2016 20:40:04 -0500 Subject: Kernel/Loader: Grab the system mode from the NCCH ExHeader. 3dsx and elf files default to system mode 2 (96MB allocated to the application). This allows Home Menu to boot without modifications. Closes #1849 --- src/citra/citra.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/citra') diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index e47375f88..c742be231 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -129,16 +129,23 @@ int main(int argc, char** argv) { std::unique_ptr emu_window = std::make_unique(); - System::Init(emu_window.get()); - SCOPE_EXIT({ System::Shutdown(); }); - std::unique_ptr loader = Loader::GetLoader(boot_filename); if (!loader) { LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", boot_filename.c_str()); return -1; } - Loader::ResultStatus load_result = loader->Load(); + u32 system_mode; + Loader::ResultStatus load_result = loader->LoadKernelSystemMode(system_mode); + if (Loader::ResultStatus::Success != load_result) { + LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); + return -1; + } + + System::Init(emu_window.get(), system_mode); + SCOPE_EXIT({ System::Shutdown(); }); + + load_result = loader->Load(); if (Loader::ResultStatus::Success != load_result) { LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); return -1; -- cgit v1.2.3 From d171409f29ce3d8bcf7ed6ce16392b4b4ec97c4b Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 26 Nov 2016 23:13:40 -0500 Subject: Kernel/Loader: Grab the system mode from the NCCH ExHeader. 3dsx and elf files default to system mode 2 (96MB allocated to the application). This allows Home Menu to boot without modifications. Closes #1849 --- src/citra/citra.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/citra') diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index c742be231..f9387e61c 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -135,17 +135,17 @@ int main(int argc, char** argv) { return -1; } - u32 system_mode; - Loader::ResultStatus load_result = loader->LoadKernelSystemMode(system_mode); - if (Loader::ResultStatus::Success != load_result) { - LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); + boost::optional system_mode = loader->LoadKernelSystemMode(); + + if (!system_mode) { + LOG_CRITICAL(Frontend, "Failed to load ROM (Could not determine system mode)!"); return -1; } - System::Init(emu_window.get(), system_mode); + System::Init(emu_window.get(), system_mode.get()); SCOPE_EXIT({ System::Shutdown(); }); - load_result = loader->Load(); + Loader::ResultStatus load_result = loader->Load(); if (Loader::ResultStatus::Success != load_result) { LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); return -1; -- cgit v1.2.3