Export breakpoint fn from ewext

This commit is contained in:
IQuant 2025-11-14 23:28:41 +03:00
parent 4ab1d88319
commit c2056dfa26
3 changed files with 11 additions and 1 deletions

View file

@ -9,7 +9,7 @@ crate-type = ["cdylib"]
[profile.release]
lto = true
strip = true # Not having that causes wine debugger to crash.
#strip = true # Not having that causes wine debugger to crash.
panic = "abort"
split-debuginfo = "packed"
incremental=true

View file

@ -350,6 +350,12 @@ pub(crate) fn print_error(error: eyre::Report) -> eyre::Result<()> {
Ok(())
}
fn lua_breakpoint(_lua: LuaState) {
unsafe {
std::arch::asm!("int 3");
}
}
/// # Safety
///
/// Only gets called by lua when loading a module.
@ -411,6 +417,8 @@ pub unsafe extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int {
add_lua_fn!(module_on_new_entity);
add_lua_fn!(module_on_projectile_fired);
add_lua_fn!(lua_breakpoint);
fn sync_projectile(lua: LuaState) -> eyre::Result<()> {
ExtState::with_global(|state| {
let entity = lua.to_integer(1);

View file

@ -41,6 +41,8 @@ else
ModMagicNumbersFileAdd("mods/quant.ew/files/magic.xml")
end
util.add_cross_call("ewext_breakpoint", ewext.lua_breakpoint)
util.add_cross_call("ew_per_peer_seed", function()
return tonumber(string.sub(ctx.my_id, 8, 12), 16), tonumber(string.sub(ctx.my_id, 12), 16)
end)