summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java/org
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2024-02-04 16:31:15 +0100
committerJosJuice <josjuice@gmail.com>2024-02-04 17:55:08 +0100
commit6cf55ab1ee13e62b272642ae4f1fadcc792b5e28 (patch)
treedc049adeaed70a653b9be527e7605c726e76dd78 /Source/Android/app/src/main/java/org
parent2bcf70af3f4b80870d93b17c367c9822a6ba4f41 (diff)
InputCommon: Unify GetProfileName and GetProfileDirectoryName
After reading the previous commit, you might think "hold on, what's the difference between GetProfileName and GetProfileDirectoryName"? These two are being used for the exact same thing - figuring out where profiles are stored - yet they return different values for certain controllers like GC keyboards! As far as I can tell, the existing code has been broken for GC keyboards since they were introduced a decade ago. The GUI (and more recently, also InputCycler) would write and read profiles in one location, and our code for loading profiles specified in a game INI file would read profiles in another location. This commit gets rid of the set of values used by the game INI code in favor of the other set. This does breaking existing setups where a GCKey profile has been configured in a game INI, but I think the number of working such setups is vanishingly small. The alternative would make existing GCKey profiles go missing from the profile dropdown in the GUI, which I think would be more disruptive. The alternative would also force new GCKey profiles into the same directory as GCPad profiles. This commit also fixes a regression from d6c0f8e749. The Android GUI was using GetProfileName to figure out what key to use in the game INI, which made it use incorrect game INI entries for GameCube controller profiles but not Wii Remote profiles. Now the Android GUI uses GetProfileKey for this, fixing the problem.
Diffstat (limited to 'Source/Android/app/src/main/java/org')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt6
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt6
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt2
3 files changed, 9 insertions, 5 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt
index e84dd201a5..4b2c6ec92c 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt
@@ -30,7 +30,11 @@ class EmulatedController private constructor(private val pointer: Long) {
external fun saveProfile(path: String)
- external fun getProfileName(): String
+ external fun getProfileKey(): String
+
+ external fun getUserProfileDirectoryPath(): String
+
+ external fun getSysProfileDirectoryPath(): String
companion object {
@JvmStatic
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt
index 2896c815fe..5c0a50a8b8 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt
@@ -101,11 +101,11 @@ class ProfileDialogPresenter {
}
private fun getProfileDirectoryPath(stock: Boolean): String {
- val profileDirectoryName = menuTag.correspondingEmulatedController.getProfileName()
+ val controller = menuTag.correspondingEmulatedController
return if (stock) {
- "${DirectoryInitialization.getSysDirectory()}/Profiles/$profileDirectoryName/"
+ controller.getSysProfileDirectoryPath()
} else {
- "${DirectoryInitialization.getUserDirectory()}/Config/Profiles/$profileDirectoryName/"
+ controller.getUserProfileDirectoryPath()
}
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
index 1051f445ae..44e2b2b915 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
@@ -2237,7 +2237,7 @@ class SettingsFragmentPresenter(
controllerNumber: Int
) {
val profiles = ProfileDialogPresenter(menuTag).getProfileNames(false)
- val profileKey = controller.getProfileName() + "Profile" + (controllerNumber + 1)
+ val profileKey = controller.getProfileKey() + "Profile" + (controllerNumber + 1)
sl.add(
StringSingleChoiceSetting(
context,