diff options
| author | JosJuice <josjuice@gmail.com> | 2023-10-01 18:35:01 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2023-10-01 18:47:49 +0200 |
| commit | d6c0f8e74933e291023099f47cae2901410c0f42 (patch) | |
| tree | dfc2f1c50d07afdde218fc698c827fa3c9426961 /Source/Android/app/src/main/java | |
| parent | b2e016f01219f7bac727bd6bf184dabf41913358 (diff) | |
Android: Get profile name from core
To avoid duplicating information between Kotlin and C++.
Diffstat (limited to 'Source/Android/app/src/main/java')
3 files changed, 10 insertions, 9 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 348e75b6a0..c91bbbe1ab 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,6 +30,8 @@ class EmulatedController private constructor(private val pointer: Long) { external fun saveProfile(path: String) + external fun getProfileName(): String + companion object { @JvmStatic external fun getGcPad(controllerIndex: Int): EmulatedController 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 624441aa73..2896c815fe 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 @@ -100,15 +100,14 @@ class ProfileDialogPresenter { .show() } - private val profileDirectoryName: String - get() = if (menuTag.isGCPadMenu) "GCPad" else if (menuTag.isWiimoteMenu) "Wiimote" else throw UnsupportedOperationException() - - private fun getProfileDirectoryPath(stock: Boolean): String = - if (stock) { + private fun getProfileDirectoryPath(stock: Boolean): String { + val profileDirectoryName = menuTag.correspondingEmulatedController.getProfileName() + return if (stock) { "${DirectoryInitialization.getSysDirectory()}/Profiles/$profileDirectoryName/" } else { "${DirectoryInitialization.getUserDirectory()}/Config/Profiles/$profileDirectoryName/" } + } private fun getProfilePath(profileName: String, stock: Boolean): String = getProfileDirectoryPath(stock) + profileName + EXTENSION 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 099ae980e6..c7261c88f8 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 @@ -2076,7 +2076,7 @@ class SettingsFragmentPresenter( val gcPad = EmulatedController.getGcPad(gcPadNumber) if (!TextUtils.isEmpty(gameId)) { - addControllerPerGameSettings(sl, "Pad", gcPadNumber) + addControllerPerGameSettings(sl, gcPad, gcPadNumber) } else { addControllerMetaSettings(sl, gcPad) addControllerMappingSettings(sl, gcPad, null) @@ -2106,7 +2106,7 @@ class SettingsFragmentPresenter( val wiimote = EmulatedController.getWiimote(wiimoteNumber) if (!TextUtils.isEmpty(gameId)) { - addControllerPerGameSettings(sl, "Wiimote", wiimoteNumber) + addControllerPerGameSettings(sl, wiimote, wiimoteNumber) } else { addControllerMetaSettings(sl, wiimote) @@ -2202,11 +2202,11 @@ class SettingsFragmentPresenter( */ private fun addControllerPerGameSettings( sl: ArrayList<SettingsItem>, - profileString: String, + controller: EmulatedController, controllerNumber: Int ) { val profiles = ProfileDialogPresenter(menuTag).getProfileNames(false) - val profileKey = profileString + "Profile" + (controllerNumber + 1) + val profileKey = controller.getProfileName() + "Profile" + (controllerNumber + 1) sl.add( StringSingleChoiceSetting( context, |
