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 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 DEFAULT_TITLE: &'static str = "DMG-01 Emulator";
const SM83_CLOCK_SPEED: u64 = 0x40_0000; // Hz which is 4.194304Mhz
const DEFAULT_TITLE: &str = "DMG-01 Emulator";
pub fn init(boot_path: Option<&str>, rom_path: &str) -> Result<SM83> {
let mut cpu = match boot_path {

View File

@ -52,51 +52,43 @@ impl Sound {
}
fn handle_length(&mut self) {
if self.ch1.freq_hi.idk() {
if self.ch1.length_timer > 0 {
self.ch1.length_timer -= 1;
if self.ch1.freq_hi.idk() && self.ch1.length_timer > 0 {
self.ch1.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch1.length_timer == 0 {
todo!("Disable Channel 1 until next trigger event");
}
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch1.length_timer == 0 {
todo!("Disable Channel 1 until next trigger event");
}
}
if self.ch2.freq_hi.idk() {
if self.ch2.length_timer > 0 {
self.ch2.length_timer -= 1;
if self.ch2.freq_hi.idk() && self.ch2.length_timer > 0 {
self.ch2.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch2.length_timer == 0 {
todo!("Disable Channel 2 until next trigger event");
}
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch2.length_timer == 0 {
todo!("Disable Channel 2 until next trigger event");
}
}
if self.ch3.freq_hi.idk() {
if self.ch3.length_timer > 0 {
self.ch3.length_timer -= 1;
if self.ch3.freq_hi.idk() && self.ch3.length_timer > 0 {
self.ch3.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch3.length_timer == 0 {
todo!("Disable Channel 3 until next trigger event");
}
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch3.length_timer == 0 {
todo!("Disable Channel 3 until next trigger event");
}
}
if self.ch4.freq_data.idk() {
if self.ch4.length_timer > 0 {
self.ch4.length_timer -= 1;
if self.ch4.freq_data.idk() && self.ch4.length_timer > 0 {
self.ch4.length_timer -= 1;
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch4.length_timer == 0 {
todo!("Disable Channel 4 until next trigger event");
}
// Check in this scope ensures (only) the above subtraction
// made length_timer 0
if self.ch4.length_timer == 0 {
todo!("Disable Channel 4 until next trigger event");
}
}
}