summaryrefslogtreecommitdiff
path: root/Source/Android/jni/Config/NativeConfig.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2023-06-19 20:37:59 +0200
committerGitHub <noreply@github.com>2023-06-19 20:37:59 +0200
commitcff3e22f84b8335c8e0d110f9a202e5260d2b7b9 (patch)
tree0cad62a340c5ca24789f6268bd16636400824499 /Source/Android/jni/Config/NativeConfig.cpp
parent5d7b5822c97285a1b45f54b2ae8046808cbe54d2 (diff)
parentf11175d117bd47edac8df56a96fea5b68fc3ef7e (diff)
Merge pull request #11926 from JosJuice/android-host-check
Android: Re-add host thread check
Diffstat (limited to 'Source/Android/jni/Config/NativeConfig.cpp')
-rw-r--r--Source/Android/jni/Config/NativeConfig.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Android/jni/Config/NativeConfig.cpp b/Source/Android/jni/Config/NativeConfig.cpp
index 9681f0ca8e..f8b9397930 100644
--- a/Source/Android/jni/Config/NativeConfig.cpp
+++ b/Source/Android/jni/Config/NativeConfig.cpp
@@ -11,6 +11,7 @@
#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;
@@ -122,6 +123,7 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_loadGameInis
jstring jGameId,
jint jRevision)
{
+ HostThreadLock guard;
const std::string game_id = GetJString(env, jGameId);
const u16 revision = static_cast<u16>(jRevision);
Config::AddLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
@@ -131,6 +133,7 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_loadGameInis
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_unloadGameInis(JNIEnv*, jclass)
{
+ HostThreadLock guard;
Config::RemoveLayer(Config::LayerType::GlobalGame);
Config::RemoveLayer(Config::LayerType::LocalGame);
}
@@ -138,6 +141,7 @@ 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 guard;
return GetLayer(layer, {})->Save();
}
@@ -145,6 +149,7 @@ JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_deleteAllKeys(JNIEnv*, jclass,
jint layer)
{
+ HostThreadLock guard;
return GetLayer(layer, {})->DeleteAllKeys();
}
@@ -161,6 +166,7 @@ JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_deleteKey(
JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key)
{
+ HostThreadLock guard;
const Config::Location location = GetLocation(env, file, section, key);
const bool had_value = GetLayer(layer, location)->DeleteKey(location);
if (had_value)
@@ -214,6 +220,7 @@ JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setString(
JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jstring value)
{
+ HostThreadLock guard;
return Set(layer, GetLocation(env, file, section, key), GetJString(env, value));
}
@@ -221,18 +228,21 @@ JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setBoolean(
JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jboolean value)
{
+ HostThreadLock guard;
return Set(layer, GetLocation(env, file, section, key), static_cast<bool>(value));
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setInt(
JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jint value)
{
+ HostThreadLock guard;
return Set(layer, GetLocation(env, file, section, key), value);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setFloat(
JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jfloat value)
{
+ HostThreadLock guard;
return Set(layer, GetLocation(env, file, section, key), value);
}
}