From c8ef7ef56e567ef56cdf37246714ddc6716ec96e Mon Sep 17 00:00:00 2001 From: Cherry Date: Tue, 12 Nov 2024 22:06:39 +0300 Subject: [PATCH] fix: selected mods are either list or array --- packages/tosu/src/memory/lazer.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/tosu/src/memory/lazer.ts b/packages/tosu/src/memory/lazer.ts index ca83127f..5c3a6625 100644 --- a/packages/tosu/src/memory/lazer.ts +++ b/packages/tosu/src/memory/lazer.ts @@ -257,8 +257,16 @@ export class LazerMemory extends AbstractMemory { 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); }