Implement multiplayer #2
|
@ -1 +1 @@
|
||||||
Subproject commit 7e31fbd5824d612e26a176aa2946497cfb2aa02e
|
Subproject commit bc864644f791e17d0060a60ebf1eea938bcf80af
|
|
@ -64,8 +64,6 @@ extern "C" {
|
||||||
fn vb_emulate_ex(sims: *mut *mut VB, count: c_uint, cycles: *mut u32) -> c_int;
|
fn vb_emulate_ex(sims: *mut *mut VB, count: c_uint, cycles: *mut u32) -> c_int;
|
||||||
#[link_name = "vbGetCartROM"]
|
#[link_name = "vbGetCartROM"]
|
||||||
fn vb_get_cart_rom(sim: *mut VB, size: *mut u32) -> *mut c_void;
|
fn vb_get_cart_rom(sim: *mut VB, size: *mut u32) -> *mut c_void;
|
||||||
#[link_name = "vbGetPeer"]
|
|
||||||
fn vb_get_peer(sim: *mut VB) -> *mut VB;
|
|
||||||
#[link_name = "vbGetPixels"]
|
#[link_name = "vbGetPixels"]
|
||||||
fn vb_get_pixels(
|
fn vb_get_pixels(
|
||||||
sim: *mut VB,
|
sim: *mut VB,
|
||||||
|
@ -205,11 +203,7 @@ impl Sim {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unlink(&mut self) {
|
pub fn unlink(&mut self) {
|
||||||
let peer = unsafe { vb_get_peer(self.sim) };
|
unsafe { vb_set_peer(self.sim, ptr::null_mut()) };
|
||||||
if !peer.is_null() {
|
|
||||||
unsafe { vb_set_peer(peer, ptr::null_mut()) };
|
|
||||||
unsafe { vb_set_peer(self.sim, ptr::null_mut()) };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn emulate(&mut self) {
|
pub fn emulate(&mut self) {
|
||||||
|
@ -292,11 +286,8 @@ impl Drop for Sim {
|
||||||
// SAFETY: we made this pointer ourselves, we can for sure free it
|
// SAFETY: we made this pointer ourselves, we can for sure free it
|
||||||
unsafe { drop(Box::from_raw(ptr)) };
|
unsafe { drop(Box::from_raw(ptr)) };
|
||||||
|
|
||||||
// If we're linked to another sim, unlink them from ourselves.
|
// If we're linked to another sim, unlink from them.
|
||||||
let peer = unsafe { vb_get_peer(self.sim) };
|
unsafe { vb_set_peer(self.sim, ptr::null_mut()) };
|
||||||
if !peer.is_null() {
|
|
||||||
unsafe { vb_set_peer(peer, ptr::null_mut()) };
|
|
||||||
}
|
|
||||||
|
|
||||||
let len = unsafe { vb_size_of() }.div_ceil(4);
|
let len = unsafe { vb_size_of() }.div_ceil(4);
|
||||||
// SAFETY: the sim's memory originally came from a Vec<u64>
|
// SAFETY: the sim's memory originally came from a Vec<u64>
|
||||||
|
|
Loading…
Reference in New Issue