From 95e24d13fa223ff524f8920314c4984686c73928 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 1 Feb 2024 14:55:27 -0500 Subject: [PATCH] More Fixes --- src/loader.ts | 3 ++- src/struct.ts | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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); }