create xinput enum, make it selectable in config mode

This commit is contained in:
Marcel Romagnuolo 2024-06-30 14:25:14 +02:00
parent b6b5bb25a7
commit 550e9e089e
2 changed files with 9 additions and 3 deletions

View file

@ -561,6 +561,8 @@ pub enum InputConsistencyMode {
/// Transmit inputs every 1 ms, for use on PC or other devices that are not garbage.
/// This is not recommended for use on the Switch!
PC = 3,
/// XInput mode
XInput = 4,
}
#[derive(Debug, Clone, Format, PackedStruct)]
@ -1693,7 +1695,8 @@ async fn configuration_main_loop<
InputConsistencyMode::Original => InputConsistencyMode::PC,
InputConsistencyMode::PC => InputConsistencyMode::ConsistencyHack,
InputConsistencyMode::ConsistencyHack => InputConsistencyMode::SuperHack,
InputConsistencyMode::SuperHack => InputConsistencyMode::Original,
InputConsistencyMode::SuperHack => InputConsistencyMode::XInput,
InputConsistencyMode::XInput => InputConsistencyMode::Original,
};
override_gcc_state_and_wait(&OverrideGcReportInstruction {
@ -1718,6 +1721,7 @@ async fn configuration_main_loop<
InputConsistencyMode::PC => -42,
InputConsistencyMode::ConsistencyHack => 42,
InputConsistencyMode::SuperHack => 69,
InputConsistencyMode::XInput => 7,
}) as u8,
cstick_x: 127,
cstick_y: 127,

View file

@ -307,6 +307,7 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
InputConsistencyMode::ConsistencyHack => "NaxGCC (Consistency Mode)",
InputConsistencyMode::SuperHack => "NaxGCC (SuperHack Mode)",
InputConsistencyMode::PC => "NaxGCC (PC Mode)",
InputConsistencyMode::XInput => "NaxGCC (XInput Mode)",
});
usb_config.serial_number = Some(serial);
usb_config.max_power = 200;
@ -356,7 +357,8 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
InputConsistencyMode::Original => 8,
InputConsistencyMode::ConsistencyHack
| InputConsistencyMode::SuperHack
| InputConsistencyMode::PC => 1,
| InputConsistencyMode::PC
| InputConsistencyMode::XInput => 1,
},
max_packet_size_in: 37,
max_packet_size_out: 5,
@ -397,7 +399,7 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
// "Ticker at home", so we can use this for both consistency and SuperHack mode
Timer::at(rate_limit_end_time).await;
}
InputConsistencyMode::Original | InputConsistencyMode::PC => {}
InputConsistencyMode::Original | InputConsistencyMode::PC | InputConsistencyMode::XInput => {}
}
match writer