Use correct name for "operator new"

This commit is contained in:
IQuant 2025-10-12 16:07:39 +03:00
parent 43dcabe601
commit 7f0d7fbb53
2 changed files with 3 additions and 3 deletions

View file

@ -8,6 +8,7 @@ use modules::{Module, ModuleCtx, entity_sync::EntitySync};
use net::NetManager; use net::NetManager;
use noita_api::add_lua_fn; use noita_api::add_lua_fn;
use noita_api::addr_grabber::Globals; use noita_api::addr_grabber::Globals;
use noita_api::heap::raw_new;
use noita_api::noita::types::EntityManager; use noita_api::noita::types::EntityManager;
use noita_api::noita::world::ParticleWorldState; use noita_api::noita::world::ParticleWorldState;
use noita_api::{ use noita_api::{
@ -357,6 +358,7 @@ pub(crate) fn print_error(error: eyre::Report) -> eyre::Result<()> {
pub unsafe extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int { pub unsafe extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
println!("Initializing ewext"); println!("Initializing ewext");
raw_new(1);
if let Err(_e) = KEEP_SELF_LOADED.as_ref() { if let Err(_e) = KEEP_SELF_LOADED.as_ref() {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]

View file

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