Android: Correctly save in-game settings changes to disk

This commit is contained in:
JosJuice 2020-12-24 13:34:52 +01:00
parent 1d489b3fd5
commit 6f05c40013
3 changed files with 11 additions and 5 deletions

View File

@ -3,8 +3,9 @@ package org.dolphinemu.dolphinemu.features.settings.model;
public class NativeConfig public class NativeConfig
{ {
public static final int LAYER_BASE_OR_CURRENT = 0; public static final int LAYER_BASE_OR_CURRENT = 0;
public static final int LAYER_LOCAL_GAME = 1; public static final int LAYER_BASE = 1;
public static final int LAYER_ACTIVE = 2; public static final int LAYER_LOCAL_GAME = 2;
public static final int LAYER_ACTIVE = 3;
public static native boolean isSettingSaveable(String file, String section, String key); public static native boolean isSettingSaveable(String file, String section, String key);

View File

@ -200,7 +200,7 @@ public class Settings implements Closeable
SettingsFile.saveFile(entry.getKey(), entry.getValue(), view); SettingsFile.saveFile(entry.getKey(), entry.getValue(), view);
} }
NativeConfig.save(NativeConfig.LAYER_BASE_OR_CURRENT); NativeConfig.save(NativeConfig.LAYER_BASE);
if (!NativeLibrary.IsRunning()) if (!NativeLibrary.IsRunning())
{ {

View File

@ -14,8 +14,9 @@
#include "jni/AndroidCommon/AndroidCommon.h" #include "jni/AndroidCommon/AndroidCommon.h"
constexpr jint LAYER_BASE_OR_CURRENT = 0; constexpr jint LAYER_BASE_OR_CURRENT = 0;
constexpr jint LAYER_LOCAL_GAME = 1; constexpr jint LAYER_BASE = 1;
constexpr jint LAYER_ACTIVE = 2; constexpr jint LAYER_LOCAL_GAME = 2;
constexpr jint LAYER_ACTIVE = 3;
static Config::Location GetLocation(JNIEnv* env, jstring file, jstring section, jstring key) static Config::Location GetLocation(JNIEnv* env, jstring file, jstring section, jstring key)
{ {
@ -60,6 +61,10 @@ static std::shared_ptr<Config::Layer> GetLayer(jint layer, const Config::Locatio
layer_type = Config::LayerType::CurrentRun; layer_type = Config::LayerType::CurrentRun;
break; break;
case LAYER_BASE:
layer_type = Config::LayerType::Base;
break;
case LAYER_LOCAL_GAME: case LAYER_LOCAL_GAME:
layer_type = Config::LayerType::LocalGame; layer_type = Config::LayerType::LocalGame;
break; break;