diff --git a/src/bin/example.rs b/src/bin/example.rs index 8152db2..b61a32f 100644 --- a/src/bin/example.rs +++ b/src/bin/example.rs @@ -4,8 +4,8 @@ extern crate sdl2; use rustro::retro; use rustro::retro::ffi::{GameGeometry, SystemInfo, SystemAvInfo}; -use rustro::retro::constants::{Input, DeviceIndex, JoypadButton, AnalogAxis, DeviceType}; -use rustro::retro::wrapper::{LibretroWrapper, VariableDescriptor, ControllerDescription2, SubsystemInfo2}; +use rustro::retro::constants::{InputDeviceId, InputIndex, JoypadButton, AnalogAxis, DeviceType}; +use rustro::retro::wrapper::{LibretroWrapper, Variable2, ControllerDescription2, SubsystemInfo2, InputDescriptor2}; use std::ffi::CStr; use std::io::Read; @@ -239,11 +239,11 @@ impl retro::wrapper::Handler for MyEmulator { self.gamepad_subsys.update(); } - fn input_state(&mut self, port: u32, device: Input, index: DeviceIndex) -> i16 { + fn input_state(&mut self, port: u32, device: InputDeviceId, index: InputIndex) -> i16 { match self.gamepads.get(port as usize) { Some(gamepad) => { match device { - Input::Joypad(button) => { + InputDeviceId::Joypad(button) => { match button_map(&button) { Some(x) => gamepad.button(x) as i16, None => match button { @@ -253,7 +253,7 @@ impl retro::wrapper::Handler for MyEmulator { } } } - Input::Analog(axis) => gamepad.axis(axis_map(index, axis)), + InputDeviceId::Analog(axis) => gamepad.axis(axis_map(index, axis)), _ => 0, } } @@ -275,11 +275,6 @@ impl retro::wrapper::Handler for MyEmulator { }; true } - fn set_subsystem_info(&mut self, subsystem_info: Vec) -> bool { - println!("subsystem info: {:?}", subsystem_info); - true - } - fn get_variable(&mut self, key: &str) -> Option { match key { "beetle_saturn_analog_stick_deadzone" => Some("15%".to_string()), @@ -289,7 +284,7 @@ impl retro::wrapper::Handler for MyEmulator { } } - fn set_variables(&mut self, variables: Vec) -> bool { + fn set_variables(&mut self, variables: Vec) -> bool { for v in variables { eprintln!("{:?}", v); } @@ -315,6 +310,11 @@ impl retro::wrapper::Handler for MyEmulator { true } + fn set_subsystem_info(&mut self, subsystem_info: Vec) -> bool { + println!("subsystem info: {:?}", subsystem_info); + true + } + fn set_controller_info(&mut self, controller_info: Vec) -> bool { for ci in controller_info { // so we can have analog support in beetle/mednafen saturn @@ -326,6 +326,13 @@ impl retro::wrapper::Handler for MyEmulator { true } + fn set_input_descriptors(&mut self, descriptors: Vec) -> bool { + for id in descriptors { + println!("{:?}", id); + } + true + } + fn set_geometry(&mut self, geom: GameGeometry) -> bool { let _ = self.canvas.window_mut().set_size(geom.base_width, geom.base_height); let _ = self.canvas.set_logical_size(geom.base_width, geom.base_height); @@ -399,11 +406,11 @@ fn button_map(retro_button: &JoypadButton) -> Option