PCSX2 Documentation: Difference between revisions

From PCSX2 Wiki
Jump to navigation Jump to search
(Add a link to the ipc protocol)
 
(67 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This page is an attempt to clearly document the workings of the PCSX2 code, to make life easier for those who wish to join the project. I beg any PCSX2 developers to please populate this guide as much as possible.
==Building and Compiling PCSX2==
*[[PCSX2 Documentation/Compiling on Windows|Compiling on Windows]]
*[[PCSX2 Documentation/Compiling on Linux|Compiling on Linux]]
*[[PCSX2 Documentation/PCSX2 Build Scripts|PCSX2 Build Scripts]]
*[[PCSX2 Documentation/Chroot and 64-bit Linux|Chroot and 64-bit Linux]]
*[[PCSX2 Documentation/GNU Debugger Tips|GNU Debugger Tips]]
*[[PCSX2 Documentation/Git Survival Guide|Git Survival Guide]]
*[[PCSX2 Documentation/How to Create Useful and Valid Issues|How to Create Useful and Valid Issues]]
*[[PCSX2 Documentation/Commenting Etiquette|Commenting Etiquette]]
*[[PCSX2 Documentation/Code Formatting Guidelines|Code Formatting Guidelines]]
*[[PCSX2 Documentation/Contributing To-Do List|Contributing To-Do List]]
*[[PCSX2 Documentation/Google Code svn repository comments archive|Google Code svn repository comments archive]]


==Introduction for Developers==
==WxWidgets Framework==
*[[Compiling on Windows]]
*[[PCSX2 Documentation/Measuring the Benefits of wxWidgets|Measuring the Benefits of wxWidgets]]
*[[Compiling on Linux]]
*[[PCSX2 Documentation/WxWidgets Coding Strategies|WxWidgets Coding Strategies]]
*[[Introduction for Developers]]
*[[PCSX2 Documentation/The PCSX2 Program Flow|The PCSX2 Program Flow]]


==PCSX2 Developer's Guide==
==Threading==
*[[Code Formatting Guidelines]]
*[[PCSX2 Documentation/Passing Settings Between Threads|Passing Settings Between Threads]]
*[[Commenting Etiquette]]
*[[PCSX2 Documentation/Threading Basics|Threading Basics]]
*[[Contributing To-Do List]]
*[[PCSX2 Documentation/Threading Advanced|Threading Advanced]]
*[[Git Survival Guide]]
*[[PCSX2 Documentation/Thread Synchronization|Thread Synchronization]]
*[[How to Create Useful and Valid Issues]]
*[[PCSX2 Documentation/Thread Counting|Thread Counting]]
*[[WxWidgets Coding Strategies]]
*[[PCSX2 Documentation/Benchmarking Multithreaded PCSX2|Benchmarking Multithreaded PCSX2]]
*[[PCSX2 Documentation/Threading VU1|Threading VU1]]


==Articles from the old SVN (To be sorted and updated)==
==PCSX2 Core==
*[[Passing Settings Between Threads]]
*[[PCSX2 Documentation/PCSX2 Optimization|PCSX2 Optimization]]
In PCSX2, the User Interface and the Virtual Machine both incorporate multithreaded design. Because of this, the UI and VM threads cannot modify each others' data and configurations directly, unless they first assure that the other thread is in a completely suspended state.
*[[PCSX2 Documentation/So maybe it's about time we explained VTLB|So maybe it's about time we explained VTLB]]
*[[PCSX2 Documentation/Events o' Plenty|Events o' Plenty]]
*[[PCSX2 Documentation/Recompilers: All 'dems buzzwords?|Recompilers: All 'dems buzzwords?]]
*[[PCSX2 Documentation/C++ exceptions can be an optimization|C++ exceptions can be an optimization]]
*[[PCSX2 Documentation/What's clamping? And why do we need it?|What's clamping? And why do we need it?]]
*[[PCSX2 Documentation/PS2 VU (Vector Unit) Documentation Part 1|PS2 VU (Vector Unit) Documentation Part 1]]
*[[PCSX2 Documentation/A new kind of fullscreen!|A new kind of fullscreen!]]
*[[PCSX2 Documentation/Introduction to Dynamic Recompilation|Introduction to Dynamic Recompilation]]
*[[PCSX2 Documentation/The return of the Commandline!|The return of the Commandline!]]
*[[PCSX2 Documentation/Advanced memory management|Advanced memory management]]
*[[PCSX2 Documentation/VirtualAlloc on Linux|VirtualAlloc on Linux]]
*[[PCSX2 Documentation/PS2's Programmable DMA|PS2's Programmable DMA]]
*[[PCSX2 Documentation/MSVC 2008 optimizer fail|MSVC 2008 optimizer fail]]
*[[PCSX2 Documentation/Path 3 Masking / Geometry Syncing|Path 3 Masking / Geometry Syncing]]
*[[PCSX2 Documentation/MMU mini-series|MMU mini-series]]
*[[PCSX2 Documentation/Virtual Memory|Virtual Memory]]
*[[PCSX2 Documentation/Nightmare on Floating-Point Street|Nightmare on Floating-Point Street]]
*[[PCSX2 Documentation/64-bit Recompilation|64-bit Recompilation]]
*[[PCSX2_Documentation/PCSX2_EE_Recompiler|EE Recompiler Internal]]
*[[PCSX2_Documentation/IPC_Protocol|IPC Protocol]]


Modifying Configuration Settings via Suspension
==PCSX2 Plugins==
The safest and easiest way to modify the virtual machine's settings is by completely suspending it. When suspended, the VM thread will not be accessing any variables, and thus anything within its domain can be read and modified freely.
*[[PCSX2 Documentation/PCSX2 Plugin Interface|PCSX2 Plugin Interface]]


Note that the Main/UI thread is forbidden from being suspended -- such a case results in the entire program becoming unresponsive -- and so there is no mechanism provided within PCSX2 for suspending the main thread. If the VM thread needs to communicate data back to the Main/UI thread, it must do so using cross-threadd messages.
===Graphics Synthesizer===
*[[PCSX2 Documentation/Graphics Synthesizer, GPUs and Dual Cores|Graphics Synthesizer, GPUs and Dual Cores]]
*[[PCSX2 Documentation/GSdx Demystified|GSdx Demystified]]
*[[PCSX2 Documentation/GSdx Debug|GSdx Debug]]


Modifying Configuration Settings Directly
===Sound===
EmuConfig is the VM's internal copy of emulation settings. It is defined const for a reason, as it should typically not be written to directly by either UI or VM threads, unless the VM thread is known to be in a suspended state. But there is some good news! Some members of EmuConfig are safe to be modified on-the-fly, thanks to the Atomic Operations Criteria enforced by x86 CPUs. As a general rule of thumb, any value that is a complete 8, 16, or 32 bit type can be written to by the UI thread at any time safely. If you are still in doubt, modifiable sections of the EmuConfig structure have been given explicit accessors that return non-const references to those sections.
*[[PCSX2 Documentation/SPU2 is more than just sound!|SPU2 is more than just sound!]]
*[[PCSX2 Documentation/Reverb Engine|Reverb Engine]]


: list modifiable structures here
==Translation Info==
*[[PCSX2 Documentation/Supported Languages|Supported Languages]]
*[[PCSX2 Documentation/Translation Guide|Translation Guide]]
*[[PCSX2 Documentation/Using Poedit|Using Poedit]]


Modifying Configuration Settings from the Virtual Machine
This is a NO-NO! The VM threads should not modify the contents of EmuConfig, this too is not recommended since the UI thread will be unaware of the changes and won't save them. Furthermore, the UI thread expects to be able to modify atomic members of the struct without locks (noted above), and if the VM thread is also modifying them, a race condition will occur.


In order to have settings changes saved you must modify the contents of the g_Conf structure, and modification of that should only be done from the context of the UI thread. If the VM thread wants to make permanent modifications to the user's configuration (and there's not a lot of good reason for that), then it should be done using message postings.
{{PCSX2 Documentation Navbox}}
 
==Excerpts from the Developer's Blog==
*[[Virtual Memory]]: Jul '06
*[[Nightmare on Floating-Point Street]]: Aug '06
*[[64-bit Recompilation]]: Oct '06
*[[PCSX2 Optimization]]: Jan '07
*[[Graphics Synthesizer, GPUs and Dual Cores]]: Aug '07
*[[So maybe it's about time we explained VTLB]]: Feb '09
*[[Events o' Plenty]]: Jun '09
*[[Recompilers: All 'dems buzzwords?]]: Jun '09
*[[Measuring the Benefits of wxWidgets]]: Jul '09
*[[C++ exceptions can be an optimization]]: Aug '09
*[[What's clamping? And why do we need it?]]: Aug '09
*[[PS2 VU (Vector Unit) Documentation Part 1]]: Sep '09
*[[Thread Synchronization]]: Oct '09
*[[Thread Counting]]: Oct '09
*[[A new kind of fullscreen!]]: Jan '10
*[[Introduction to Dynamic Recompilation]]: Mar '10
*[[SPU2 is more than just sound!]]: Mar '10
*[[The return of the Commandline!]]: Jun '10
*[[Advanced memory management]]: Aug '10
*[[VirtualAlloc on Linux]]: Aug '10
*[[PS2's Programmable DMA]]: Aug '10
*[[MSVC 2008 optimizer fail]]: Sep '10
*[[Benchmarking Multithreaded PCSX2]]: Oct '10
*[[Threading VU1]]: Aug '11
*[[Path 3 Masking / Geometry Syncing]]: Sep '11
*[[MMU mini-series]]: Nov '14
 
==PCSX2 Code Documentation==
*[[PCSX2 Build Scripts]]
*[[PCSX2 GUI]]
*[[PCSX2 Core]]
*[[GSdx Plugin]]

Latest revision as of 09:04, 1 September 2020

Building and Compiling PCSX2

WxWidgets Framework

Threading

PCSX2 Core

PCSX2 Plugins

Graphics Synthesizer

Sound

Translation Info