Skip to content

Commit

Permalink
Some stuff that might help with reversing noita
Browse files Browse the repository at this point in the history
  • Loading branch information
IntQuant committed Nov 30, 2024
1 parent e036116 commit fd3bdc7
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ewext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ fn test_fn(_lua: LuaState) -> eyre::Result<()> {
Ok(())
}

fn probe(_lua: LuaState) {
backtrace::trace(|frame| {
let ip = frame.ip() as usize;
println!("Probe: 0x{ip:x}");
false
});
}

fn __gc(_lua: LuaState) {
println!("ewext collected in thread {:?}", thread::current().id());
NETMANAGER.lock().unwrap().take();
Expand All @@ -265,6 +273,15 @@ fn __gc(_lua: LuaState) {
pub unsafe extern "C" fn luaopen_ewext0(lua: *mut lua_State) -> c_int {
println!("Initializing ewext");

println!(
"lua_call: 0x{:x}",
(*LUA.lua_call.as_ref().unwrap()) as usize
);
println!(
"lua_pcall: 0x{:x}",
(*LUA.lua_pcall.as_ref().unwrap()) as usize
);

unsafe {
LUA.lua_createtable(lua, 0, 0);

Expand All @@ -284,6 +301,7 @@ pub unsafe extern "C" fn luaopen_ewext0(lua: *mut lua_State) -> c_int {
add_lua_fn!(on_world_initialized);
add_lua_fn!(test_fn);
add_lua_fn!(bench_fn);
add_lua_fn!(probe);

add_lua_fn!(netmanager_connect);
add_lua_fn!(netmanager_recv);
Expand Down
107 changes: 107 additions & 0 deletions shared/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd3bdc7

Please sign in to comment.