service/hid: Add support for new controllers

master
german77 2021-11-04 14:43:08 +07:00 committed by Narr the Reg
parent d14e74132c
commit b21fcd9527
2 changed files with 31 additions and 2 deletions

@ -89,13 +89,13 @@ enum class NpadStyleIndex : u8 {
None = 0,
ProController = 3,
Handheld = 4,
HandheldNES = 4,
JoyconDual = 5,
JoyconLeft = 6,
JoyconRight = 7,
GameCube = 8,
Pokeball = 9,
NES = 10,
HandheldNES = 11,
SNES = 12,
N64 = 13,
SegaGenesis = 14,

@ -221,7 +221,6 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
break;
case Core::HID::NpadStyleIndex::GameCube:
shared_memory.style_set.gamecube.Assign(1);
// The GC Controller behaves like a wired Pro Controller
shared_memory.device_type.fullkey.Assign(1);
shared_memory.system_properties.is_vertical.Assign(1);
shared_memory.system_properties.use_plus.Assign(1);
@ -231,6 +230,24 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
shared_memory.device_type.palma.Assign(1);
shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
break;
case Core::HID::NpadStyleIndex::NES:
shared_memory.style_set.lark.Assign(1);
shared_memory.device_type.fullkey.Assign(1);
break;
case Core::HID::NpadStyleIndex::SNES:
shared_memory.style_set.lucia.Assign(1);
shared_memory.device_type.fullkey.Assign(1);
shared_memory.applet_footer.type = AppletFooterUiType::Lucia;
break;
case Core::HID::NpadStyleIndex::N64:
shared_memory.style_set.lagoon.Assign(1);
shared_memory.device_type.fullkey.Assign(1);
shared_memory.applet_footer.type = AppletFooterUiType::Lagon;
break;
case Core::HID::NpadStyleIndex::SegaGenesis:
shared_memory.style_set.lager.Assign(1);
shared_memory.device_type.fullkey.Assign(1);
break;
default:
break;
}
@ -431,6 +448,10 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
UNREACHABLE();
break;
case Core::HID::NpadStyleIndex::ProController:
case Core::HID::NpadStyleIndex::NES:
case Core::HID::NpadStyleIndex::SNES:
case Core::HID::NpadStyleIndex::N64:
case Core::HID::NpadStyleIndex::SegaGenesis:
pad_state.connection_status.raw = 0;
pad_state.connection_status.is_connected.Assign(1);
pad_state.connection_status.is_wired.Assign(1);
@ -1108,6 +1129,14 @@ bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller
return style.gamecube;
case Core::HID::NpadStyleIndex::Pokeball:
return style.palma;
case Core::HID::NpadStyleIndex::NES:
return style.lark;
case Core::HID::NpadStyleIndex::SNES:
return style.lucia;
case Core::HID::NpadStyleIndex::N64:
return style.lagoon;
case Core::HID::NpadStyleIndex::SegaGenesis:
return style.lager;
default:
return false;
}