mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Android: Get profile name from core
To avoid duplicating information between Kotlin and C++.
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -124,6 +124,13 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||
ini.Save(path);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getProfileName(
|
||||
JNIEnv* env, jobject obj)
|
||||
{
|
||||
return ToJString(env, EmulatedControllerFromJava(env, obj)->GetConfig()->GetProfileName());
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getGcPad(
|
||||
JNIEnv* env, jclass, jint controller_index)
|
||||
|
Reference in New Issue
Block a user