Disable GameCube adapter on Windows #80

Merged
EIREXE merged 2 commits from disable-gamecube-adapter-windows into master 2026-10-02 11:19:01 +00:00
3 changed files with 37 additions and 28 deletions
Showing only changes of commit c2ba5cf34a - Show all commits
+5 -2
View File
@@ -7,9 +7,10 @@ authors = [""]
[workspace]
[features]
default = ["development", "debug_features"]
default = ["development", "debug_features", "gamecube-adapter"]
development = ["bevy/dynamic_linking", "bevy/file_watcher", "bevy/embedded_watcher"]
debug_features = ["bevy/free_camera"]
gamecube-adapter = ["dep:gc-adapter-neo"]
[dependencies]
bevy = { version = "0.19", features = ["asset_processor", "basis-universal", "compressed_image_saver", "bevy_settings"] }
@@ -34,7 +35,6 @@ strum = "0.28.0"
strum_macros = "0.28.0"
bevy_asset_loader = "0.27.0"
ron_asset_manager = "0.9.0"
gc-adapter-neo = { version = "1.1.1", features = ["libusb"] }
rhai = "1.26.0"
enum_cycling = "0.2.1"
enum_cycling_derive = "0.2.1"
@@ -49,3 +49,6 @@ inherits = "release"
lto = "thin"
codegen-units = 1
strip = "symbols"
[target.'cfg(not(target_os = "windows"))'.dependencies]
gc-adapter-neo = { version = "1.1.1", features = ["libusb"], optional = true }
+2 -10
View File
@@ -7,7 +7,8 @@ use bevy::input::gamepad::{
};
use bevy::prelude::*;
use super::poll::{GcAdapterSnapshot, GcPortState};
use super::GcPorts;
use super::poll::GcAdapterSnapshot;
/// GameCube adapters report 4 ports.
pub const GC_PORT_COUNT: usize = 4;
@@ -23,15 +24,6 @@ const GC_ADAPTER_PID: u16 = 0x0337;
#[derive(Component, Debug, Clone, Copy)]
pub struct GcPort(pub u8);
/// Tracks which entity (if any) represents each of the 4 adapter ports,
/// and the last snapshot seen, so both systems below can diff instead of
/// re-deriving state every frame.
#[derive(Resource, Default)]
pub struct GcPorts {
pub entities: [Option<Entity>; GC_PORT_COUNT],
last: [GcPortState; GC_PORT_COUNT],
}
fn passthrough_gamepad_settings() -> GamepadSettings {
let mut settings = GamepadSettings::default();
for axis in GamepadAxis::all() {
+15 -1
View File
@@ -1,9 +1,20 @@
#[cfg(all(feature = "gamecube-adapter", not(target_os = "windows")))]
pub mod bridge;
#[cfg(all(feature = "gamecube-adapter", not(target_os = "windows")))]
pub mod poll;
pub use bridge::{GC_PORT_COUNT, GcPort, GcPorts};
#[cfg(all(feature = "gamecube-adapter", not(target_os = "windows")))]
pub use bridge::{GC_PORT_COUNT, GcPort};
#[cfg(all(feature = "gamecube-adapter", not(target_os = "windows")))]
pub use poll::{GcAdapterSnapshot, GcPortState};
#[derive(Resource, Default)]
pub struct GcPorts {
pub entities: [Option<Entity>; 4],
#[cfg(all(feature = "gamecube-adapter", not(target_os = "windows")))]
pub(super) last: [poll::GcPortState; 4],
}
use bevy::input::InputSystems;
use bevy::input::gamepad::{gamepad_connection_system, gamepad_event_processing_system};
use bevy::prelude::*;
@@ -15,6 +26,8 @@ impl Plugin for GamecubeAdapterPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<GcPorts>();
#[cfg(all(feature = "gamecube-adapter", not(target_os = "windows")))]
{
let Ok(snapshot) = poll::spawn_poll_thread() else {
// No adapter connected; leave GcPorts empty and skip wiring the
// polling systems.
@@ -33,3 +46,4 @@ impl Plugin for GamecubeAdapterPlugin {
);
}
}
}