@ -248,17 +248,32 @@ void GMainWindow::OnDisplayTitleBars(bool show)
}
}
}
}
void GMainWindow : : BootGame ( const std : : string & filename ) {
bool GMainWindow : : InitializeSystem ( ) {
LOG_INFO ( Frontend , " Citra starting... " ) ;
// Shutdown previous session if the emu thread is still active...
// Shutdown previous session if the emu thread is still active...
if ( emu_thread ! = nullptr )
if ( emu_thread ! = nullptr )
ShutdownGame ( ) ;
ShutdownGame ( ) ;
// Initialize the core emulation
// Initialize the core emulation
System : : Init ( render_window ) ;
System : : Result system_result = System : : Init ( render_window ) ;
if ( System : : Result : : Success ! = system_result ) {
switch ( system_result ) {
case System : : Result : : ErrorInitVideoCore :
QMessageBox : : critical ( this , tr ( " Error while starting Citra! " ) ,
tr ( " Failed to initialize the video core! \n \n "
" Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver. " ) ) ;
break ;
// Load the game
default :
QMessageBox : : critical ( this , tr ( " Error while starting Citra! " ) ,
tr ( " Unknown error (please check the log)! " ) ) ;
break ;
}
return false ;
}
return true ;
}
bool GMainWindow : : LoadROM ( const std : : string & filename ) {
Loader : : ResultStatus result = Loader : : LoadFile ( filename ) ;
Loader : : ResultStatus result = Loader : : LoadFile ( filename ) ;
if ( Loader : : ResultStatus : : Success ! = result ) {
if ( Loader : : ResultStatus : : Success ! = result ) {
LOG_CRITICAL ( Frontend , " Failed to load ROM! " ) ;
LOG_CRITICAL ( Frontend , " Failed to load ROM! " ) ;
@ -269,26 +284,37 @@ void GMainWindow::BootGame(const std::string& filename) {
// Build the MessageBox ourselves to have clickable link
// Build the MessageBox ourselves to have clickable link
QMessageBox popup_error ;
QMessageBox popup_error ;
popup_error . setTextFormat ( Qt : : RichText ) ;
popup_error . setTextFormat ( Qt : : RichText ) ;
popup_error . setWindowTitle ( tr ( " Error while loading ROM !" ) ) ;
popup_error . setWindowTitle ( tr ( " Error while loading ROM !" ) ) ;
popup_error . setText ( tr ( " The ROM is probably encrypted ! <br/><br/>"
popup_error . setText ( tr ( " The game that you are trying to load must be decrypted before being used with Citra. <br/><br/>"
" Please check: <a href='https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges'>https://github.com/citra-emu/citra /wiki/Dumping-Game-Cartridges</a>" ) ) ;
" For more information on dumping and decrypting games, please see: <a href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://citra-emu.org /wiki/Dumping-Game-Cartridges</a>" ) ) ;
popup_error . setIcon ( QMessageBox : : Critical ) ;
popup_error . setIcon ( QMessageBox : : Critical ) ;
popup_error . exec ( ) ;
popup_error . exec ( ) ;
break ;
break ;
}
}
case Loader : : ResultStatus : : ErrorInvalidFormat :
case Loader : : ResultStatus : : ErrorInvalidFormat :
QMessageBox : : critical ( this , tr ( " Error while loading ROM !" ) ,
QMessageBox : : critical ( this , tr ( " Error while loading ROM !" ) ,
tr ( " The ROM format is not supported. " ) ) ;
tr ( " The ROM format is not supported. " ) ) ;
break ;
break ;
case Loader : : ResultStatus : : Error :
case Loader : : ResultStatus : : Error :
default :
default :
QMessageBox : : critical ( this , tr ( " Error while loading ROM !" ) ,
QMessageBox : : critical ( this , tr ( " Error while loading ROM !" ) ,
tr ( " Unknown error !" ) ) ;
tr ( " Unknown error !" ) ) ;
break ;
break ;
}
}
return ;
return false ;
}
}
return true ;
}
void GMainWindow : : BootGame ( const std : : string & filename ) {
LOG_INFO ( Frontend , " Citra starting... " ) ;
if ( ! InitializeSystem ( ) )
return ;
if ( ! LoadROM ( filename ) )
return ;
// Create and start the emulation thread
// Create and start the emulation thread
emu_thread = Common : : make_unique < EmuThread > ( render_window ) ;
emu_thread = Common : : make_unique < EmuThread > ( render_window ) ;