aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2018-02-04 16:50:19 -0500
committerDeterminant <ted.sybil@gmail.com>2018-02-04 16:50:19 -0500
commitcc32f29eedc10a7756820c491c6797c27054c433 (patch)
tree94c38915ac8c682e0c55e5228090a70bf9fa378c
parentf10e500bcbfe27558af0542b32b4a09d2a643ed4 (diff)
fix the compilation error in rust nightly build
-rw-r--r--Cargo.toml2
-rw-r--r--src/bin.rs6
-rw-r--r--src/ppu.rs3
3 files changed, 6 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 27a5d3f..973caca 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "runes"
-version = "0.1.9"
+version = "0.2.0"
authors = ["Determinant <tederminant@gmail.com>"]
description = "No-std NES emulator library and minimal emulator written purely in Rust."
repository = "https://github.com/Determinant/runes"
diff --git a/src/bin.rs b/src/bin.rs
index 83252be..f70548e 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -44,8 +44,8 @@ const PIX_WIDTH: u32 = 256;
const PIX_HEIGHT: u32 = 240;
const FB_PITCH: usize = PIX_WIDTH as usize * 3;
const FB_SIZE: usize = PIX_HEIGHT as usize * FB_PITCH;
-const AUDIO_SAMPLES: u16 = 4410;
-const AUDIO_EXTRA_SAMPLES: u16 = AUDIO_SAMPLES;
+const AUDIO_SAMPLES: u16 = 441;
+const AUDIO_EXTRA_SAMPLES: u16 = 4410;
const AUDIO_ALL_SAMPLES: u16 = AUDIO_SAMPLES + AUDIO_EXTRA_SAMPLES;
pub struct SimpleCart {
@@ -219,7 +219,7 @@ impl InputPoller for SDLEventPoller {
Event::Quit {..} | Event::KeyDown { keycode: Some(Escape), .. } => {
self.exit_flag.set(true)
},
- Event::KeyDown { keycode: Some(c), .. } =>
+ Event::KeyDown { keycode: Some(c), .. } =>
ns |= keyboard_mapping(c),
Event::KeyUp { keycode: Some(c), .. } =>
ns &= !keyboard_mapping(c),
diff --git a/src/ppu.rs b/src/ppu.rs
index 3de365d..81c316c 100644
--- a/src/ppu.rs
+++ b/src/ppu.rs
@@ -100,7 +100,8 @@ impl<'a> PPU<'a> {
#[inline]
pub fn write_oamdata(&mut self, data: u8) {
self.reg = data;
- self.get_oam_raw_mut()[self.oamaddr as usize] = data;
+ let addr = self.oamaddr as usize;
+ self.get_oam_raw_mut()[addr] = data;
self.oamaddr = self.oamaddr.wrapping_add(1);
}