From 2b3409318b60700cbc20e986ad2c5dc1572b55ef Mon Sep 17 00:00:00 2001 From: lifning <> Date: Fri, 20 Aug 2021 21:47:26 -0700 Subject: [PATCH] trace api-logging component --- ferretro_components/src/provided/stdlib.rs | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/ferretro_components/src/provided/stdlib.rs b/ferretro_components/src/provided/stdlib.rs index 8476d7e..6d204b4 100644 --- a/ferretro_components/src/provided/stdlib.rs +++ b/ferretro_components/src/provided/stdlib.rs @@ -3,6 +3,9 @@ use std::time::{Duration, Instant}; use crate::base::ControlFlow; use crate::prelude::*; +use ferretro_base::retro::ffi::{Message, Language}; + +use std::os::raw::c_uint; #[derive(Default)] pub struct PathBufComponent { @@ -76,9 +79,133 @@ pub struct StderrCallTraceComponent { impl RetroComponent for StderrCallTraceComponent {} impl RetroCallbacks for StderrCallTraceComponent { + fn video_refresh(&mut self, data: &[u8], width: c_uint, height: c_uint, pitch: c_uint) { + eprintln!("{}video_refresh([u8; {}], {}, {}, {})", self.prefix, data.len(), width, height, pitch); + } + fn video_refresh_dupe(&mut self, width: c_uint, height: c_uint, pitch: c_uint) { + eprintln!("{}video_refresh_dupe({}, {}, {})", self.prefix, width, height, pitch); + } + fn video_refresh_hw(&mut self, width: c_uint, height: c_uint) { + eprintln!("{}video_refresh_hw({}, {})", self.prefix, width, height); + } fn audio_sample(&mut self, left: i16, right: i16) { eprintln!("{}audio_sample({}, {})", self.prefix, left, right); } + fn audio_sample_batch(&mut self, stereo_pcm: &[i16]) -> usize { + eprintln!("{}audio_sample_batch([i16; {}])", self.prefix, stereo_pcm.len()); + 0 + } + fn input_poll(&mut self) { + eprintln!("{}input_poll()", self.prefix); + } + fn input_state(&mut self, port: u32, device: InputDeviceId, index: InputIndex) -> i16 { + eprintln!("{}input_state({}, {:?}, {:?})", self.prefix, port, device, index); + 0 + } + fn set_rotation(&mut self, rotation: EnvRotation) -> Option { + eprintln!("{}set_rotation({:?})", self.prefix, rotation); + None + } + fn get_overscan(&mut self) -> Option { + eprintln!("{}get_overscan()", self.prefix); + None + } + fn set_message(&mut self, message: &Message) -> Option { + eprintln!("{}set_message({:?})", self.prefix, message); + None + } + fn shutdown(&mut self) -> Option { + eprintln!("{}shutdown()", self.prefix); + None + } + fn set_performance_level(&mut self, level: c_uint) -> Option { + eprintln!("{}set_performance_level({})", self.prefix, level); + None + } + fn get_system_directory(&mut self) -> Option { + eprintln!("{}get_system_directory()", self.prefix); + None + } + fn set_pixel_format(&mut self, format: PixelFormat) -> Option { + eprintln!("{}set_pixel_format({:?})", self.prefix, format); + None + } + fn set_input_descriptors(&mut self, input_descriptors: &Vec) -> Option { + eprintln!("{}set_input_descriptors(vec![InputDescriptor2; {}])", self.prefix, input_descriptors.len()); + None + } + fn set_hw_render(&mut self, hw_render_callback: &HwRenderCallback) -> Option { + eprintln!("{}set_hw_render({:?})", self.prefix, hw_render_callback); + None + } + fn get_variable(&mut self, key: &str) -> Option { + eprintln!("{}get_variable({:?})", self.prefix, key); + None + } + fn set_variables(&mut self, variables: &Vec) -> Option { + eprintln!("{}set_variables(vec![Variable2; {}])", self.prefix, variables.len()); + None + } + fn get_variable_update(&mut self) -> Option { + eprintln!("{}get_variable_update()", self.prefix); + None + } + fn set_support_no_game(&mut self, supports_no_game: bool) -> Option { + eprintln!("{}set_support_no_game({})", self.prefix, supports_no_game); + None + } + fn get_libretro_path(&mut self) -> Option { + eprintln!("{}get_libretro_path()", self.prefix); + None + } + fn get_input_device_capabilities(&mut self) -> Option { + eprintln!("{}get_input_device_capabilities()", self.prefix); + None + } + fn get_core_assets_directory(&mut self) -> Option { + eprintln!("{}get_core_assets_directory()", self.prefix); + None + } + fn get_save_directory(&mut self) -> Option { + eprintln!("{}get_save_directory()", self.prefix); + None + } + fn set_system_av_info(&mut self, system_av_info: &SystemAvInfo) -> Option { + eprintln!("{}set_system_av_info({:?})", self.prefix, system_av_info); + None + } + fn set_subsystem_info(&mut self, subsystem_info: &Vec) -> Option { + eprintln!("{}set_subsystem_info(vec![SubsystemInfo2; {}])", self.prefix, subsystem_info.len()); + None + } + fn set_controller_info(&mut self, controller_info: &Vec) -> Option { + eprintln!("{}set_controller_info(vec![ControllerDescription2; {}])", self.prefix, controller_info.len()); + None + } + fn set_memory_maps(&mut self, memory_map: &MemoryMap) -> Option { + eprintln!("{}set_memory_maps({:?})", self.prefix, memory_map); + None + } + fn set_geometry(&mut self, game_geometry: &GameGeometry) -> Option { + eprintln!("{}set_geometry({:?})", self.prefix, game_geometry); + None + } + fn get_username(&mut self) -> Option { + eprintln!("{}get_username()", self.prefix); + None + } + fn get_language(&mut self) -> Option { + eprintln!("{}get_language()", self.prefix); + None + } + fn hw_get_current_framebuffer(&mut self) -> Option { + eprintln!("{}hw_get_current_framebuffer()", self.prefix); + None + } + fn hw_get_proc_address(&mut self, sym: &str) -> Option<*const ()> { + eprintln!("{}hw_get_proc_address({:?})", self.prefix, sym); + None + } // TODO: etc... }