mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Android: Implement game-specific settings overrides UI
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/BootManager.h"
|
||||
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/DVD/DVDInterface.h"
|
||||
@ -640,6 +641,57 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(J
|
||||
eglBindAPI(api);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InitGameIni(JNIEnv* env,
|
||||
jobject obj,
|
||||
jstring jGameID)
|
||||
{
|
||||
// Initialize an empty INI file
|
||||
IniFile ini;
|
||||
std::string gameid = GetJString(env, jGameID);
|
||||
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "InitGameIni", "Initializing base game config file");
|
||||
ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini");
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserSetting(
|
||||
JNIEnv* env, jobject obj, jstring jGameID, jstring jSection, jstring jKey)
|
||||
{
|
||||
IniFile ini;
|
||||
std::string gameid = GetJString(env, jGameID);
|
||||
std::string section = GetJString(env, jSection);
|
||||
std::string key = GetJString(env, jKey);
|
||||
|
||||
ini = SConfig::GetInstance().LoadGameIni(gameid, 0);
|
||||
std::string value;
|
||||
|
||||
ini.GetOrCreateSection(section)->Get(key, &value, "-1");
|
||||
|
||||
return env->NewStringUTF(value.c_str());
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
ini.GetOrCreateSection(section)->Delete(key);
|
||||
}
|
||||
|
||||
ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini");
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(
|
||||
JNIEnv* env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault)
|
||||
{
|
||||
|
Reference in New Issue
Block a user