Skip to content

Let auto splitters attach the scene manager with a profile (#174) - #195

Open
ero-qt wants to merge 5 commits into
LiveSplit:masterfrom
ero-qt:issue-174/scene-manager
Open

ero-qt wants to merge 5 commits into
LiveSplit:masterfrom
ero-qt:issue-174/scene-manager

Conversation

@ero-qt

@ero-qt ero-qt commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Part of #174.

The scene manager now has the same attach functions as Mono and IL2CPP. SceneManager::attach(process, profile) and wait_attach(process, profile) take a Profile, and the automatic ones are now attach_auto_detect and wait_attach_auto_detect. This renames the old attach(process) and wait_attach(process).

  • Profile, Anchor, the offset structs, PathShape and ReferenceShape are public with public fields, so an auto splitter can write its own profile, signature included.
  • profiles has a constant for each of the 29 Windows and 17 Linux builds.
  • The explicit attach looks for UnityPlayer.dll or UnityPlayer.so and doesn't need alloc. With alloc it also finds a game that has the engine in its executable.
  • The match on PathShape and ReferenceShape is back, since the public enums don't warn without alloc anymore. A new variant is a compile error again.

#133 had attach_with_offsets for this. The module name stays in the crate for now. That's the next part of #174, for all three modules at once.

cargo test --all-features and cargo test --no-default-features --features unity. The new tests pin every constant to its build and attach through UnityPlayer.dll, UnityPlayer.so and an executable. I also ran all 93 Linux and Windows fixture players on it.

@CryZe CryZe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The public-profile API and the attachment tests look good. Before merging, please replace the two new module-wide dead-code suppressions with conditional compilation of the code that is only needed for automatic detection or tests. The public profile constants and explicit attachment must remain available without alloc. I'll leave this change to you rather than push an overlapping fix.

Comment on lines +27 to +29
#[cfg_attr(not(feature = "alloc"), allow(dead_code))]
mod builds;
#[cfg(any(feature = "alloc", test))]
#[cfg_attr(not(feature = "alloc"), allow(dead_code))]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove both #[cfg_attr(not(feature = "alloc"), allow(dead_code))] annotations. We want unused-code warnings to remain useful, and code that is deliberately unavailable in a feature configuration should not be compiled in that configuration.

The public constants do need these modules' profile tables without alloc, so gating the entire modules is not appropriate anymore. Instead, gate the lookup-only pieces with #[cfg(any(feature = "alloc", test))]: builds::nearest, builds::nearest_in, linux_builds::nearest, their conditional imports, and the Build::unity metadata/initializers if they are only used by lookup and tests. Keep the profile data and constants unconditional. Including test is important because the allocation-free unit tests inspect those tables.

I checked with RUSTFLAGS="--force-warn=dead_code" cargo check --no-default-features --features unity --lib: the scene-manager warnings are precisely the unity field and those three lookup helpers. Please verify the normal no-alloc library check is warning-free without these suppressions, and retain the tests both with and without alloc.

@ero-qt ero-qt Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced them with #[cfg(any(feature = "alloc", test))] on the lookup functions and Build::unity in 7670200. The library check without alloc is warning-free now and the tests pass with and without it.

I copied those two annotations from Mono though. You added the same ones to mono/mod.rs in 87a26aa and they're still on master:

// The tables also supply the allocation-free profile constants. Their lookup
// helpers are only used by automatic attachment, which requires `alloc`.
#[cfg_attr(not(feature = "alloc"), allow(dead_code))]
mod builds;
mod image;
#[cfg_attr(not(feature = "alloc"), allow(dead_code))]
mod linux_builds;

Should I open a PR that gates Mono's lookup code the same way?

@ero-qt
ero-qt requested a review from CryZe October 11, 2026 18:52
@ero-qt
ero-qt force-pushed the issue-174/scene-manager branch from 367a432 to 7670200 Compare October 11, 2026 18:56

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants