Use the normal state changed `HookableEvent` instead of having
`Core::NotifyStateChanged` call `g_perf_metrics.OnEmulationStateChanged`
directly.
The direct call was added in bad78cfed4 to
avoid a crash. At the time state changed callbacks were stored in a
vector, and the crash was caused by `g_perf_metric`'s destructor trying
to remove the callback from the already-destroyed vector.
Later a97627e736 switched state changed
callbacks to use `HookableEvent`, which is specifically designed to
handle the case where a hook outlives its associated event.
Since the workaround is no longer necessary replace it with a standard
`EventHook`.
This switches from an O(log(N) * M) algorithm to an O(N * log(M))
algorithm. This is advantageous because N, the size of `mappings`, is
usually much smaller than M, the size of `m_page_table_mapped_entries`.
RemoveLargePageTableMapping already did something similar, so we can
even deduplicate some code between it and RemoveHostPageTableMappings.
Speeds up Rogue Squadron 3 by roughly 3% on my PC.
If Dolphin crashes, changes that have been made to settings are often
lost. This has been a minor annoyance for me when developing, but it has
become a much bigger issue recently due to the problem where Dolphin
freezes on shutdown for ROG Ally users.
Instead of saving the config when certain arbitrary settings are
changed, let's save the config when the user closes the settings window.
Fixes a macOS Metal crash when stopping immediately after boot starts.
m_upload_encoder and m_texture_upload_encoder could be dealloc'd during shutdown before endEncoding could be called, which causes a Metal assertion failure.
Co-authored-by: OatmealDome <julian@oatmealdome.me>
Don't set cached array bases to invalid pointers. If a game tries to set
an invalid base just keep the old one, which might cause game problems
but won't crash the emulator.
Users are reporting a crash at the point where WiimoteAndroid::IORead
tries to use m_java_wiimote_payload. This commit solves the problem by
making m_java_wiimote_payload a global reference.
The code for setting up m_java_wiimote_payload has also been moved to
the constructor just because that way it's impossible for it to run
twice. (If the code as written were to run a second time, the old global
reference would be leaked. ConnectInternal should only run once, so this
is just to be on the safe side.)
Fixes https://bugs.dolphin-emu.org/issues/13960.
Use the existing system reference instead of Core::System::GetInstance(),
and calculate the phase 2 scheduling delay from GetTicksPerSecond()
instead of hardcoding 50000 ticks.
Mistakenly thought the change media call would close the current
game if the new media failed to hash. This wasn't the case so
instead I'll close the current game myself. This fixes an issue
where a default ISO would immediately load achievements when
starting up the Wii menu.