Skip to content

Commit

Permalink
Merge pull request #220 from tosuapp/fix/selected-mods-reading
Browse files Browse the repository at this point in the history
fix: selected mods are either list or array
  • Loading branch information
KotRikD authored Nov 12, 2024
2 parents 3dc1948 + c8ef7ef commit 4838a52
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,16 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
inlined: boolean = false,
structSize: number = 8
): number[] {
const size = this.process.readInt(list + 0x10);
const items = this.process.readIntPtr(list + 0x8);
let isArray = false;

// another hacky check :D
// 0x10 is _items in List and length in array
if (this.process.readInt(list + 0x10) > 10000000) {
isArray = true;
}

const size = this.process.readInt(list + (isArray ? 0x8 : 0x10));
const items = isArray ? list : this.process.readIntPtr(list + 0x8);

return this.readItems(items, size, inlined, structSize);
}
Expand Down

0 comments on commit 4838a52

Please sign in to comment.