aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-03-12 18:55:37 +0900
committerAstatin <[email protected]>2025-03-12 18:55:37 +0900
commitcd7f4140537c85a6a0ffed98a62b9593f324edbf (patch)
tree7502d953ab54c553c03d3a8cef91d36dad46b56c
parent3ac23c20f0d29cfad1963aa117941fb9c2827126 (diff)
Remove useless ref to state in update_events
-rw-r--r--src/gamepad.rs14
-rw-r--r--src/main.rs2
2 files changed, 7 insertions, 9 deletions
diff --git a/src/gamepad.rs b/src/gamepad.rs
index 993c100..c47464b 100644
--- a/src/gamepad.rs
+++ b/src/gamepad.rs
@@ -1,7 +1,5 @@
-use crate::state;
use crate::window::Keys;
use gilrs::{Button, GamepadId, Gilrs};
-use state::GBState;
use std::fs::File;
use std::io::{ErrorKind, Read, Write};
use winit::keyboard::KeyCode;
@@ -12,7 +10,7 @@ pub struct Gamepad {
}
pub trait Input {
- fn update_events(&mut self, cycles: u128, state: &GBState);
+ fn update_events(&mut self, cycles: u128);
fn get_action_gamepad_reg(&self) -> u8;
fn get_direction_gamepad_reg(&self) -> u8;
}
@@ -42,7 +40,7 @@ impl Gamepad {
}
impl Input for Gamepad {
- fn update_events(&mut self, _cycles: u128, _state: &GBState) {
+ fn update_events(&mut self, _cycles: u128) {
while let Some(_) = self.gilrs.next_event() {}
}
@@ -116,7 +114,7 @@ impl Keyboard {
}
impl Input for Keyboard {
- fn update_events(&mut self, _cycles: u128, _state: &GBState) {
+ fn update_events(&mut self, _cycles: u128) {
let mut res = 0xf;
let keys = self.keys.borrow();
@@ -187,8 +185,8 @@ impl GamepadRecorder {
}
impl Input for GamepadRecorder {
- fn update_events(&mut self, cycles: u128, state: &GBState) {
- self.input.update_events(cycles, state);
+ fn update_events(&mut self, cycles: u128) {
+ self.input.update_events(cycles);
let new_action_reg = self.input.get_action_gamepad_reg();
let new_direction_reg = self.input.get_direction_gamepad_reg();
@@ -254,7 +252,7 @@ impl GamepadReplay {
}
impl Input for GamepadReplay {
- fn update_events(&mut self, cycles: u128, _state: &GBState) {
+ fn update_events(&mut self, cycles: u128) {
if let Some(next_cycle_update) = self.next_cycle_update {
if cycles > next_cycle_update {
let mut inputs: [u8; 2] = [0; 2];
diff --git a/src/main.rs b/src/main.rs
index 71e58d3..66b60e5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -116,7 +116,7 @@ fn main() {
nanos_sleep += c as i128 * (consts::CPU_CYCLE_LENGTH_NANOS as f32 / cli.speed) as i128;
if nanos_sleep > 0 {
- gamepad.update_events(total_cycle_counter, &state);
+ gamepad.update_events(total_cycle_counter);
let (action_button_reg, direction_button_reg) = (
gamepad.get_action_gamepad_reg(),