|
|
Line 21: |
Line 21: |
| <code>in [https://github.com/PCSX2/pcsx2/blob/master/pcsx2/gui/AppInit.cpp AppInit.cpp]</code> | | <code>in [https://github.com/PCSX2/pcsx2/blob/master/pcsx2/gui/AppInit.cpp AppInit.cpp]</code> |
| <source lang="cpp"> | | <source lang="cpp"> |
| bool Pcsx2App::OnInit()
| | EnableAllLogging(); |
| {
| | Console.WriteLn("Interface is initializing. Entering Pcsx2App::OnInit!"); |
| | |
| // Enable logging, and write some stuff to the PCSX2 console.
| |
| | |
| EnableAllLogging();
| |
| Console.WriteLn("Interface is initializing. Entering Pcsx2App::OnInit!");
| |
| | |
| InitCPUTicks();
| |
| | |
| pxDoAssert = AppDoAssert;
| |
| pxDoOutOfMemory = SysOutOfMemory_EmergencyResponse;
| |
| | |
| g_Conf = new AppConfig();
| |
| wxInitAllImageHandlers();
| |
| | |
| Console.WriteLn("Applying operating system default language...");
| |
| i18n_SetLanguage( wxLANGUAGE_DEFAULT );
| |
| | |
| Console.WriteLn("Command line parsing...");
| |
| if( !_parent::OnInit() ) return false;
| |
| Console.WriteLn("Command line parsed!");
| |
| | |
| i18n_SetLanguagePath();
| |
| | |
| #define pxAppMethodEventHandler(func) \
| |
| (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxInvokeAppMethodEventFunction, &func )
| |
| | |
| Connect( pxID_PadHandler_Keydown, wxEVT_KEY_DOWN, wxKeyEventHandler (Pcsx2App::OnEmuKeyDown) );
| |
| Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler (Pcsx2App::OnDestroyWindow) );
| |
| | |
| // User/Admin Mode Dual Setup:
| |
| // PCSX2 now supports two fundamental modes of operation. The default is Classic mode,
| |
| // which uses the Current Working Directory (CWD) for all user data files, and requires
| |
| // Admin access on Vista (and some Linux as well). The second mode is the Vista-
| |
| // compatible \documents folder usage. The mode is determined by the presence and
| |
| // contents of a usermode.ini file in the CWD. If the ini file is missing, we assume
| |
| // the user is setting up a classic install. If the ini is present, we read the value of
| |
| // the UserMode and SettingsPath vars.
| |
| //
| |
| // Conveniently this dual mode setup applies equally well to most modern Linux distros.
| |
| | |
| try
| |
| {
| |
| InitDefaultGlobalAccelerators();
| |
| delete wxLog::SetActiveTarget( new pxLogConsole() );
| |
| | |
| #ifdef __WXMSW__
| |
| pxDwm_Load();
| |
| #endif
| |
| SysExecutorThread.Start();
| |
| DetectCpuAndUserMode();
| |
| | |
| // Set Manual Exit Handling
| |
| // ----------------------------
| |
| // PCSX2 has a lot of event handling logistics, so we *cannot* depend on wxWidgets automatic event
| |
| // loop termination code. We have a much safer system in place that continues to process messages
| |
| // until all "important" threads are closed out -- not just until the main frame is closed(-ish).
| |
| m_timer_Termination = new wxTimer( this, wxID_ANY );
| |
| Connect( m_timer_Termination->GetId(), wxEVT_TIMER, wxTimerEventHandler(Pcsx2App::OnScheduledTermination) );
| |
| SetExitOnFrameDelete( false );
| |
| | |
| | |
| // Start GUI and/or Direct Emulation
| |
| // -------------------------------------
| |
| if( Startup.ForceConsole ) g_Conf->ProgLogBox.Visible = true;
| |
| OpenProgramLog();
| |
| AllocateCoreStuffs();
| |
| if( m_UseGUI ) OpenMainFrame();
| |
| | |
|
| |
| (new GameDatabaseLoaderThread())->Start();
| |
| | |
| if( Startup.SysAutoRun )
| |
| {
| |
| // Notes: Saving/remembering the Iso file is probably fine and desired, so using
| |
| // SysUpdateIsoSrcFile is good(ish).
| |
| // Saving the cdvd plugin override isn't desirable, so we don't assign it into g_Conf.
| |
| | |
| g_Conf->EmuOptions.UseBOOT2Injection = !Startup.NoFastBoot;
| |
| SysUpdateIsoSrcFile( Startup.IsoFile );
| |
| sApp.SysExecute( Startup.CdvdSource );
| |
| }
| |
| }
| |
| // ----------------------------------------------------------------------------
| |
| catch( Exception::StartupAborted& ex ) // user-aborted, no popups needed.
| |
| {
| |
| Console.Warning( ex.FormatDiagnosticMessage() );
| |
| CleanupOnExit();
| |
| return false;
| |
| }
| |
| catch( Exception::HardwareDeficiency& ex )
| |
| {
| |
| Msgbox::Alert( ex.FormatDisplayMessage() + L"\n\n" + AddAppName(_("Press OK to close %s.")), _("PCSX2 Error: Hardware Deficiency") );
| |
| CleanupOnExit();
| |
| return false;
| |
| }
| |
| // ----------------------------------------------------------------------------
| |
| // Failures on the core initialization procedure (typically OutOfMemory errors) are bad,
| |
| // since it means the emulator is completely non-functional. Let's pop up an error and
| |
| // exit gracefully-ish.
| |
| //
| |
| catch( Exception::RuntimeError& ex )
| |
| {
| |
| Console.Error( ex.FormatDiagnosticMessage() );
| |
| Msgbox::Alert( ex.FormatDisplayMessage() + L"\n\n" + AddAppName(_("Press OK to close %s.")),
| |
| AddAppName(_("%s Critical Error")), wxICON_ERROR );
| |
| CleanupOnExit();
| |
| return false;
| |
| }
| |
| return true;
| |
| }
| |
| </source> | | </source> |
| | Enable logging, and write some stuff to the console. |
|
| |
|
| ==WxWidgets Frames== | | ==WxWidgets Frames== |