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

[Bug]: IL2CPP 32-bit struct layouts are mismatched #3

Open
just-ero opened this issue Oct 16, 2022 · 0 comments
Open

[Bug]: IL2CPP 32-bit struct layouts are mismatched #3

just-ero opened this issue Oct 16, 2022 · 0 comments
Assignees
Labels
area: unity bug Issue reports behavior which is not expected. help wanted Issue requires advanced knowledge. low priority Issue is of low priority.

Comments

@just-ero
Copy link
Owner

What helper class does this issue occur on?

Unity

Description

32-bit versions of IL2CPP act somewhat special.

Games on Unity 2020.1 appear to load pre-2019 structs (Il2CppClass version which does not contain unity_user_data). However, the cctor_thread field is decorated with ALIGN_TYPE(8). It is likely a field of pointer-type size, but it must be 8-byte aligned, which causes alignment issues on 32-bit games.

Since there aren't many 32-bit IL2CPP games, this issue is currently not of high priority.

Shown below is an example from the game "Granny 3" for the PC.

Reproduction Steps

state("Granny 3") {}

startup
{
  Assembly.Load(File.ReadAllBytes("Components/asl-help")).CreateInstance("Unity");
}

init
{
  vars.Helper.TryLoad = (Func<dynamic, bool>)(mono =>
  {
    var invSys = mono["InventorySystem"];

    return true;
  });
}

Error Messages

---

Regression?

No response

Potential Causes and Fixes

The structs being outdated like that may go back to the version of the IL2CPP library, which the helper is able to infer. It may be possible to fix that issue through that.

The alignment issue cannot be fixed easily. It likely requires a new custom attribute in the structs which the TypeParser class will have to account for.

@just-ero just-ero added area: unity bug Issue reports behavior which is not expected. help wanted Issue requires advanced knowledge. low priority Issue is of low priority. labels Oct 16, 2022
@just-ero just-ero self-assigned this Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: unity bug Issue reports behavior which is not expected. help wanted Issue requires advanced knowledge. low priority Issue is of low priority.
Projects
None yet
Development

No branches or pull requests

1 participant