Merge pull request #2196 from Subv/system_mode

Kernel/Loader: Grab the system mode from the NCCH ExHeader.
This commit is contained in:
Yuri Kunde Schlesner 2016-11-27 17:04:11 -08:00 committed by GitHub
commit 3174bfd50c
10 changed files with 66 additions and 21 deletions

View file

@ -129,15 +129,22 @@ int main(int argc, char** argv) {
std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>();
System::Init(emu_window.get());
SCOPE_EXIT({ System::Shutdown(); });
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(boot_filename);
if (!loader) {
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", boot_filename.c_str());
return -1;
}
boost::optional<u32> 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.get());
SCOPE_EXIT({ System::Shutdown(); });
Loader::ResultStatus load_result = loader->Load();
if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);