mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
Android: Change how the overlay controller setting works
Up until now, there have been two settings on Android that stored the selected Wii Remote extension: the normal one that's also used on PC, and a SharedPreferences one that's used by the overlay controls to determine what controls to show. It is possible for these two to end up out of sync, and my input changes have made that more likely to happen. To fix this, let's rework how the overlay controller setting works. We don't want it to encode the currently selected Wii Remote extension. However, we can't simply get rid of the setting, because for some Wii games we need the ability to switch between a GameCube controller and a Wii Remote. What this commit does is give the user the option to select any of the 4 GameCube controllers and any of the 4 Wii Remotes. (Before, controllers 2-4 weren't available in the overlay.) Could be useful for things like the Psycho Mantis fight in Metal Gear Solid. I'm also switching from SharedPreferences to Dolphin.ini while I'm at it.
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
#include "jni/Input/Control.h"
|
||||
#include "jni/Input/ControlGroup.h"
|
||||
#include "jni/Input/ControlReference.h"
|
||||
#include "jni/Input/NumericSetting.h"
|
||||
|
||||
ControllerEmu::EmulatedController* EmulatedControllerFromJava(JNIEnv* env, jobject obj)
|
||||
{
|
||||
@ -145,4 +146,29 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||
Wiimote::GetWiimoteGroup(controller_index, WiimoteEmu::WiimoteGroup::Attachments));
|
||||
return EmulatedControllerToJava(env, attachments->GetAttachmentList()[attachment_index].get());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getSelectedWiimoteAttachment(
|
||||
JNIEnv* env, jclass, jint controller_index)
|
||||
{
|
||||
auto* attachments = static_cast<ControllerEmu::Attachments*>(
|
||||
Wiimote::GetWiimoteGroup(controller_index, WiimoteEmu::WiimoteGroup::Attachments));
|
||||
return static_cast<jint>(attachments->GetSelectedAttachment());
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getSidewaysWiimoteSetting(
|
||||
JNIEnv* env, jclass, jint controller_index)
|
||||
{
|
||||
ControllerEmu::ControlGroup* options =
|
||||
Wiimote::GetWiimoteGroup(controller_index, WiimoteEmu::WiimoteGroup::Options);
|
||||
|
||||
for (auto& setting : options->numeric_settings)
|
||||
{
|
||||
if (setting->GetININame() == WiimoteEmu::Wiimote::SIDEWAYS_OPTION)
|
||||
return NumericSettingToJava(env, setting.get());
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user