Android: Add HostThreadLock where necessary
This commit is contained in:
parent
3519a7070d
commit
03f2f57edf
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -489,12 +489,14 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo
|
|||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadConfig(JNIEnv*, jclass)
|
||||
{
|
||||
HostThreadLock guard;
|
||||
SConfig::GetInstance().LoadSettings();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_UpdateGCAdapterScanThread(JNIEnv*, jclass)
|
||||
{
|
||||
HostThreadLock guard;
|
||||
if (GCAdapter::UseAdapter())
|
||||
{
|
||||
GCAdapter::StartScanThread();
|
||||
|
@ -507,6 +509,9 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_UpdateGCAdapterScanThread(JNIEnv*,
|
|||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Initialize(JNIEnv*, jclass)
|
||||
{
|
||||
// InitControllers ends up calling config code, and some config callbacks use RunAsCPUThread
|
||||
HostThreadLock guard;
|
||||
|
||||
UICommon::CreateDirectories();
|
||||
Common::RegisterMsgAlertHandler(&MsgAlert);
|
||||
Common::AndroidSetReportHandler(&ReportSend);
|
||||
|
@ -621,6 +626,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RunSystemMen
|
|||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(JNIEnv* env, jclass,
|
||||
jstring jFile)
|
||||
{
|
||||
HostThreadLock guard;
|
||||
const std::string path = GetJString(env, jFile);
|
||||
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Change Disc: %s", path.c_str());
|
||||
Core::RunAsCPUThread([&path] { Core::System::GetInstance().GetDVDInterface().ChangeDisc(path); });
|
||||
|
|
Loading…
Reference in New Issue