Skip to content

Commit 7f0d7fb

Browse files
committed
Use correct name for "operator new"
1 parent 43dcabe commit 7f0d7fb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ewext/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use modules::{Module, ModuleCtx, entity_sync::EntitySync};
88
use net::NetManager;
99
use noita_api::add_lua_fn;
1010
use noita_api::addr_grabber::Globals;
11+
use noita_api::heap::raw_new;
1112
use noita_api::noita::types::EntityManager;
1213
use noita_api::noita::world::ParticleWorldState;
1314
use noita_api::{
@@ -357,6 +358,7 @@ pub(crate) fn print_error(error: eyre::Report) -> eyre::Result<()> {
357358
pub unsafe extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int {
358359
#[cfg(debug_assertions)]
359360
println!("Initializing ewext");
361+
raw_new(1);
360362

361363
if let Err(_e) = KEEP_SELF_LOADED.as_ref() {
362364
#[cfg(debug_assertions)]

noita_api/src/heap.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ struct Msvcr {
77
}
88

99
static MSVCR: LazyLock<Msvcr> = LazyLock::new(|| unsafe {
10-
println!("Loading MSVCR");
1110
let lib = libloading::Library::new("./msvcr120.dll").expect("library to exist");
12-
let op_new = *lib.get(b"operator_new\0").expect("symbol to exist");
11+
let op_new = *lib.get(b"??2@YAPAXI@Z\0").expect("symbol to exist");
1312
// let op_delete = *lib.get(b"operator_delete\0").expect("symbol to exist");
1413
// let op_delete_array = *lib.get(b"operator_delete[]\0").expect("symbol to exist");
15-
println!("Load OK");
1614
Msvcr {
1715
op_new,
1816
// op_delete,

0 commit comments

Comments
 (0)