mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-13 11:39:09 +00:00
move profile name storage to file itself
This commit is contained in:
parent
c2e414ea7b
commit
08df1f3b3d
5 changed files with 20 additions and 11 deletions
|
@ -35,10 +35,12 @@ class EmulatedController private constructor(private val pointer: Long) : Contro
|
|||
|
||||
external fun clearSettings()
|
||||
|
||||
external fun loadProfile(path: String, profileName: String)
|
||||
external fun loadProfile(path: String)
|
||||
|
||||
external fun saveProfile(path: String)
|
||||
|
||||
external fun setProfileName(name: String)
|
||||
|
||||
external fun getProfileName(): String
|
||||
|
||||
external fun getProfileKey(): String
|
||||
|
|
|
@ -47,7 +47,7 @@ class ProfileDialogPresenter {
|
|||
.setMessage(context.getString(R.string.input_profile_confirm_load, profileName))
|
||||
.setPositiveButton(R.string.yes) { _: DialogInterface?, _: Int ->
|
||||
menuTag.correspondingEmulatedController
|
||||
.loadProfile(getProfilePath(profileName, stock), profileName)
|
||||
.loadProfile(getProfilePath(profileName, stock))
|
||||
(dialog!!.requireActivity() as SettingsActivityView).onControllerSettingsChanged()
|
||||
dialog.dismiss()
|
||||
|
||||
|
@ -69,6 +69,7 @@ class ProfileDialogPresenter {
|
|||
MaterialAlertDialogBuilder(context!!)
|
||||
.setMessage(context.getString(R.string.input_profile_confirm_save, profileName))
|
||||
.setPositiveButton(R.string.yes) { _: DialogInterface?, _: Int ->
|
||||
menuTag.correspondingEmulatedController.setProfileName(profileName)
|
||||
menuTag.correspondingEmulatedController.saveProfile(profilePath)
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
|
|
|
@ -2446,14 +2446,8 @@ class SettingsFragmentPresenter(
|
|||
0,
|
||||
true
|
||||
) { fragmentView.showDialogFragment(ProfileDialog.create(menuTag)) }
|
||||
|
||||
sl.add(profileSelector)
|
||||
profileSelector.updateDescription(context.getString(R.string.input_profiles_descríption, controller.getProfileName()))
|
||||
|
||||
/*var l = ""
|
||||
ProfileDialogPresenter(menuTag).getProfileNames(false).forEach { l+= "$it, " }
|
||||
Log.error("Profile: ${}")
|
||||
Log.error("Profiles: $l")*/
|
||||
sl.add(profileSelector)
|
||||
|
||||
updateOldControllerSettingsWarningVisibility(controller)
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
|||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_loadProfile(
|
||||
JNIEnv* env, jobject obj, jstring j_path, jstring j_profileName)
|
||||
JNIEnv* env, jobject obj, jstring j_path)
|
||||
{
|
||||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||
|
||||
|
@ -129,7 +129,6 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
|||
ini.Load(GetJString(env, j_path));
|
||||
|
||||
controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
||||
controller->SetProfileName(GetJString(env, j_profileName));
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
controller->GetConfig()->GenerateControllerTextures();
|
||||
}
|
||||
|
@ -156,6 +155,14 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
|||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_setProfileName(
|
||||
JNIEnv* env, jobject obj, jstring j_name)
|
||||
{
|
||||
const std::string name = GetJString(env, j_name);
|
||||
EmulatedControllerFromJava(env, obj)->SetProfileName(name);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getProfileName(
|
||||
JNIEnv* env, jobject obj)
|
||||
|
|
|
@ -118,6 +118,10 @@ void EmulatedController::LoadConfig(Common::IniFile::Section* sec)
|
|||
if (sec->Get("Device", &defdev, ""))
|
||||
SetDefaultDevice(defdev);
|
||||
|
||||
std::string name;
|
||||
if (sec->Get("ProfileName", &name, ""))
|
||||
SetProfileName(name);
|
||||
|
||||
LoadGroupsConfig(sec, "");
|
||||
}
|
||||
|
||||
|
@ -132,6 +136,7 @@ void EmulatedController::SaveConfig(Common::IniFile::Section* sec)
|
|||
const auto lock = EmulatedController::GetStateLock();
|
||||
|
||||
sec->Set("Device", GetDefaultDevice().ToString(), "");
|
||||
sec->Set("ProfileName", GetProfileName(), "");
|
||||
|
||||
SaveGroupsConfig(sec, "");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue