Android: Add more GameCube controller types

For all your PSO needs.
This commit is contained in:
JosJuice 2023-10-01 17:25:17 +02:00
parent d6c0f8e749
commit d811c12196
5 changed files with 67 additions and 28 deletions

View File

@ -36,6 +36,9 @@ class EmulatedController private constructor(private val pointer: Long) {
@JvmStatic @JvmStatic
external fun getGcPad(controllerIndex: Int): EmulatedController external fun getGcPad(controllerIndex: Int): EmulatedController
@JvmStatic
external fun getGcKeyboard(controllerIndex: Int): EmulatedController
@JvmStatic @JvmStatic
external fun getWiimote(controllerIndex: Int): EmulatedController external fun getWiimote(controllerIndex: Int): EmulatedController

View File

@ -2071,7 +2071,8 @@ class SettingsFragmentPresenter(
} }
private fun addGcPadSubSettings(sl: ArrayList<SettingsItem>, gcPadNumber: Int, gcPadType: Int) { private fun addGcPadSubSettings(sl: ArrayList<SettingsItem>, gcPadNumber: Int, gcPadType: Int) {
if (gcPadType == 6) { when (gcPadType) {
6, 8, 9, 10 -> {
// Emulated // Emulated
val gcPad = EmulatedController.getGcPad(gcPadNumber) val gcPad = EmulatedController.getGcPad(gcPadNumber)
@ -2081,7 +2082,20 @@ class SettingsFragmentPresenter(
addControllerMetaSettings(sl, gcPad) addControllerMetaSettings(sl, gcPad)
addControllerMappingSettings(sl, gcPad, null) addControllerMappingSettings(sl, gcPad, null)
} }
} else if (gcPadType == 12) { }
7 -> {
// Emulated keyboard controller
val gcKeyboard = EmulatedController.getGcKeyboard(gcPadNumber)
if (!TextUtils.isEmpty(gameId)) {
addControllerPerGameSettings(sl, gcKeyboard, gcPadNumber)
} else {
sl.add(HeaderSetting(context, R.string.keyboard_controller_warning, 0))
addControllerMetaSettings(sl, gcKeyboard)
addControllerMappingSettings(sl, gcKeyboard, null)
}
}
12 -> {
// Adapter // Adapter
sl.add( sl.add(
SwitchSetting( SwitchSetting(
@ -2101,6 +2115,7 @@ class SettingsFragmentPresenter(
) )
} }
} }
}
private fun addWiimoteSubSettings(sl: ArrayList<SettingsItem>, wiimoteNumber: Int) { private fun addWiimoteSubSettings(sl: ArrayList<SettingsItem>, wiimoteNumber: Int) {
val wiimote = EmulatedController.getWiimote(wiimoteNumber) val wiimote = EmulatedController.getWiimote(wiimoteNumber)

View File

@ -367,11 +367,19 @@
<string-array name="gcpadTypeEntries"> <string-array name="gcpadTypeEntries">
<item>@string/gcpad_disabled</item> <item>@string/gcpad_disabled</item>
<item>@string/gcpad_emulated</item> <item>@string/gcpad_emulated</item>
<item>@string/gcpad_keyboard</item>
<item>@string/gcpad_steering_wheel</item>
<item>@string/gcpad_dance_mat</item>
<item>@string/gcpad_taru_konga</item>
<item>@string/gcpad_gc_adapter</item> <item>@string/gcpad_gc_adapter</item>
</string-array> </string-array>
<integer-array name="gcpadTypeValues"> <integer-array name="gcpadTypeValues">
<item>0</item> <item>0</item>
<item>6</item> <item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>12</item> <item>12</item>
</integer-array> </integer-array>

View File

@ -47,6 +47,7 @@
<string name="input_clear">Clear</string> <string name="input_clear">Clear</string>
<string name="input_clear_description">Clear settings for this controller.</string> <string name="input_clear_description">Clear settings for this controller.</string>
<string name="input_reset_warning">Are you sure? Your current controller settings will be deleted.</string> <string name="input_reset_warning">Are you sure? Your current controller settings will be deleted.</string>
<string name="keyboard_controller_warning">"You are configuring a \"Keyboard Controller\". This device is exclusively for \"Phantasy Star Online Episode I &amp; II\". If you are unsure, turn back now and configure a \"Standard Controller\".</string>
<string name="old_controller_settings">Your controller settings are from an old version of Dolphin and won\'t work in this version. Press \"Default\" to start over with new settings.</string> <string name="old_controller_settings">Your controller settings are from an old version of Dolphin and won\'t work in this version. Press \"Default\" to start over with new settings.</string>
<string name="input_binding">Input Binding</string> <string name="input_binding">Input Binding</string>
@ -772,13 +773,17 @@ It can efficiently compress both junk data and encrypted Wii data.
<string name="country_unknown">Unknown</string> <string name="country_unknown">Unknown</string>
<!-- GameCube Gamepad Types --> <!-- GameCube Gamepad Types -->
<string name="gcpad_disabled">Disabled</string> <string name="gcpad_disabled">None</string>
<string name="gcpad_emulated">Emulated</string> <string name="gcpad_emulated">Standard Controller</string>
<string name="gcpad_keyboard">Keyboard Controller</string>
<string name="gcpad_steering_wheel">Steering Wheel</string>
<string name="gcpad_dance_mat">Dance Mat</string>
<string name="gcpad_taru_konga">DK Bongos</string>
<string name="gcpad_gc_adapter">GameCube Adapter</string> <string name="gcpad_gc_adapter">GameCube Adapter</string>
<!-- Wiimote Types --> <!-- Wiimote Types -->
<string name="wiimote_disabled">Disabled</string> <string name="wiimote_disabled">None</string>
<string name="wiimote_emulated">Emulated</string> <string name="wiimote_emulated">Emulated Wii Remote</string>
<string name="wiimote_real">Real Wii Remote (DolphinBar required)</string> <string name="wiimote_real">Real Wii Remote (DolphinBar required)</string>
<!-- Gamepad Controls --> <!-- Gamepad Controls -->

View File

@ -5,6 +5,7 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h" #include "Core/HW/GCPad.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h"
@ -138,6 +139,13 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
return EmulatedControllerToJava(env, Pad::GetConfig()->GetController(controller_index)); return EmulatedControllerToJava(env, Pad::GetConfig()->GetController(controller_index));
} }
JNIEXPORT jobject JNICALL
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getGcKeyboard(
JNIEnv* env, jclass, jint controller_index)
{
return EmulatedControllerToJava(env, Keyboard::GetConfig()->GetController(controller_index));
}
JNIEXPORT jobject JNICALL JNIEXPORT jobject JNICALL
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getWiimote( Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getWiimote(
JNIEnv* env, jclass, jint controller_index) JNIEnv* env, jclass, jint controller_index)