diff options
| author | JosJuice <josjuice@gmail.com> | 2024-07-06 23:31:04 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2026-02-14 10:05:27 +0100 |
| commit | 5440c7737fdc39b17656d437c25bf6cb9f369dbe (patch) | |
| tree | 395b307ebcdadafd2ad5d5bc3e1490f7889a268c /Source/Android | |
| parent | a8fbe8f28f622851333538ee0a2899bc159161ba (diff) | |
Explicitly transfer control of SYSCONF to emulated system
The functions SaveToSYSCONF and LoadFromSYSCONF contain checks for
whether emulation is running. The intent of this is that when we're
emulating a Wii, the emulated system may write to SYSCONF whenever it
likes and does not expect anything else to write to SYSCONF, so the
host code shouldn't access SYSCONF while emulation is ongoing. However,
Core::IsRunning is an imperfect proxy for whether we've handed over
control of SYSCONF to the emulated system yet, as the actual handover
happens at a slightly different point in time than when the emulation
state is changed. This usually isn't a problem, but in theory it could
be a determinism problem if a setting is changed right as emulation is
starting, or it could cause the emulated software to briefly misbehave
if a setting is changed right as emulation is stopping.
Things got worse in 72cf2bdb87f09deff22e1085de3290126aa4ad05 when I
replaced the Core::IsRunning calls with !Core::IsUninitialized. With
IsRunning, there was be a period of time where SYSCONF should have been
protected but wasn't. With !IsUninitialized, there was a period of time
where SYSCONF shouldn't have been protected but was, and crucially, this
period of time included the moments where we do setup and teardown of
the emulated NAND, which broke transferring SYSCONF settings between the
host and the guest. 72cf2bdb87f09deff22e1085de3290126aa4ad05 was
reverted because of this.
This commit adds a flag that we explicitly flip when control is handed
over to or from the emulated system. This protects the SYSCONF file
for exactly as long as is needed.
Diffstat (limited to 'Source/Android')
| -rw-r--r-- | Source/Android/jni/Config/NativeConfig.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/Source/Android/jni/Config/NativeConfig.cpp b/Source/Android/jni/Config/NativeConfig.cpp index 8478174dae..c524c0ea9e 100644 --- a/Source/Android/jni/Config/NativeConfig.cpp +++ b/Source/Android/jni/Config/NativeConfig.cpp @@ -11,7 +11,6 @@ #include "Core/ConfigLoaders/GameConfigLoader.h" #include "Core/ConfigLoaders/IsSettingSaveable.h" #include "jni/AndroidCommon/AndroidCommon.h" -#include "jni/Host.h" constexpr jint LAYER_BASE_OR_CURRENT = 0; constexpr jint LAYER_BASE = 1; @@ -143,10 +142,6 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_unloadGameIn JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_save( JNIEnv*, jclass, jint layer) { - // HostThreadLock is used to ensure we don't try to save to SYSCONF at the same time as - // emulation shutdown does - HostThreadLock guard; - return GetLayer(layer, {})->Save(); } |
