diff options
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index f74ae67788..f4692af117 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <EGL/egl.h> +#include <UICommon/GameFile.h> #include <android/log.h> #include <android/native_window_jni.h> #include <cinttypes> @@ -15,7 +16,6 @@ #include <string> #include <thread> #include <utility> -#include <UICommon/GameFile.h> #include "Common/AndroidAnalytics.h" #include "Common/CPUDetect.h" @@ -61,6 +61,7 @@ namespace static constexpr char DOLPHIN_TAG[] = "DolphinEmuNative"; ANativeWindow* s_surf; +IniFile s_ini; // The Core only supports using a single Host thread. // If multiple threads want to call host functions then they need to queue @@ -361,27 +362,38 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserSe return ToJString(env, value.c_str()); } +JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadGameIniFile(JNIEnv* env, + jobject obj, + jstring jGameID) +{ + std::string gameid = GetJString(env, jGameID); + s_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini"); +} + +JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveGameIniFile(JNIEnv* env, + jobject obj, + jstring jGameID) +{ + std::string gameid = GetJString(env, jGameID); + s_ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini"); +} + JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserSetting( JNIEnv* env, jobject obj, jstring jGameID, jstring jSection, jstring jKey, jstring jValue) { - IniFile ini; std::string gameid = GetJString(env, jGameID); std::string section = GetJString(env, jSection); std::string key = GetJString(env, jKey); std::string val = GetJString(env, jValue); - ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini"); - if (val != "-1") { - ini.GetOrCreateSection(section)->Set(key, val); + s_ini.GetOrCreateSection(section)->Set(key, val); } else { - ini.GetOrCreateSection(section)->Delete(key); + s_ini.GetOrCreateSection(section)->Delete(key); } - - ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini"); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfileSetting( @@ -404,7 +416,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfileSe ini.GetOrCreateSection(section)->Delete(key); } - ini.Save(File::GetUserPath(D_CONFIG_IDX) + "Profiles/Wiimote/" + profile + ".ini"); + ini.Save(File::GetUserPath(D_CONFIG_IDX) + "Profiles/Wiimote/" + profile + ".ini"); } JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig( |
