frida-il2cpp-bridge: Struct methods may be invoked incorrectly
Take the following:
const double = Il2Cpp.corlib.class("System.Double").new();
double.field("m_value").value = 51.51100833075058;
console.log(double);
const int32 = Il2Cpp.corlib.class("System.Int32").new();
int32.field("m_value").value = 0;
console.log(int32);
Console:
2,65922814801271E-312
1362888960
Logging, for example int32.field(“m_value”).value, works as expected.
Replicating this issue: #17
const Vector2Class = Il2Cpp.domain.assembly("UnityEngine.CoreModule").image.class("UnityEngine.Vector2");
const vec = Vector2Class.new();
vec.method(".ctor").invoke(36, 4);
console.log("X: " + vec.field("x").value);
console.log("Y: " + vec.field("y").value);
Console:
X: 0
Y: 0
It’s important to note that logging just the struct gives me the right values but accessing the fields does not. It also seems that the value applied is the incorrect one being shown and not the one in m_value.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- Fix struct method invocation in Unity >= 2021.2.0 (#321) — committed to vfsfitvnm/frida-il2cpp-bridge by vfsfitvnm a year ago
- Fix regression (#321) — committed to vfsfitvnm/frida-il2cpp-bridge by vfsfitvnm a year ago
- Fix boxed struct field value handles being wrongly calculated (#321) — committed to vfsfitvnm/frida-il2cpp-bridge by vfsfitvnm 9 months ago
- Fix struct methods invocations (#321) — committed to vfsfitvnm/frida-il2cpp-bridge by vfsfitvnm 9 months ago
Yeah, thanks, it looks like so. We really need tests…