Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test multiple HK versions #41

Open
9 of 12 tasks
AlexKnauth opened this issue Jan 27, 2024 · 12 comments
Open
9 of 12 tasks

Test multiple HK versions #41

AlexKnauth opened this issue Jan 27, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@AlexKnauth
Copy link
Owner

AlexKnauth commented Jan 27, 2024

Testing:

  • Windows 1578
  • Windows 1432
  • Windows 1221
  • Windows 1028
  • Linux 1578
  • Linux 1432
  • Linux 1221
  • Linux 1028
  • Mac 1578
  • Mac 1432
  • Mac 1221
  • Mac 1028
@AlexKnauth
Copy link
Owner Author

AlexKnauth commented Jan 27, 2024

@AlexKnauth
Copy link
Owner Author

Confirmed cattrs is an issue on Windows 1432.

@AlexKnauth
Copy link
Owner Author

I think after detecting 64-bit vs 32-bit, Windows 1221 can work now. But 1432 probably won't work on either Mac or Windows until the cattrs stuff is figured out.

@AlexKnauth
Copy link
Owner Author

After figuring out cattrs stuff, I think it's working on Windows on 1578, 1432, and 1221. And on Mac on 1578 and 1221. But for some reason Mac 1432 still seems to be broken. Like... the autosplitter is broken but also the game seems to be broken now? I can't seem to get past the main menu?

@AlexKnauth
Copy link
Owner Author

Still seems broken on Mac 1432. Even after I fixed my Mac so that it could run 1432, the autosplitter still crashes with this error message:

Unloaded, because the script trapped: error while executing at wasm backtrace:
    0: 0x96688 - <unknown>!asr::file_format::macho::fileoff_to_vmaddr::hd4f69de058f72c4a
    1: 0x8a1f0 - <unknown>!asr::game_engine::unity::mono::Module::attach::h6da9576729c07f79
    2: 0x88270 - <unknown>!hollowknight_autosplit_wasm::main::{{closure}}::{{closure}}::hf75b6f4dfa418170
    3: 0x932ea - <unknown>!update
    4: 0xad507 - <unknown>!update.command_export

Caused by:
    wasm trap: interrupt

@AlexKnauth
Copy link
Owner Author

AlexKnauth commented Apr 24, 2024

More error message variants:

Unloaded, because the script trapped: error while executing at wasm backtrace:
    0: 0x2d2d53 - core::slice::raw::from_raw_parts_mut::h0bdf3dca63a24936
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/slice/raw.rs:141
    1: 0x2cc3c9 - asr::runtime::process::Process::read_into_uninit_buf::h9e8b01120657ff8f
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/runtime/process.rs:306:20
    2: 0x2cc4d0 - asr::runtime::process::Process::read::h039e8e1723de7a91
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/runtime/process.rs:262:13
    3: 0x2ca18c - asr::file_format::macho::scan_macho_page::h872ab4264c689c62
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/file_format/macho.rs:39:15
    4: 0x2ca424 - asr::file_format::macho::symbols::h1edc04fce59cbf34
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/file_format/macho.rs:120:16
    5: 0x2c2974 - asr::game_engine::unity::mono::Module::attach::h8707c79a9000152b
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:90:17
    6: 0x2c18b0 - asr::game_engine::unity::mono::detect_version::h78e7deaa4633dcf0
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:1227:22
    7: 0x2c0886 - asr::game_engine::unity::mono::Module::attach_auto_detect::h02e09e958b102c8a
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:36:23
    8: 0x1e1bd5 - asr::game_engine::unity::mono::Module::wait_attach_auto_detect::{{closure}}::{{closure}}::hf6fa6ad2138decb8
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:213:18
    9: 0x1a5f00 - <asr::future::Retry<F> as core::future::future::Future>::poll::hac3e9881eb5197f2
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/future/mod.rs:155:15
   10: 0x1e1a56 - asr::game_engine::unity::mono::Module::wait_attach_auto_detect::{{closure}}::h0906bd35206d732c
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:213:53
   11: 0x8c6aa - hollowknight_autosplit_wasm::hollow_knight_memory::GameManagerFinder::wait_attach::{{closure}}::h23a6c9a791245bb2
                    at /Users/Alex/git/LiveSplit/hollowknight-autosplit-wasm/src/hollow_knight_memory.rs:1073:73
   12: 0x88d86 - hollowknight_autosplit_wasm::main::{{closure}}::{{closure}}::hc4907e2c62a4fb85
                    at /Users/Alex/git/LiveSplit/hollowknight-autosplit-wasm/src/lib.rs:54:93
   13: 0x1a60d8 - <asr::future::UntilProcessCloses<F> as core::future::future::Future>::poll::h91e643b91a6e9e14
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/future/mod.rs:288:13
   14: 0x8814f - hollowknight_autosplit_wasm::main::{{closure}}::hbc86f448c3f3e319
                    at /Users/Alex/git/LiveSplit/hollowknight-autosplit-wasm/src/lib.rs:96:14
   15: 0x20799a - <core::pin::Pin<P> as core::future::future::Future>::poll::hff2bb2a5c681117a
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/future/future.rs:124:9
   16: 0x210061 - update
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/future/mod.rs:412:28
   17: 0x30d85a - <unknown>!update.command_export

Caused by:
    wasm trap: interrupt
Unloaded, because the script trapped: error while executing at wasm backtrace:
    0: 0x2d4fc5 - core::option::Option<T>::unwrap_or::h424f6f67cc516034
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/option.rs:951
    1: 0x2cb311 - asr::file_format::macho::fileoff_to_vmaddr::h7bc58dda48e8be9e
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/file_format/macho.rs:172:5
    2: 0x2c9267 - asr::file_format::macho::symbols::{{closure}}::h4201376bab723d59
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/file_format/macho.rs:159:37
    3: 0x2c8f4a - core::iter::adapters::filter_map::filter_map_try_fold::{{closure}}::hdef68b50513da492
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/adapters/filter_map.rs:48:28
    4: 0x2daefa - core::iter::traits::iterator::Iterator::try_fold::hd82960b4e900299b
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/traits/iterator.rs:2462:21
    5: 0x2c74b1 - <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h10cc7a1285133c34
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/adapters/filter_map.rs:140:9
    6: 0x2c7e39 - core::iter::traits::iterator::Iterator::find::h349a53f50c90d8d5
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/traits/iterator.rs:2931:9
    7: 0x2b10af - <core::iter::adapters::fuse::Fuse<I> as core::iter::adapters::fuse::FuseImpl<I>>::find::h592de16adc3e4e87
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/adapters/fuse.rs:385:9
    8: 0x2b0fa6 - <core::iter::adapters::fuse::Fuse<I> as core::iter::traits::iterator::Iterator>::find::h68f0ccac5aa5f772
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/adapters/fuse.rs:108:9
    9: 0x2c3034 - asr::game_engine::unity::mono::Module::attach::h8707c79a9000152b
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:90:17
   10: 0x2c18b0 - asr::game_engine::unity::mono::detect_version::h78e7deaa4633dcf0
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:1227:22
   11: 0x2c0886 - asr::game_engine::unity::mono::Module::attach_auto_detect::h02e09e958b102c8a
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:36:23
   12: 0x1e1bd5 - asr::game_engine::unity::mono::Module::wait_attach_auto_detect::{{closure}}::{{closure}}::hf6fa6ad2138decb8
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:213:18
   13: 0x1a5f00 - <asr::future::Retry<F> as core::future::future::Future>::poll::hac3e9881eb5197f2
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/future/mod.rs:155:15
   14: 0x1e1a56 - asr::game_engine::unity::mono::Module::wait_attach_auto_detect::{{closure}}::h0906bd35206d732c
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/game_engine/unity/mono.rs:213:53
   15: 0x8c6aa - hollowknight_autosplit_wasm::hollow_knight_memory::GameManagerFinder::wait_attach::{{closure}}::h23a6c9a791245bb2
                    at /Users/Alex/git/LiveSplit/hollowknight-autosplit-wasm/src/hollow_knight_memory.rs:1073:73
   16: 0x88d86 - hollowknight_autosplit_wasm::main::{{closure}}::{{closure}}::hc4907e2c62a4fb85
                    at /Users/Alex/git/LiveSplit/hollowknight-autosplit-wasm/src/lib.rs:54:93
   17: 0x1a60d8 - <asr::future::UntilProcessCloses<F> as core::future::future::Future>::poll::h91e643b91a6e9e14
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/future/mod.rs:288:13
   18: 0x8814f - hollowknight_autosplit_wasm::main::{{closure}}::hbc86f448c3f3e319
                    at /Users/Alex/git/LiveSplit/hollowknight-autosplit-wasm/src/lib.rs:96:14
   19: 0x20799a - <core::pin::Pin<P> as core::future::future::Future>::poll::hff2bb2a5c681117a
                    at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/future/future.rs:124:9
   20: 0x210061 - update
                    at /Users/Alex/.cargo/git/checkouts/asr-4a96b37e9805d92c/3943421/src/future/mod.rs:412:28
   21: 0x30d85a - <unknown>!update.command_export

Caused by:
    wasm trap: interrupt

@AlexKnauth
Copy link
Owner Author

I think something is wrong with the way I implemented macho::symbols.
I'm looking for the symbol _mono_assembly_foreach, and my code isn't finding it even though it should be there according to Cutter.
Some of the symbols it "finds" are cut off versions of names.
One of the symbols my function is "finding" is _image_get_resource which doesn't exist but _mono_image_get_resource does.
Another symbol it "finds" is MD_ASSEMBLY_GET_ENTRY_POIN which doesn't exist but CMD_ASSEMBLY_GET_ENTRY_POINT does.

@AlexKnauth
Copy link
Owner Author

I think I need to find the section_64 structures for the sections within a segment, not just the segment_command_64 for the whole segment.

@AlexKnauth
Copy link
Owner Author

That still doesn't seem to be enough to find the string table.

The file offset of the string table is 0x2DF66C

The start of the string table should match this signature:

00000000 5F436C6F 73654861 6E646C65 005F436C 6F736550 726F6365 7373005F 436F7079 46696C65 005F4372 65617465 44697265

@AlexKnauth AlexKnauth added the bug Something isn't working label Apr 26, 2024
@AlexKnauth
Copy link
Owner Author

The symbol table and string table from the Mach-O file, do not appear to be in memory in-tact anywhere in the module range on Mac 1432.

I might have to fall back on filesystem access when memory access fails.

@AlexKnauth
Copy link
Owner Author

Even with filesystem access to find what the contents _mono_assembly_foreach should be, I can't seem to find those contents in memory in the module range on Mac 1432.

@AlexKnauth
Copy link
Owner Author

Okay I managed to find, at least the first 23 bytes, of _mono_assembly_foreach in memory on Mac 1432. With that, Module::attach can return some module. However, getting an image from the module fails pretty early at the monoassembly_aname. So the module address might not be correct, or maybe something else is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant