[ref] Cleanup
This commit is contained in:
@@ -19,12 +19,12 @@ impl<'a> Keyboard<'a>{
|
||||
|
||||
pub fn key_down(&mut self,x:u8){
|
||||
self.bitflags |= 1<<x;
|
||||
log::debug!("Key Down, keyboard state {}",self.bitflags);
|
||||
log::trace!("Key Down - state {}",self.bitflags);
|
||||
self.dirty = true
|
||||
}
|
||||
pub fn key_up(&mut self,x:u8){
|
||||
self.bitflags &= !((1<<x) as u16);
|
||||
log::debug!("Key Up, keyboard state {}",self.bitflags);
|
||||
log::debug!("Key Up - state {}",self.bitflags);
|
||||
self.dirty = true
|
||||
}
|
||||
pub fn flush_keyboard(&mut self)->EmulatorResult<()>{
|
||||
|
@@ -53,6 +53,7 @@ impl RamMemory {
|
||||
pub fn get_data_ref(&self) -> Ref<Box<[u8; MEM_LENGTH]>> {
|
||||
self.data.borrow()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Memory for RamMemory {
|
||||
|
@@ -21,7 +21,7 @@ impl<'a> Debug for SDLGraphicsAdapter<'a> {
|
||||
|
||||
impl<'a> SDLGraphicsAdapter<'a> {
|
||||
pub fn new(graphics_processor: &'a GraphicsProcessor) -> SDLGraphicsAdapter<'a> {
|
||||
let color_fb_vec = vec![0u8; DEVICE_FRAMEBUFFER_SIZE * 3].into_boxed_slice().try_into().expect("???");
|
||||
let color_fb_vec = vec![0u8; DEVICE_FRAMEBUFFER_SIZE * 3].into_boxed_slice().try_into().expect("Failed conversion");
|
||||
SDLGraphicsAdapter {
|
||||
color_fb: color_fb_vec,
|
||||
graphics_processor,
|
||||
@@ -37,8 +37,8 @@ impl<'a> SDLGraphicsAdapter<'a> {
|
||||
let mut texture = texture_creator.create_texture(PixelFormatEnum::RGB24, TextureAccess::Streaming, 256, 256).expect("Failed to make texture");
|
||||
texture.with_lock(None, |f, _i| {
|
||||
f.copy_from_slice(self.color_fb.as_ref())
|
||||
}).expect("TODO: panic message");
|
||||
canvas.copy(&texture, None, None).expect("Failed to write texture");
|
||||
})?;
|
||||
canvas.copy(&texture, None, None)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ fn main() -> EmulatorResult<()> {
|
||||
let BytePusherArgs { file_name ,draw_scale} = BytePusherArgs::parse();
|
||||
SimpleLogger::new().with_level(LevelFilter::Info).env().init()?;
|
||||
|
||||
|
||||
let (file_bytes, ..) = try_load_rom(&file_name)?;
|
||||
|
||||
let (mut canvas, mut event_pump, audio_queue) = initiate_sdl(draw_scale);
|
||||
|
@@ -36,6 +36,11 @@ impl From<SetLoggerError> for EmulatorError{
|
||||
EmulatorError::OtherError(None,format!("Logger allocation failed! Error: {}",value))
|
||||
}
|
||||
}
|
||||
impl From<String> for EmulatorError{
|
||||
fn from(value: String) -> Self {
|
||||
EmulatorError::OtherError(None,value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user