From f4335e3f112ab0c735e783d7699906a4ff01a1b5 Mon Sep 17 00:00:00 2001 From: lif Date: Sun, 17 Nov 2019 23:13:25 -0800 Subject: [PATCH] stubs for ENVIRONMENT_GET_PERF_INTERFACE --- src/retro/wrapper.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/retro/wrapper.rs b/src/retro/wrapper.rs index cae3dcd..e33df7c 100644 --- a/src/retro/wrapper.rs +++ b/src/retro/wrapper.rs @@ -225,7 +225,18 @@ impl StaticCallbacks { // TODO EnvCmd::GetSensorInterface => {}, // TODO EnvCmd::GetCameraInterface => {}, EnvCmd::GetLogInterface => unsafe { c_ext_handle_get_log_interface(data as *mut LogCallback) }, - // TODO EnvCmd::GetPerfInterface => {}, + EnvCmd::GetPerfInterface => { + let pc = PerfCallback { + get_time_usec: Self::perf_get_time_usec_cb, + get_cpu_features: Self::perf_get_cpu_features_cb, + get_perf_counter: Self::perf_get_counter_cb, + perf_register: Self::perf_register_cb, + perf_start: Self::perf_start_cb, + perf_stop: Self::perf_stop_cb, + perf_log: Self::perf_log_cb, + }; + Self::clone_into_void(data, &pc)? + }, // TODO EnvCmd::GetLocationInterface => {}, EnvCmd::GetCoreAssetsDirectory => Self::path_into_void(data, handler.get_core_assets_directory()?)?, EnvCmd::GetSaveDirectory => Self::path_into_void(data, handler.get_save_directory()?)?, @@ -321,13 +332,20 @@ impl StaticCallbacks { } } } - extern "C" fn set_rumble_state_cb(port: c_uint, effect: RumbleEffect, strength: u16) -> bool { match unsafe { CB_SINGLETON.handler.as_mut() } { Some(cb) => cb.set_rumble_state(port, effect, strength), None => false, } } + // TODO: trait methods + extern "C" fn perf_get_time_usec_cb() -> Time { 0 } + extern "C" fn perf_get_counter_cb() -> PerfTick { 0 } + extern "C" fn perf_get_cpu_features_cb() -> u64 { 0 } + extern "C" fn perf_log_cb() {} + extern "C" fn perf_register_cb(_counter: *mut PerfCounter) {} + extern "C" fn perf_start_cb(_counter: *mut PerfCounter) {} + extern "C" fn perf_stop_cb(_counter: *mut PerfCounter) {} } pub struct LibretroWrapper {