Compare commits
No commits in common. "9dfc942dfced8d5f506d2930bbca14ed51122470" and "640078e9b998ca369fd5cc64738a12084527dc51" have entirely different histories.
9dfc942dfc
...
640078e9b9
13
src/app.rs
13
src/app.rs
|
|
@ -74,7 +74,7 @@ impl Application {
|
|||
) -> Self {
|
||||
let wgpu = WgpuState::new();
|
||||
let icon = load_icon().ok().map(Arc::new);
|
||||
let mappings = MappingProvider::new(persistence.clone(), args.player2_controller);
|
||||
let mappings = MappingProvider::new(persistence.clone());
|
||||
let shortcuts = ShortcutProvider::new(persistence.clone());
|
||||
let controllers = ControllerManager::new(client.clone(), &mappings);
|
||||
let memory = Arc::new(MemoryClient::new(client.clone()));
|
||||
|
|
@ -84,7 +84,7 @@ impl Application {
|
|||
let proxy = proxy.clone();
|
||||
thread::spawn(|| process_gamepad_input(mappings, proxy));
|
||||
}
|
||||
let app = Self {
|
||||
Self {
|
||||
icon,
|
||||
wgpu,
|
||||
client,
|
||||
|
|
@ -106,16 +106,7 @@ impl Application {
|
|||
init_framebuffers: args.frame_buffers,
|
||||
init_registers: args.registers,
|
||||
init_terminal: args.terminal,
|
||||
};
|
||||
if args.player2 {
|
||||
app.client
|
||||
.send_command(EmulatorCommand::StartSecondSim(args.rom.clone()));
|
||||
|
||||
app.proxy
|
||||
.send_event(UserEvent::OpenPlayer2)
|
||||
.expect("Failed to open Player 2 window");
|
||||
}
|
||||
app
|
||||
}
|
||||
|
||||
fn open(&mut self, event_loop: &ActiveEventLoop, window: Box<dyn AppWindow>) {
|
||||
|
|
|
|||
|
|
@ -40,12 +40,6 @@ pub struct CliArgs {
|
|||
/// Watch ROM files for changes, automatically reload
|
||||
#[arg(short, long)]
|
||||
pub watch: bool,
|
||||
/// Automatically open Player 2 for multiplayer
|
||||
#[arg(long)]
|
||||
pub player2: bool,
|
||||
/// Map the first connected controller to Player 2
|
||||
#[arg(long)]
|
||||
pub player2_controller: bool,
|
||||
}
|
||||
|
||||
pub const COLOR_PRESETS: [[Color32; 2]; 3] = [
|
||||
|
|
|
|||
11
src/input.rs
11
src/input.rs
|
|
@ -272,14 +272,13 @@ impl Mappings for InputMapping {
|
|||
#[derive(Clone)]
|
||||
pub struct MappingProvider {
|
||||
persistence: Persistence,
|
||||
first_gamepad_is_p2: bool,
|
||||
device_mappings: Arc<RwLock<HashMap<DeviceId, Arc<RwLock<GamepadMapping>>>>>,
|
||||
sim_mappings: HashMap<SimId, Arc<RwLock<InputMapping>>>,
|
||||
gamepad_info: Arc<RwLock<HashMap<GamepadId, GamepadInfo>>>,
|
||||
}
|
||||
|
||||
impl MappingProvider {
|
||||
pub fn new(persistence: Persistence, first_gamepad_is_p2: bool) -> Self {
|
||||
pub fn new(persistence: Persistence) -> Self {
|
||||
let mut sim_mappings = HashMap::new();
|
||||
let mut device_mappings = HashMap::new();
|
||||
|
||||
|
|
@ -308,7 +307,6 @@ impl MappingProvider {
|
|||
device_mappings: Arc::new(RwLock::new(device_mappings)),
|
||||
gamepad_info: Arc::new(RwLock::new(HashMap::new())),
|
||||
sim_mappings,
|
||||
first_gamepad_is_p2,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -340,12 +338,7 @@ impl MappingProvider {
|
|||
.clone();
|
||||
drop(lock);
|
||||
let mut lock = self.gamepad_info.write().unwrap();
|
||||
let players = if self.first_gamepad_is_p2 {
|
||||
vec![SimId::Player2, SimId::Player1]
|
||||
} else {
|
||||
vec![SimId::Player1, SimId::Player2]
|
||||
};
|
||||
let bound_to = players
|
||||
let bound_to = SimId::values()
|
||||
.into_iter()
|
||||
.find(|sim_id| lock.values().all(|info| info.bound_to != Some(*sim_id)));
|
||||
if let Entry::Vacant(entry) = lock.entry(gamepad.id()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue