chore: satisfy clippy

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-06-27 20:31:59 -05:00
parent fc4a898177
commit fd7f0655ef
2 changed files with 26 additions and 34 deletions

View File

@ -8,8 +8,8 @@ use std::time::Duration;
pub const SM83_CYCLE_TIME: Duration = Duration::from_nanos(1_000_000_000 / SM83_CLOCK_SPEED); pub const SM83_CYCLE_TIME: Duration = Duration::from_nanos(1_000_000_000 / SM83_CLOCK_SPEED);
pub const CYCLES_IN_FRAME: Cycle = Cycle::new(456 * 154); // 456 Cycles times 154 scanlines pub const CYCLES_IN_FRAME: Cycle = Cycle::new(456 * 154); // 456 Cycles times 154 scanlines
const SM83_CLOCK_SPEED: u64 = 0x400_000; // Hz which is 4.194304Mhz const SM83_CLOCK_SPEED: u64 = 0x40_0000; // Hz which is 4.194304Mhz
const DEFAULT_TITLE: &'static str = "DMG-01 Emulator"; const DEFAULT_TITLE: &str = "DMG-01 Emulator";
pub fn init(boot_path: Option<&str>, rom_path: &str) -> Result<SM83> { pub fn init(boot_path: Option<&str>, rom_path: &str) -> Result<SM83> {
let mut cpu = match boot_path { let mut cpu = match boot_path {

View File

@ -52,8 +52,7 @@ impl Sound {
} }
fn handle_length(&mut self) { fn handle_length(&mut self) {
if self.ch1.freq_hi.idk() { if self.ch1.freq_hi.idk() && self.ch1.length_timer > 0 {
if self.ch1.length_timer > 0 {
self.ch1.length_timer -= 1; self.ch1.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction // Check in this scope ensures (only) the above subtraction
@ -62,10 +61,8 @@ impl Sound {
todo!("Disable Channel 1 until next trigger event"); todo!("Disable Channel 1 until next trigger event");
} }
} }
}
if self.ch2.freq_hi.idk() { if self.ch2.freq_hi.idk() && self.ch2.length_timer > 0 {
if self.ch2.length_timer > 0 {
self.ch2.length_timer -= 1; self.ch2.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction // Check in this scope ensures (only) the above subtraction
@ -74,10 +71,8 @@ impl Sound {
todo!("Disable Channel 2 until next trigger event"); todo!("Disable Channel 2 until next trigger event");
} }
} }
}
if self.ch3.freq_hi.idk() { if self.ch3.freq_hi.idk() && self.ch3.length_timer > 0 {
if self.ch3.length_timer > 0 {
self.ch3.length_timer -= 1; self.ch3.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction // Check in this scope ensures (only) the above subtraction
@ -86,10 +81,8 @@ impl Sound {
todo!("Disable Channel 3 until next trigger event"); todo!("Disable Channel 3 until next trigger event");
} }
} }
}
if self.ch4.freq_data.idk() { if self.ch4.freq_data.idk() && self.ch4.length_timer > 0 {
if self.ch4.length_timer > 0 {
self.ch4.length_timer -= 1; self.ch4.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction // Check in this scope ensures (only) the above subtraction
@ -99,7 +92,6 @@ impl Sound {
} }
} }
} }
}
fn handle_sweep(&mut self) { fn handle_sweep(&mut self) {
if self.ch1.sweep_timer > 0 { if self.ch1.sweep_timer > 0 {