65af90669b
It's a relatively big commit (less big with -w), but it's hard to test any of this separately... The basic problem is that in netplay or movies, the state of the CPU must be deterministic, including when the game receives notification that the GPU has processed FIFO data. Dual core mode notifies the game whenever the GPU thread actually gets around to doing the work, so it isn't deterministic. Single core mode is because it notifies the game 'instantly' (after processing the data synchronously), but it's too slow for many systems and games. My old dc-netplay branch worked as follows: everything worked as normal except the state of the CP registers was a lie, and the CPU thread only delivered results when idle detection triggered (waiting for the GPU if they weren't ready at that point). Usually, a game is idle iff all the work for the frame has been done, except for a small amount of work depending on the GPU result, so neither the CPU or the GPU waiting on the other affected performance much. However, it's possible that the game could be waiting for some earlier interrupt, and any of several games which, for whatever reason, never went into a detectable idle (even when I tried to improve the detection) would never receive results at all. (The current method should have better compatibility, but it also has slightly higher overhead and breaks some other things, so I want to reimplement this, hopefully with less impact on the code, in the future.) With this commit, the basic idea is that the CPU thread acts as if the work has been done instantly, like single core mode, but actually hands it off asynchronously to the GPU thread (after backing up some data that the game might change in memory before it's actually done). Since the work isn't done, any feedback from the GPU to the CPU, such as real XFB/EFB copies (virtual are OK), EFB pokes, performance queries, etc. is broken; but most games work with these options disabled, and there is no need to try to detect what the CPU thread is doing. Technically: when the flag g_use_deterministic_gpu_thread (currently stuck on) is on, the CPU thread calls RunGpu like in single core mode. This function synchronously copies the data from the FIFO to the internal video buffer and updates the CP registers, interrupts, etc. However, instead of the regular ReadDataFromFifo followed by running the opcode decoder, it runs ReadDataFromFifoOnCPU -> OpcodeDecoder_Preprocess, which relatively quickly scans through the FIFO data, detects SetFinish calls etc., which are immediately fired, and saves certain associated data from memory (e.g. display lists) in AuxBuffers (a parallel stream to the main FIFO, which is a bit slow at the moment), before handing the data off to the GPU thread to actually render. That makes up the bulk of this commit. In various circumstances, including the aforementioned EFB pokes and performance queries as well as swap requests (i.e. the end of a frame - we don't want the CPU potentially pumping out frames too quickly and the GPU falling behind*), SyncGPU is called to wait for actual completion. The overhead mainly comes from OpcodeDecoder_Preprocess (which is, again, synchronous), as well as the actual copying. Currently, display lists and such are escrowed from main memory even though they usually won't change over the course of a frame, and textures are not even though they might, resulting in a small chance of graphical glitches. When the texture locking (i.e. fault on write) code lands, I can make this all correct and maybe a little faster. * This suggests an alternate determinism method of just delaying results until a short time before the end of each frame. For all I know this might mostly work - I haven't tried it - but if any significant work hinges on the competion of render to texture etc., the frame will be missed. |
||
---|---|---|
CMakeTests | ||
Data | ||
docs | ||
Externals | ||
Installer | ||
Languages | ||
Source | ||
Tools | ||
.gitignore | ||
.gitmodules | ||
CMakeLists.txt | ||
Contributing.md | ||
license.txt | ||
Readme.md |
Dolphin - A GameCube / Triforce / Wii Emulator
Homepage | Project Site | Forums | Wiki | Issue Tracker | Coding Style
Dolphin is an emulator for running GameCube, Triforce and Wii games on Windows/Linux/OS X systems and recent Android devices. It's licensed under the terms of the GNU General Public License, version 2 (GPLv2).
Please read the FAQ before use.
System Requirements
- OS
- Microsoft Windows (Vista or higher).
- Linux or Apple Mac OS X (10.7 or higher).
- Unix-like systems other than Linux might work but are not officially supported.
- Processor
- A CPU with SSE2 support.
- A modern CPU (3 GHz and Dual Core, not older than 2008) is highly recommended.
- Graphics
- A reasonably modern graphics card (Direct3D 10.0 / OpenGL 3.0).
- A graphics card that supports Direct3D 11 / OpenGL 4.4 is recommended.
Installation on Windows
Use the solution file Source/dolphin-emu.sln
to build Dolphin on Windows.
Visual Studio 2013 is a hard requirement since previous versions don't support
many C++ features that we use. Other compilers might be able to build Dolphin
on Windows but have not been tested and are not recommended to be used.
An installer can be created by using the Installer_win32.nsi
and
Installer_x64.nsi
scripts in the Installer directory. This will require the
Nullsoft Scriptable Install System (NSIS) to be installed. Creating an
installer is not necessary to run Dolphin since the Build directory contains
a working Dolphin distribution.
Installation on Linux/OS X
Dolphin requires CMake for systems other than Windows. Many libraries are bundled with Dolphin and used if they're not installed on your system. CMake will inform you if a bundled library is used or if you need to install any missing packages yourself.
Build steps:
mkdir Build
cd Build
cmake ..
make
On OS X, an application bundle will be created in ./Binaries
.
On Linux, it's strongly recommended to perform a global installation via sudo make install
.
Uninstalling
When Dolphin has been installed with the NSIS installer, you can uninstall Dolphin like any other Windows application.
Linux users can run cat install_manifest | xargs -d '\n' rm
from the build directory
to uninstall Dolphin from their system.
OS X users can simply delete Dolphin.app to uninstall it.
Additionally, you'll want to remove the global user directory (see below to see where it's stored) if you don't plan to reinstall Dolphin.
Command line usage
Usage: Dolphin [-h] [-d] [-l] [-e <str>] [-b] [-V <str>] [-A <str>]
- -h, --help Show this help message
- -d, --debugger Opens the debugger
- -l, --logger Opens the logger
- -e, --exec= Loads the specified file (DOL,ELF,WAD,GCM,ISO)
- -b, --batch Exit Dolphin with emulator
- -V, --video_backend= Specify a video backend
- -A, --audio_emulation= Low level (LLE) or high level (HLE) audio
Available DSP emulation engines are HLE (High Level Emulation) and LLE (Low Level Emulation). HLE is fast but often less accurate while LLE is slow but close to perfect. Note that LLE has two submodes (Interpreter and Recompiler), which cannot be selected from the command line.
Available video backends are "D3D" (only available on Windows Vista or higher), "OGL". There's also "Software Renderer", which uses the CPU for rendering and is intended for debugging purposes, only.
Sys Files
totaldb.dsy
: Database of symbols (for devs only)GC/font_ansi.bin
: font dumpsGC/font_sjis.bin
: font dumpsGC/dsp_coef.bin
: DSP dumpsGC/dsp_rom.bin
: DSP dumps
The DSP dumps included with Dolphin have been written from scratch and do not contain any copyrighted material. They should work for most purposes, however some games implement copy protection by checksumming the dumps. You will need to dump the DSP files from a console and replace the default dumps if you want to fix those issues.
Folder structure
These folders are installed read-only and should not be changed:
GameSettings
: per-game default settings databaseGC
: DSP and font dumpsMaps
: symbol tables (dev only)Shaders
: post-processing shadersThemes
: icon themes for GUIWii
: default Wii NAND contents
User folder structure
A number of user writeable directories are created for caching purposes or for
allowing the user to edit their contents. On OS X and Linux these folders are
stored in ~/Library/Application Support/Dolphin/
and ~/.dolphin-emu
respectively. On Windows the user directory is stored in the My Documents
folder by default, but there are various way to override this behavior:
- Creating a file called
portable.txt
next to the Dolphin executable will store the user directory in a local directory called "User" next to the Dolphin executable. - If the registry string value
LocalUserConfig
exists inHKEY_CURRENT_USER/Dolphin Emulator
and has the value 1, Dolphin will always start in portable mode. - If the registry string value
UserConfigPath
exists inHKEY_CURRENT_USER/Dolphin Emulator
, the user folders will be stored in the directory given by that string. The other two methods will be prioritized over this setting.
List of user folders:
Cache
: used to cache the ISO listConfig
: configuration filesDump
: anything dumped from dolphinGameConfig
: additional settings to be applied per-gameGC
: memory cardsLoad
: custom texturesLogs
: logs, if enabledScreenShots
: screenshots taken via DolphinStateSaves
: save statesWii
: Wii NAND contents
Custom textures
Custom textures have to be placed in the user directory under
Load/Textures/[GameID]/
. You can find the Game ID by right-clicking a game
in the ISO list and selecting "ISO Properties".