Casting a pointer to Array? #412
Answered
by
thinhbuzz
PeteSpencer
asked this question in
Q&A
-
Hey I want to replace my hardcoded fieldnames with offset reading till the point there are no offset needed anymore. But I don't know how to get that. export class Sequence extends ObjectBase {
// works ✔️
get countDown() {
return this.object.field('IIOIKIBBJBJ').value;
}
// works ✔️
get countDownByOffset() {
return this.object.handle.add(OFFSET.SEQUENCE.COUNTDOWN).readLong();
}
// doesn't get it working ❓
get sequenceByOffset(): string[] {
const itemsArrayPointer = this.object.handle.add(OFFSET.SEQUENCE.ITEMS).readPointer();
// I would like to do s.t. like
const itemsArray = itemsArrayPointer.field<Il2Cpp.Object>('OFFSET.SEQUENCE.ITEM').value;
const arr = itemsArray.field<Il2Cpp.Array<Il2Cpp.Object>>('array').value;
...
...
}
// works ✔️
get sequence(): string[] {
const itemsArray = this.object.field<Il2Cpp.Object>('ANMFIJPOGNH').value;
const arr = itemsArray.field<Il2Cpp.Array<Il2Cpp.Object>>('array').value;
let items = [];
for (let i = 0; i < count; i++) {
items.push(arr.get(i).field<Il2Cpp.String>('HGOLIBONGLP').value.content);
}
return items as string[];
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
thinhbuzz
Oct 23, 2023
Replies: 1 comment 1 reply
-
try new Il2Cpp.Array<Il2Cpp.Object>(pointer.readPointer(this.object.handle.add(OFFSET.SEQUENCE.ITEMS).readPointer())) p/s: By the way, you should use the field name because the offset of armeabi-v7a and arm64-v8a will be different |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
PeteSpencer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try
p/s: By the way, you should use the field name because the offset of armeabi-v7a and arm64-v8a will be different