forked from NaxdyOrg/NaxGCC-FW
Compare commits
2 commits
main
...
feature/ad
Author | SHA1 | Date | |
---|---|---|---|
fc3c82c8fc | |||
550e9e089e |
2 changed files with 26 additions and 7 deletions
|
@ -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,
|
||||
|
|
|
@ -300,21 +300,35 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
info!("Detected flash with unique serial number {}", serial);
|
||||
|
||||
trace!("Start of config");
|
||||
let mut usb_config = embassy_usb::Config::new(0x057e, 0x0337);
|
||||
let mut usb_config: embassy_usb::Config;
|
||||
if input_consistency_mode == InputConsistencyMode::XInput {
|
||||
// TODO: might need to change more configs
|
||||
usb_config = embassy_usb::Config::new(0x045e, 0x028e);
|
||||
// necessary?
|
||||
usb_config.device_class = 255;
|
||||
usb_config.device_protocol = 255;
|
||||
usb_config.device_sub_class = 255;
|
||||
} else {
|
||||
usb_config = embassy_usb::Config::new(0x057e, 0x0337);
|
||||
// necessary?
|
||||
usb_config.device_class = 0;
|
||||
usb_config.device_protocol = 0;
|
||||
usb_config.device_sub_class = 0;
|
||||
};
|
||||
|
||||
usb_config.manufacturer = Some("Naxdy");
|
||||
usb_config.product = Some(match input_consistency_mode {
|
||||
InputConsistencyMode::Original => "NaxGCC (OG Mode)",
|
||||
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;
|
||||
usb_config.max_packet_size_0 = 64;
|
||||
usb_config.device_class = 0;
|
||||
usb_config.device_protocol = 0;
|
||||
usb_config.self_powered = false;
|
||||
usb_config.device_sub_class = 0;
|
||||
|
||||
usb_config.supports_remote_wakeup = true;
|
||||
|
||||
let mut device_descriptor = [0; 256];
|
||||
|
@ -356,7 +370,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 +412,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
|
||||
|
|
Loading…
Reference in a new issue