Skip to content

Commit 4beee90

Browse files
committed
Get rid of useless global allocator
1 parent 286fc5c commit 4beee90

File tree

3 files changed

+18
-119
lines changed

3 files changed

+18
-119
lines changed

Cargo.lock

Lines changed: 14 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2024"
77

88
[dependencies]
99
asr = { git = "https://github.com/LiveSplit/asr", features = [
10-
"alloc", # Working with allocations.
10+
# "alloc", # Working with allocations.
1111
"derive", # Defining your own settings structs, converting endianness, and binding to .NET classes.
1212
# "flags", # Working with bit flags.
1313
# "float-vars", # Setting floating point variables.
@@ -24,7 +24,6 @@ asr = { git = "https://github.com/LiveSplit/asr", features = [
2424
# "sms", # Accessing SEGA Master System / GameGear emulators.
2525
# "wii", # Accessing Wii emulators.
2626
] }
27-
dlmalloc = { version = "0.2.8", features = ["global"] }
2827

2928
# Bytemuck can be used to define structs that are being read from the game's process.
3029
#bytemuck = { version = "1", features = ["derive", "min_const_generics"] }

src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
use asr::{future::sleep, settings::Gui, Process};
77
use core::{str, time::Duration};
8-
use dlmalloc::GlobalDlmalloc;
9-
10-
#[global_allocator]
11-
static ALLOCATOR: GlobalDlmalloc = GlobalDlmalloc;
128

139
asr::async_main!(stable);
1410
asr::panic_handler!();
@@ -89,8 +85,9 @@ async fn main() {
8985
let process = Process::wait_attach("SniperElite.exe").await;
9086

9187
process.until_closes(async {
92-
if let (Ok(base), Ok(moduleSize)) = (process.get_module_address("SniperElite.exe"), process.get_module_size("SniperElite.exe")) {
93-
baseAddress = base;
88+
baseAddress = process.get_module_address("SniperElite.exe").unwrap_or_default();
89+
90+
if let Ok(moduleSize) = process.get_module_size("SniperElite.exe") {
9491
if moduleSize == 3805184 {
9592
addrStruct = Addr::gog();
9693
}

0 commit comments

Comments
 (0)