WIP: starting on ENVIRONMENT_SET_HW_RENDER
This commit is contained in:
parent
f4335e3f11
commit
71683dba82
|
@ -179,7 +179,14 @@ impl StaticCallbacks {
|
|||
core.disk_add_image_index_cb.replace(dcc.add_image_index);
|
||||
true
|
||||
},
|
||||
// TODO EnvCmd::SetHwRender => {},
|
||||
EnvCmd::SetHwRender => {
|
||||
let hwr = Self::from_void::<HwRenderCallback>(data)?;
|
||||
handler.libretro_core().hw_context_reset_cb.replace(hwr.context_reset);
|
||||
handler.libretro_core().hw_context_destroy_cb.replace(hwr.context_destroy);
|
||||
hwr.get_current_framebuffer = Self::hw_get_current_framebuffer_fn;
|
||||
hwr.get_proc_address = Self::hw_get_proc_address_fn;
|
||||
false // TODO: finish
|
||||
},
|
||||
EnvCmd::GetVariable => {
|
||||
let mut var = Self::from_void::<Variable>(data)?;
|
||||
let key = unsafe { CStr::from_ptr(var.key) }.to_str().ok()?;
|
||||
|
@ -346,6 +353,13 @@ impl StaticCallbacks {
|
|||
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) {}
|
||||
|
||||
extern "C" fn hw_dummy_fn() {}
|
||||
extern "C" fn hw_get_proc_address_fn(_sym: *const c_char) -> ProcAddressFn {
|
||||
Self::hw_dummy_fn // FIXME: obvious hack
|
||||
}
|
||||
// note: libretro.h claims this is obsolete
|
||||
extern "C" fn hw_get_current_framebuffer_fn() -> usize { 0 }
|
||||
}
|
||||
|
||||
pub struct LibretroWrapper {
|
||||
|
@ -361,6 +375,8 @@ pub struct LibretroWrapper {
|
|||
disk_get_num_images_cb: Option<GetNumImagesFn>,
|
||||
disk_replace_image_index_cb: Option<ReplaceImageIndexFn>,
|
||||
disk_add_image_index_cb: Option<AddImageIndexFn>,
|
||||
hw_context_reset_cb: Option<HwContextResetFn>,
|
||||
hw_context_destroy_cb: Option<HwContextResetFn>, // same signature, libretro-sys deduplicated...
|
||||
}
|
||||
|
||||
impl From<LibretroApi> for LibretroWrapper {
|
||||
|
@ -377,7 +393,9 @@ impl From<LibretroApi> for LibretroWrapper {
|
|||
disk_set_image_index_cb: None,
|
||||
disk_get_num_images_cb: None,
|
||||
disk_replace_image_index_cb: None,
|
||||
disk_add_image_index_cb: None
|
||||
disk_add_image_index_cb: None,
|
||||
hw_context_reset_cb: None,
|
||||
hw_context_destroy_cb: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,6 +441,12 @@ impl LibretroWrapper {
|
|||
pub fn disk_add_image_index(&self) -> Option<bool> {
|
||||
self.disk_add_image_index_cb.map(|f| unsafe { f() })
|
||||
}
|
||||
pub fn hw_context_reset(&self) -> Option<()> {
|
||||
self.hw_context_reset_cb.map(|f| unsafe { f() })
|
||||
}
|
||||
pub fn hw_context_destroy(&self) -> Option<()> {
|
||||
self.hw_context_destroy_cb.map(|f| unsafe { f() })
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for LibretroWrapper {
|
||||
|
|
Loading…
Reference in New Issue