LiveSplit / asr

Helper crate to write auto splitters for LiveSplit One's auto splitting runtime.
https://livesplit.org/asr/asr
Apache License 2.0
10 stars 10 forks source link

Added the ability to iterate over exported symbols in a given pe module #66

Closed Jujstme closed 1 year ago

Jujstme commented 1 year ago

Some processes do export useful symbols that can be used to recover memory addresses or other useful values. The newly added symbols() function allows to iterate over them in order to recover, if needed, the addresses of interest.

For example, Duckstation (a PS1 emulator) exports the address of the emulated RAM as a symbol, so it can be easily recovered.

Esample:

let pointer: Option<Symbol> = pe::symbols(&process, main_module).find(|symbol| {
    symbol
        .get_name::<5>(&process)
        .is_ok_and(|name| name.matches(b"RAM"))
});

let address: Address = pointer.unwrap().address;