Add measured offsets for known IL2CPP builds - #144
Open
ero-qt wants to merge 10 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #142.
attach_auto_detectnow checks what the game actually is before guessing: it reads the version of the mappedglobal-metadata.dat(the file's magic sits at the start of a memory range, so this is one small read per range) and the Unity version from UnityPlayer. If that matches a known build, we attach with its measured offsets and skip version detection entirely. If not, everything falls back to the existing detection, unchanged.attach(version)stays as it is. On a successful attach, a log line says which build it found, or that it found none.GameAssembly.dllis unique per game, so we can't pin offsets to one exact binary like we can for Mono. Instead, each build says which metadata and Unity version it applies from, and the lookup picks the newest one at or below the game's. If the game is older than everything we've measured, the lookup just doesn't answer. There are 16 builds in the table, Unity 2018.4 through 6000.7, both pointer sizes, all measured from players' ownGameAssembly.pdbs and cross-checked against the editor's il2cpp headers.Two things fell out of the measured data. Unity 2023.x didn't match any arm of the version detection and silently got the oldest layout, which one token fixes. And 6000.5 moved
Il2CppClass::static_fieldsto 0xA0, then 6000.7 moved it again to 0x98, so static field reads on those games currently go to the wrong place. The entries carry the measured values.Also fixes a field name typo and reads assembly names through the image when a build's offsets know where that is.