mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
core/hid: Add fallback to fullkey controllers
This commit is contained in:
parent
eb7d361657
commit
7a13a515d9
2 changed files with 36 additions and 4 deletions
|
@ -879,10 +879,36 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
|
||||||
if (!is_connected) {
|
if (!is_connected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!IsControllerSupported()) {
|
if (IsControllerSupported()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Disconnect();
|
||||||
|
|
||||||
|
// Fallback fullkey controllers to Pro controllers
|
||||||
|
if (IsControllerFullkey() && supported_style_tag.fullkey) {
|
||||||
|
LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
|
||||||
|
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||||
|
Connect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller",
|
LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller",
|
||||||
npad_type);
|
npad_type);
|
||||||
Disconnect();
|
}
|
||||||
|
|
||||||
|
bool EmulatedController::IsControllerFullkey(bool use_temporary_value) const {
|
||||||
|
const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
|
||||||
|
switch (type) {
|
||||||
|
case NpadStyleIndex::ProController:
|
||||||
|
case NpadStyleIndex::GameCube:
|
||||||
|
case NpadStyleIndex::NES:
|
||||||
|
case NpadStyleIndex::SNES:
|
||||||
|
case NpadStyleIndex::N64:
|
||||||
|
case NpadStyleIndex::SegaGenesis:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,6 +320,12 @@ private:
|
||||||
/// Set the params for TAS devices
|
/// Set the params for TAS devices
|
||||||
void LoadTASParams();
|
void LoadTASParams();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param use_temporary_value If true tmp_npad_type will be used
|
||||||
|
* @return true if the controller style is fullkey
|
||||||
|
*/
|
||||||
|
bool IsControllerFullkey(bool use_temporary_value = false) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the current controller type against the supported_style_tag
|
* Checks the current controller type against the supported_style_tag
|
||||||
* @param use_temporary_value If true tmp_npad_type will be used
|
* @param use_temporary_value If true tmp_npad_type will be used
|
||||||
|
|
Loading…
Reference in a new issue