Skip to content

Commit

Permalink
Merge pull request #44 from AlexKnauth/linux
Browse files Browse the repository at this point in the history
Try Linux Support
  • Loading branch information
AlexKnauth authored Jan 29, 2024
2 parents 0d26cde + 40a05e2 commit 79170af
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
asr = { git = "https://github.com/AlexKnauth/asr", branch = "cattrs-mono-3", features = [
asr = { git = "https://github.com/AlexKnauth/asr", branch = "cattrs-mono-3-linux", features = [
"alloc", # Working with allocations.
"std",
"derive", # Defining your own settings structs, converting endianness, and binding to .NET classes.
Expand Down
4 changes: 2 additions & 2 deletions crates/ugly_widget/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/ugly_widget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
asr = { git = "https://github.com/AlexKnauth/asr", branch = "cattrs-mono-3", features = [
asr = { git = "https://github.com/AlexKnauth/asr", branch = "cattrs-mono-3-linux", features = [
"alloc", # Working with allocations.
"std",
"derive", # Defining your own settings structs, converting endianness, and binding to .NET classes.
Expand Down
10 changes: 7 additions & 3 deletions src/hollow_knight_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::cell::OnceCell;
use std::cmp::min;
use std::mem;
use std::collections::BTreeMap;
use asr::file_format::pe;
use asr::file_format::{elf, pe};
use asr::future::{next_tick, retry};
use asr::watcher::Pair;
use asr::{Address, Address32, Address64, PointerSize, Process};
Expand All @@ -18,8 +18,9 @@ use crate::file;

// --------------------------------------------------------

static HOLLOW_KNIGHT_NAMES: [&str; 3] = [
static HOLLOW_KNIGHT_NAMES: [&str; 4] = [
"hollow_knight.exe", // Windows
"hollow_knight.x86_64", // Linux
"Hollow Knight", // Mac
"hollow_knight", // Mac
];
Expand Down Expand Up @@ -3157,7 +3158,10 @@ fn process_pointer_size(process: &Process) -> Option<PointerSize> {
pe::MachineType::read(process, mono_addr)?.pointer_size()
} else if bytes.starts_with(&[0x7F, 0x45, 0x4C, 0x46]) {
// ELF
None
let mono_range = ["libmono.so"].into_iter().find_map(|mono_name| {
process.get_module_range(mono_name).ok()
})?;
elf::pointer_size(process, elf::scan_elf_page(process, mono_range)?)
} else if bytes.starts_with(&[0xFE, 0xED, 0xFA, 0xCE])
| bytes.starts_with(&[0xCE, 0xFA, 0xED, 0xFE]) {
// MachO 32-bit
Expand Down

0 comments on commit 79170af

Please sign in to comment.