Dual Core is primarily known as one of the first troubleshooting steps when emulation or NetPlay misbehave.
I believe(?) the original intent with having it on by default was likely to support users with weaker machines. However, I believe it would be a lot more reasonable for users to manually enable dual core if they really need the performance boost, rather than it is for them to have come ask us in support channel why their cleanly-installed Dolphin is not emulating their games properly.
Instead, this creates a fragile first impression where a clean install of Dolphin is already set up in a way that leads to inexplicable crashes, subtle timing bugs, and NetPlay desyncs.
Note: This changes only applies to the Desktop application, since mobile devices *do* really need the performance boost.
For thread safety, we shouldn't return any pointers or references that
can be used to mutate the state of the PPCSymbolDB. This should be the
final part of making PPCSymbolDB thread safe unless I've missed
something.
9395238 added locking in some PPCSymbolDB functions that access member
variables, but far from all. To ensure thread safety, this commit adds
the missing locking.
9395238 added a mutex to PPCSymbolDB, and made functions return with an
"empty" result if called while the mutex is locked. This new behavior
has the potential to affect not only less important call sites like the
symbol printing mentioned in a comment, but also the JIT deciding if it
should HLE a function.
A later commit in this pull request decreases the amount of lock
contention, reducing the performance impact of this commit.
When Android sends Dolphin to the background, emulation *must* pause,
otherwise emulation continues running and continues outputting audio to
the user. RetroAchievements mustn't be allowed to override it.
The SetDisc function calls AchievementManager::LoadGame with the game's
volume. Calling AchievementManager::LoadGame again afterwards with
nullptr prevents RetroAchievements from working.
Use ToolTipWidget::SetDescription insead of QWidget::setTooltip to put
the description in the BalloonTip with the title, instead of having the
description be in a separate standard tooltip.
It is useful enough for the Code widget to be enabled the first time
debugging is enabled, but it should not be re-enabled every time the
setting is toggled off and then back on. This also ensures that the
interface is consistent if debugging is enabled without using the
checkbox.
Dolphin never emulated the AHBPROT register before, but the default
value when reading from unimplemented MMIO registers used to be -1,
which happened to match what AHBPROT reads as when all restrictions are
disabled. In 6f25e20c6a I changed the
default to 0 to match observed hardware behavior in the memory range of
the command processor. This broke libogc's DI_Init() which checks
AHBPROT for full hardware access (presumably to ensure that bypassing
IPC for Video DVDs will work).
Fix a copy-paste error causing MemoryWidget's splitter to load the wrong
state data when creating the MemoryWidget.
For me this caused the side panel to be scrunched up every time I
started Dolphin, but the exact effects probably depend on the state of
your MemoryWidget and CodeWidget.
Fix two bugs that occurred when viewing a memory range starting shortly
before 0xffffffff.
Bug 1: When there was at least one visible memory address at or after
0x0 none of the values would be displayed even when some of the
addresses were valid. This happened because the loop condition in
GetValues immediately returned false since m_address_range.first >
m_address_range.second, causing m_values to be empty. This in turn led
every address to be considered INVALID_MEMORY in UpdateColumns.
Bug 2: When m_address_range.second was equal to 0xffffffff GetValues
would enter an infinite loop. This happened because address would
overflow to 0 after printing the last value in the table, causing the
loop condition address <= m_address_range.second to be true forever.
Require ReadArray and WriteArray to be called with a trivially copyable
type.
ReadArray and WriteArray call std::fread and std::fwrite respectively.
These functions trigger undefined behavior when the objects are not
trivially copyable, so this adds that requirement to the callers.
Fix creation of a ".sav" file in the current working directory on
emulation shutdown when a slot is set to "Advance Game Port" and the
"GBA Cartridge Path" is empty.
Fixes https://bugs.dolphin-emu.org/issues/12975.
Fix some common anti-patterns with these data structures.
- You can dereference the iterator returned by `find` to access the
underlying value directly, without an extra `operator[]`/`at`.
- Rather than checking for an element before insertion/deletion, you can
just do the operation and if needed check the return value to
determine if the insertion/deletion succeeded.
Unlike custom banners which work as an override, this mechanism works as
a fallback. The use case is if you have games you don't really play but
want to keep around for testing purposes without filling up your NAND
with lots of saves. For ease of use, the directory structure is the same
but only title/$title_hi/$title_lo/data/banner.bin files are
relevant.
Fix the input string failing to validate when the "Hex Byte
String" input type is selected and either the user adds a 0x prefix or
the "Hex" box is checked (or both).
The latter failure was particularly troublesome because when "Hex Byte
String" is selected the "Hex" checkbox is disabled. Users would have to
switch to a data type that enabled the box, toggle it, then switch back
to "Hex Byte String" to fix it.
Fix these errors by not adding a prefix when the "Hex" box is checked,
and removing the "0x" prefix from the user's input if present.
Fix validation failing when the user has checked the Hex box and also
includes a "0x" or "-0x" prefix in their input.
Previously an extra "0x" would be inserted, causing the user's input of
"0x13" to become "0x0x13" which would then fail to validate.
Separate LibUSB logic into LibUSBBluetoothAdapter class.
Submit transfers on thread with proper timing.
Throttle before ACL input for reduced input latency.
Immediately send IPC replies for outgoing data.
Continuously submit libusb transfers to fill HCI/ACL input queues.
Simplify endpoint handling and state saving.
Other cleanups.
Remove the redundant s_populate_mutex and only use
ControllerInterface::m_devices_population_mutex instead to prevent a
deadlock caused by locking them in opposite orders.
The device population functions in the win32 InputBackend previously
locked s_populate_mutex first before calling various functions that
locked m_devices_population_mutex. This normally worked but
ControllerInterface::RefreshDevices locks m_devices_population_mutex
first and then calls HandleWindowChange which then locked
s_populate_mutex, potentially causing the deadlock.
Fix this by using PlatformPopulateDevices to lock
m_devices_population_mutex before running the code that was previously
protected by s_populate_mutex. The functions in question lock
m_devices_population_mutex anyway, so this shouldn't meaningfully
increase contention on the lock.
Reproduction steps:
* Let Dolphin finish startup.
* In Win32.cpp::OnDevicesChanged set a breakpoint on the call to
PlatformPopulateDevices. When the breakpoint is triggered the function
will have locked s_populate_mutex, but since PlatformPopulateDevices
won't have run yet m_devices_population_mutex will still be unlocked.
* Unplug a device from your computer.
* Wait for the breakpoint to trigger. (At this point you can plug the
device back in).
* Freeze the ntdll.dll!TppWorkerThread() that triggered the breakpoint.
* Resume Dolphin and start a game.
* Core::EmuThread will call ControllerInterface::ChangeWindow which
calls RefreshDevices. It locks m_devices_population_mutex, then calls
InputBackend::HandleWindowChange, which tries to lock
s_populate_mutex.
* Unfreeze ntdll.dll!TppWorkerThread().
At this point EmuThread and TppWorkerThread are deadlocked. The UI is
still responsive since the Host thread is unaffected, but trying to stop
the game or close Dolphin normally will fail since EmuThread is unable
to stop.
Cleanup loading code and reduce amount of signals.
On boot. allow previously loaded map to be kept, if its filename matches. Useful for restarting a game with a large symbol map.