Skip to content

Godot SceneTree get root not working #101

Description

@olvior

I am trying to make an autosplitter for a game made in Godot.
When I start the wasm file it can locate the SceneTree but then when I call scene_tree.wait_get_root(&process).await; it hangs and never finds the root.

This is the rust code:

#![allow(dead_code)]

use asr::future::{next_tick, retry};
use asr::game_engine::godot::SceneTree;

use::asr::Address;
use::asr::Process;

asr::async_main!(stable);
static BLOODTHIEF_NAMES: [&str; 2] = [
    "bloodthief_v0.0",      // linux
    "bloodthief_v0.01.exe", // windows
];

async fn main() {
    let p_name = "bloodthief_v0.01.x86_64";
    // TODO: Set up some general state and settings.
    asr::set_tick_rate(1.0);

    loop {
        let process = wait_attach_bloodthief().await;
        if let Ok(base_address) = process.get_module_address(p_name) {
            process.until_closes(async {
                // TODO: Load some initial information from the process.
                asr::print_message("Locating SceneTree");
                let scene_tree = SceneTree::wait_locate(&process, base_address).await;
                asr::print_message("Locating root");
                let root = scene_tree.wait_get_root(&process).await;
                asr::print_message("Found root");
                asr::print_limited::<4096>(&root.print_tree::<64>(&process));


                loop {
                    // TODO: Do something on every tick.
                    asr::print_message("On tick");
                    next_tick().await;
                    every_tick(base_address);
                }
            }).await;
        }
    }
}

fn every_tick(base_address: Address) {
}

async fn wait_attach_bloodthief() -> Process {
    retry(|| {
        attach_bloodthief()
    }).await
}

fn attach_bloodthief() -> Option<Process> {
    BLOODTHIEF_NAMES.into_iter().find_map(Process::attach)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions