diff --git a/src/loader.ts b/src/loader.ts index f7e09c9..f865463 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -123,7 +123,8 @@ export function load(target: Struct, name: string, isExtended: boolean) { } case 'vtable': { // Set VTable Address - if (!isExtended) { + target.ensureVTable(); + if (!isExtended && args.length > 0) { target.setVTableAddress(safeParseInt(args)); } break; diff --git a/src/struct.ts b/src/struct.ts index 44c0963..b58db90 100644 --- a/src/struct.ts +++ b/src/struct.ts @@ -32,7 +32,7 @@ export class Struct { } // Ensure VTable Exists - #ensureVTable() { + ensureVTable() { if (this.#vtable === null) { this.#vtable = new VTable(this.#name); this.addProperty(this.#vtable); @@ -97,7 +97,7 @@ export class Struct { throw new Error(); } if (isVirtual) { - this.#ensureVTable(); + this.ensureVTable(); this.#vtable!.add(method); } else { this.#methods.push(method); @@ -119,11 +119,11 @@ export class Struct { // Configure VTable setVTableSize(size: number, isExact: boolean) { - this.#ensureVTable(); + this.ensureVTable(); this.#vtable!.setSize(size, isExact); } setVTableAddress(address: number) { - this.#ensureVTable(); + this.ensureVTable(); this.#vtable!.setAddress(address); }