From 7ab5f3d69031a22d015aa30dde7da21af1e78a7a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 23 May 2022 21:59:42 -0700 Subject: [PATCH] Scripting: Allow "opaque" pointers a bit more clarity --- include/mgba/script/macros.h | 6 ++++++ include/mgba/script/types.h | 1 + 2 files changed, 7 insertions(+) diff --git a/include/mgba/script/macros.h b/include/mgba/script/macros.h index 1aa6fb87c..293c63f46 100644 --- a/include/mgba/script/macros.h +++ b/include/mgba/script/macros.h @@ -132,6 +132,9 @@ CXX_GUARD_START }; \ const struct mScriptType mSTStructPtr_ ## STRUCT = { \ .base = mSCRIPT_TYPE_OPAQUE, \ + .details = { \ + .type = &mSTStruct_ ## STRUCT \ + }, \ .size = sizeof(void*), \ .name = "ptr struct::" #STRUCT, \ .alloc = NULL, \ @@ -141,6 +144,9 @@ CXX_GUARD_START }; \ const struct mScriptType mSTStructPtrConst_ ## STRUCT = { \ .base = mSCRIPT_TYPE_OPAQUE, \ + .details = { \ + .type = &mSTStructConst_ ## STRUCT \ + }, \ .isConst = true, \ .size = sizeof(void*), \ .name = "ptr const struct::" #STRUCT, \ diff --git a/include/mgba/script/types.h b/include/mgba/script/types.h index 7a6bc6513..e0a369c46 100644 --- a/include/mgba/script/types.h +++ b/include/mgba/script/types.h @@ -236,6 +236,7 @@ struct mScriptType { struct mScriptTypeTuple tuple; struct mScriptTypeFunction function; struct mScriptTypeClass* cls; + const struct mScriptType* type; void* opaque; } details; const struct mScriptType* constType;