Statically compile callbacks
This commit is contained in:
parent
5ce39fb70e
commit
9f7895a457
3
build.rs
3
build.rs
|
@ -23,6 +23,9 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.define("VB_LITTLE_ENDIAN", None)
|
||||
.define("VB_SIGNED_PROPAGATE", None)
|
||||
.define("VB_DIV_GENERIC", None)
|
||||
.define("VB_DIRECT_EXECUTE", "on_execute")
|
||||
.define("VB_DIRECT_READ", "on_read")
|
||||
.define("VB_DIRECT_WRITE", "on_write")
|
||||
.file(Path::new("shrooms-vb-core/core/vb.c"))
|
||||
.compile("vb");
|
||||
|
||||
|
|
|
@ -178,6 +178,7 @@ extern "C" fn on_frame(sim: *mut VB) -> c_int {
|
|||
1
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn on_execute(sim: *mut VB, address: u32, _code: *const u16, _length: c_int) -> c_int {
|
||||
// SAFETY: the *mut VB owns its userdata.
|
||||
// There is no way for the userdata to be null or otherwise invalid.
|
||||
|
@ -201,6 +202,7 @@ extern "C" fn on_execute(sim: *mut VB, address: u32, _code: *const u16, _length:
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn on_read(
|
||||
sim: *mut VB,
|
||||
address: u32,
|
||||
|
@ -226,6 +228,7 @@ extern "C" fn on_read(
|
|||
0
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn on_write(
|
||||
sim: *mut VB,
|
||||
address: u32,
|
||||
|
|
Loading…
Reference in New Issue