Statically compile callbacks

This commit is contained in:
Simon Gellis 2025-01-18 01:21:45 -05:00
parent 5ce39fb70e
commit 9f7895a457
2 changed files with 6 additions and 0 deletions

View File

@ -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");

View File

@ -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,