PCSX2 Documentation/WxWidgets Coding Strategies: Difference between revisions

Line 51: Line 51:
==Core/VM and UI Threading==
==Core/VM and UI Threading==


The emulator core and UI are now running on independent threads, which means the UI cannot safely change the emulator's settings whenever it feels like it. This will result in nasty bugs caused by obscure threading race conditions. To solve this, most Core and UI settings have been separated into two structures, `Pcsx2Config` (for core emu options), and `AppConfig` (wx-UI options). `AppConfig` contains its own copy of `Pcsx2Config` since, as a UI, it needs to maintain both its own options and the options it uses to invoke emulation. The wxUI's instance of AppConfig is called `g_Conf`. The emu core uses its own local copy of settings, called `EmuConfig`, (defined as `extern const Pcsx2Config EmuConfig`).
The emulator core and UI are now running on independent threads, which means the UI cannot safely change the emulator's settings whenever it feels like it. This will result in nasty bugs caused by obscure threading race conditions. To solve this, most Core and UI settings have been separated into two structures, <code>Pcsx2Config</code> (for core emu options), and <code>AppConfig</code> (wx-UI options). <code>AppConfig</code> contains its own copy of <code>Pcsx2Config</code> since, as a UI, it needs to maintain both its own options and the options it uses to invoke emulation. The wxUI's instance of AppConfig is called <code>g_Conf</code>. The emu core uses its own local copy of settings, called <code>EmuConfig</code>, (defined as <code>extern const Pcsx2Config EmuConfig</code>).


There are several other guidelines you need to be aware of before attempting to modify PCSX2 settings. Please read Settings between UI and Core Threads for more details on how to use the two-conf system.
There are several other guidelines you need to be aware of before attempting to modify PCSX2 settings. Please read Settings between UI and Core Threads for more details on how to use the two-conf system.
ninja
782

edits