PCSX2 Documentation/The PCSX2 Program Flow: Difference between revisions

From PCSX2 Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
''The following article is a very general overview of the general flow of the PCSX2 application.''
===AppMain.cpp - this is where the fun begins!===
===AppMain.cpp - this is where the fun begins!===
There is a lot that happens under the hood with wxWidgets. We don't need to worry about that. All we need to worry about is this this line of code in [https://github.com/PCSX2/pcsx2/blob/master/pcsx2/gui/AppMain.cpp AppMain.cpp].  
There is a lot that happens under the hood with wxWidgets. We don't need to worry about that. All we need to worry about is this this line of code in [https://github.com/PCSX2/pcsx2/blob/master/pcsx2/gui/AppMain.cpp AppMain.cpp].  

Revision as of 20:29, 25 February 2015

The following article is a very general overview of the general flow of the PCSX2 application.

AppMain.cpp - this is where the fun begins!

There is a lot that happens under the hood with wxWidgets. We don't need to worry about that. All we need to worry about is this this line of code in AppMain.cpp. <source lang="cpp">IMPLEMENT_APP(Pcsx2App)</source> This macro tells the wxWidgets framework that we want to fire up Pcsx2App. Easy, right?

Pcsx2App - the part we care about

So where does Pcsx2App live? Well, the declarations are in the header file App.h and the definitions are in a few different files. But let's first take a look at the header file. <source lang=cpp> class Pcsx2App : public wxAppWithHelpers{ ... } </source> You can see here that the Pcsx2App class is an extension of the wxAppWithHelpers class. Pcsx2App contains methods that wxWidgets is going to call upon at various times. So what gets called when we fire up Pcsx2App? Why that would be the OnInit() method which is defined in AppInit.cpp. <source lang=cpp> bool Pcsx2App::OnInit() { EnableAllLogging(); Console.WriteLn("Interface is initializing. Entering Pcsx2App::OnInit!");

       ...

} </source> There's all kinds of fun stuff happening here! First we're enabling logging, and sending items to the console log. PCSX2 has it's own C