diff options
| author | 2016-11-19 20:40:04 -0500 | |
|---|---|---|
| committer | 2016-11-19 20:40:04 -0500 | |
| commit | 1323ab2f5f1627b39e48b6f970ad8208fa7af71e (patch) | |
| tree | 6b3257864d76a4cdd3d8bb9847e55a2a51ff7573 /src/citra_qt/main.cpp | |
| parent | Merge pull request #2172 from jroweboy/fix-mingw (diff) | |
| download | yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.gz yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.xz yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.zip | |
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
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 0bf9f48d6..9589da4ba 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -253,7 +253,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) { | |||
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | bool GMainWindow::InitializeSystem() { | 256 | bool GMainWindow::InitializeSystem(u32 system_mode) { |
| 257 | // Shutdown previous session if the emu thread is still active... | 257 | // Shutdown previous session if the emu thread is still active... |
| 258 | if (emu_thread != nullptr) | 258 | if (emu_thread != nullptr) |
| 259 | ShutdownGame(); | 259 | ShutdownGame(); |
| @@ -270,7 +270,7 @@ bool GMainWindow::InitializeSystem() { | |||
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | // Initialize the core emulation | 272 | // Initialize the core emulation |
| 273 | System::Result system_result = System::Init(render_window); | 273 | System::Result system_result = System::Init(render_window, system_mode); |
| 274 | if (System::Result::Success != system_result) { | 274 | if (System::Result::Success != system_result) { |
| 275 | switch (system_result) { | 275 | switch (system_result) { |
| 276 | case System::Result::ErrorInitVideoCore: | 276 | case System::Result::ErrorInitVideoCore: |
| @@ -299,8 +299,21 @@ bool GMainWindow::LoadROM(const std::string& filename) { | |||
| 299 | return false; | 299 | return false; |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | u32 system_mode; | ||
| 303 | Loader::ResultStatus load_result = app_loader->LoadKernelSystemMode(system_mode); | ||
| 304 | if (Loader::ResultStatus::Success != load_result) { | ||
| 305 | LOG_CRITICAL(Frontend, "Failed to load ROM!", load_result); | ||
| 306 | QMessageBox::critical(this, tr("Error while loading ROM!"), | ||
| 307 | tr("Could not determine the system mode.")); | ||
| 308 | return false; | ||
| 309 | } | ||
| 310 | |||
| 311 | if (!InitializeSystem(system_mode)) | ||
| 312 | return false; | ||
| 313 | |||
| 302 | Loader::ResultStatus result = app_loader->Load(); | 314 | Loader::ResultStatus result = app_loader->Load(); |
| 303 | if (Loader::ResultStatus::Success != result) { | 315 | if (Loader::ResultStatus::Success != result) { |
| 316 | System::Shutdown(); | ||
| 304 | LOG_CRITICAL(Frontend, "Failed to load ROM!"); | 317 | LOG_CRITICAL(Frontend, "Failed to load ROM!"); |
| 305 | 318 | ||
| 306 | switch (result) { | 319 | switch (result) { |
| @@ -338,14 +351,9 @@ void GMainWindow::BootGame(const std::string& filename) { | |||
| 338 | LOG_INFO(Frontend, "Citra starting..."); | 351 | LOG_INFO(Frontend, "Citra starting..."); |
| 339 | StoreRecentFile(filename); // Put the filename on top of the list | 352 | StoreRecentFile(filename); // Put the filename on top of the list |
| 340 | 353 | ||
| 341 | if (!InitializeSystem()) | 354 | if (!LoadROM(filename)) |
| 342 | return; | 355 | return; |
| 343 | 356 | ||
| 344 | if (!LoadROM(filename)) { | ||
| 345 | System::Shutdown(); | ||
| 346 | return; | ||
| 347 | } | ||
| 348 | |||
| 349 | // Create and start the emulation thread | 357 | // Create and start the emulation thread |
| 350 | emu_thread = std::make_unique<EmuThread>(render_window); | 358 | emu_thread = std::make_unique<EmuThread>(render_window); |
| 351 | emit EmulationStarting(emu_thread.get()); | 359 | emit EmulationStarting(emu_thread.get()); |