mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									fb13bfe693
								
							
						
					
					
						commit
						1323ab2f5f
					
				
					 10 changed files with 67 additions and 22 deletions
				
			
		|  | @ -253,7 +253,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| bool GMainWindow::InitializeSystem() { | ||||
| bool GMainWindow::InitializeSystem(u32 system_mode) { | ||||
|     // Shutdown previous session if the emu thread is still active...
 | ||||
|     if (emu_thread != nullptr) | ||||
|         ShutdownGame(); | ||||
|  | @ -270,7 +270,7 @@ bool GMainWindow::InitializeSystem() { | |||
|     } | ||||
| 
 | ||||
|     // Initialize the core emulation
 | ||||
|     System::Result system_result = System::Init(render_window); | ||||
|     System::Result system_result = System::Init(render_window, system_mode); | ||||
|     if (System::Result::Success != system_result) { | ||||
|         switch (system_result) { | ||||
|         case System::Result::ErrorInitVideoCore: | ||||
|  | @ -299,8 +299,21 @@ bool GMainWindow::LoadROM(const std::string& filename) { | |||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     u32 system_mode; | ||||
|     Loader::ResultStatus load_result = app_loader->LoadKernelSystemMode(system_mode); | ||||
|     if (Loader::ResultStatus::Success != load_result) { | ||||
|         LOG_CRITICAL(Frontend, "Failed to load ROM!", load_result); | ||||
|         QMessageBox::critical(this, tr("Error while loading ROM!"), | ||||
|                               tr("Could not determine the system mode.")); | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     if (!InitializeSystem(system_mode)) | ||||
|         return false; | ||||
| 
 | ||||
|     Loader::ResultStatus result = app_loader->Load(); | ||||
|     if (Loader::ResultStatus::Success != result) { | ||||
|         System::Shutdown(); | ||||
|         LOG_CRITICAL(Frontend, "Failed to load ROM!"); | ||||
| 
 | ||||
|         switch (result) { | ||||
|  | @ -338,14 +351,9 @@ void GMainWindow::BootGame(const std::string& filename) { | |||
|     LOG_INFO(Frontend, "Citra starting..."); | ||||
|     StoreRecentFile(filename); // Put the filename on top of the list
 | ||||
| 
 | ||||
|     if (!InitializeSystem()) | ||||
|     if (!LoadROM(filename)) | ||||
|         return; | ||||
| 
 | ||||
|     if (!LoadROM(filename)) { | ||||
|         System::Shutdown(); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     // Create and start the emulation thread
 | ||||
|     emu_thread = std::make_unique<EmuThread>(render_window); | ||||
|     emit EmulationStarting(emu_thread.get()); | ||||
|  |  | |||
|  | @ -60,7 +60,12 @@ signals: | |||
|     void EmulationStopping(); | ||||
| 
 | ||||
| private: | ||||
|     bool InitializeSystem(); | ||||
|     /**
 | ||||
|      * Initializes the emulation system. | ||||
|      * @param system_mode The system mode with which to intialize the kernel. | ||||
|      * @returns Whether the system was properly initialized. | ||||
|      */ | ||||
|     bool InitializeSystem(u32 system_mode); | ||||
|     bool LoadROM(const std::string& filename); | ||||
|     void BootGame(const std::string& filename); | ||||
|     void ShutdownGame(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue