From ebee33733bea39485ecdfdf20e846164eb300c08 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 9 Apr 2025 19:12:55 -0400 Subject: [PATCH] Improve Static Properties --- data/internal.h | 4 +++- src/property.ts | 7 +++++-- src/struct.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/data/internal.h b/data/internal.h index f88a7f0..3793672 100644 --- a/data/internal.h +++ b/data/internal.h @@ -13,4 +13,6 @@ static constexpr decltype(sizeof(T)) __real_sizeof() { return sizeof(std::conditional_t, void *, T>); } template -using __make_reference = T &; \ No newline at end of file +using __make_reference = T &; +template +using __make_pointer = T *; \ No newline at end of file diff --git a/src/property.ts b/src/property.ts index 4ecf5e6..b0e92be 100644 --- a/src/property.ts +++ b/src/property.ts @@ -43,9 +43,12 @@ export class Property { // A Single Static Property export class StaticProperty extends Property { + type(pointer: boolean) { + const parts = this.parts(); + return `${INTERNAL}make_${pointer ? 'pointer' : 'reference'}<${parts.type.trim()}${parts.arrayInfo}>`; + } // Reference referenceDefinition(addSelf: boolean) { - const parts = this.parts(); - return `${INTERNAL}make_reference<${parts.type.trim()}${parts.arrayInfo}> ${addSelf ? this.prettyName() : this.name()}`; + return `${this.type(false)} ${addSelf ? this.prettyName() : this.name()}`; } } \ No newline at end of file diff --git a/src/struct.ts b/src/struct.ts index db75661..e2387bd 100644 --- a/src/struct.ts +++ b/src/struct.ts @@ -275,7 +275,7 @@ export class Struct { // Static Properties for (const property of this.#staticProperties) { - out += `${property.referenceDefinition(true)} = *(std::remove_reference_t *) ${toHex(property.offset)};\n`; + out += `${property.referenceDefinition(true)} = *(${property.type(true)}) ${toHex(property.offset)};\n`; } // Methods