Skip to content

Commit

Permalink
More heap, less stack
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Feb 18, 2024
1 parent eede473 commit 154a6fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/hollow_knight_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,8 @@ pub struct BossSequenceDoorCompletion {
// --------------------------------------------------------

pub struct GameManagerFinder {
string_list_offests: StringListOffsets,
module: mono::Module,
string_list_offests: Box<StringListOffsets>,
module: Box<mono::Module>,
image: mono::Image,
pointers: Box<GameManagerPointers>,
player_data_pointers: Box<PlayerDataPointers>,
Expand All @@ -1001,8 +1001,8 @@ pub struct GameManagerFinder {
impl GameManagerFinder {
fn new(pointer_size: PointerSize, module: mono::Module, image: mono::Image) -> GameManagerFinder {
GameManagerFinder {
string_list_offests: StringListOffsets::new(pointer_size),
module,
string_list_offests: Box::new(StringListOffsets::new(pointer_size)),
module: Box::new(module),
image,
pointers: Box::new(GameManagerPointers::new()),
player_data_pointers: Box::new(PlayerDataPointers::new()),
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() {

asr::print_message("Hello, World!");

let mut gui = SettingsGui::wait_load_merge_register().await;
let mut gui = Box::new(SettingsGui::wait_load_merge_register().await);

let mut ticks_since_gui = 0;
let mut splits = gui.get_splits();
Expand All @@ -40,17 +40,17 @@ async fn main() {
let mut auto_reset = splits::auto_reset_safe(&splits);

loop {
let process = wait_attach_hollow_knight(&mut gui).await;
let process = wait_attach_hollow_knight(&mut *gui).await;
process
.until_closes(async {
// TODO: Load some initial information from the process.
let mut scene_store = SceneStore::new();
let mut scene_store = Box::new(SceneStore::new());
let mut timing_method = gui.get_timing_method();
let mut load_remover = TimingMethodLoadRemover::new(timing_method);
let mut load_remover = Box::new(TimingMethodLoadRemover::new(timing_method));

next_tick().await;
let game_manager_finder = GameManagerFinder::wait_attach(&process).await;
let mut player_data_store = PlayerDataStore::new();
let game_manager_finder = Box::new(GameManagerFinder::wait_attach(&process).await);
let mut player_data_store = Box::new(PlayerDataStore::new());

#[cfg(debug_assertions)]
asr::print_message(&format!("geo: {:?}", game_manager_finder.get_geo(&process)));
Expand Down Expand Up @@ -88,7 +88,7 @@ async fn main() {
let new_timing_method = gui.get_timing_method();
if new_timing_method != timing_method {
timing_method = new_timing_method;
load_remover = TimingMethodLoadRemover::new(timing_method);
*load_remover = TimingMethodLoadRemover::new(timing_method);
asr::print_message(&format!("timing_method: {:?}", timing_method));
}
}
Expand Down

0 comments on commit 154a6fe

Please sign in to comment.