trace api-logging component

This commit is contained in:
lifning 2021-08-20 21:47:26 -07:00
parent 013cc247b9
commit 2b3409318b
1 changed files with 127 additions and 0 deletions

View File

@ -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<bool> {
eprintln!("{}set_rotation({:?})", self.prefix, rotation);
None
}
fn get_overscan(&mut self) -> Option<bool> {
eprintln!("{}get_overscan()", self.prefix);
None
}
fn set_message(&mut self, message: &Message) -> Option<bool> {
eprintln!("{}set_message({:?})", self.prefix, message);
None
}
fn shutdown(&mut self) -> Option<bool> {
eprintln!("{}shutdown()", self.prefix);
None
}
fn set_performance_level(&mut self, level: c_uint) -> Option<bool> {
eprintln!("{}set_performance_level({})", self.prefix, level);
None
}
fn get_system_directory(&mut self) -> Option<PathBuf> {
eprintln!("{}get_system_directory()", self.prefix);
None
}
fn set_pixel_format(&mut self, format: PixelFormat) -> Option<bool> {
eprintln!("{}set_pixel_format({:?})", self.prefix, format);
None
}
fn set_input_descriptors(&mut self, input_descriptors: &Vec<InputDescriptor2>) -> Option<bool> {
eprintln!("{}set_input_descriptors(vec![InputDescriptor2; {}])", self.prefix, input_descriptors.len());
None
}
fn set_hw_render(&mut self, hw_render_callback: &HwRenderCallback) -> Option<bool> {
eprintln!("{}set_hw_render({:?})", self.prefix, hw_render_callback);
None
}
fn get_variable(&mut self, key: &str) -> Option<String> {
eprintln!("{}get_variable({:?})", self.prefix, key);
None
}
fn set_variables(&mut self, variables: &Vec<Variable2>) -> Option<bool> {
eprintln!("{}set_variables(vec![Variable2; {}])", self.prefix, variables.len());
None
}
fn get_variable_update(&mut self) -> Option<bool> {
eprintln!("{}get_variable_update()", self.prefix);
None
}
fn set_support_no_game(&mut self, supports_no_game: bool) -> Option<bool> {
eprintln!("{}set_support_no_game({})", self.prefix, supports_no_game);
None
}
fn get_libretro_path(&mut self) -> Option<PathBuf> {
eprintln!("{}get_libretro_path()", self.prefix);
None
}
fn get_input_device_capabilities(&mut self) -> Option<u64> {
eprintln!("{}get_input_device_capabilities()", self.prefix);
None
}
fn get_core_assets_directory(&mut self) -> Option<PathBuf> {
eprintln!("{}get_core_assets_directory()", self.prefix);
None
}
fn get_save_directory(&mut self) -> Option<PathBuf> {
eprintln!("{}get_save_directory()", self.prefix);
None
}
fn set_system_av_info(&mut self, system_av_info: &SystemAvInfo) -> Option<bool> {
eprintln!("{}set_system_av_info({:?})", self.prefix, system_av_info);
None
}
fn set_subsystem_info(&mut self, subsystem_info: &Vec<SubsystemInfo2>) -> Option<bool> {
eprintln!("{}set_subsystem_info(vec![SubsystemInfo2; {}])", self.prefix, subsystem_info.len());
None
}
fn set_controller_info(&mut self, controller_info: &Vec<ControllerDescription2>) -> Option<bool> {
eprintln!("{}set_controller_info(vec![ControllerDescription2; {}])", self.prefix, controller_info.len());
None
}
fn set_memory_maps(&mut self, memory_map: &MemoryMap) -> Option<bool> {
eprintln!("{}set_memory_maps({:?})", self.prefix, memory_map);
None
}
fn set_geometry(&mut self, game_geometry: &GameGeometry) -> Option<bool> {
eprintln!("{}set_geometry({:?})", self.prefix, game_geometry);
None
}
fn get_username(&mut self) -> Option<String> {
eprintln!("{}get_username()", self.prefix);
None
}
fn get_language(&mut self) -> Option<Language> {
eprintln!("{}get_language()", self.prefix);
None
}
fn hw_get_current_framebuffer(&mut self) -> Option<usize> {
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...
}