From 05d2ce300624e73a96f5e73bd4fbc69e429a5f0a Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 9 Aug 2025 12:19:21 -0500 Subject: [PATCH] Only check for Godot 4.0 if the pointer is aligned how it would be for the legacy interface. --- src/godot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/godot.cpp b/src/godot.cpp index dec614222..8322638ce 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -289,7 +289,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge // Make sure we weren't passed the legacy struct. uint32_t *raw_interface = (uint32_t *)(void *)p_get_proc_address; - if (raw_interface[0] == 4 && raw_interface[1] == 0) { + if (uintptr_t(p_get_proc_address) % alignof(LegacyGDExtensionInterface) == 0 && raw_interface[0] == 4 && raw_interface[1] == 0) { // Use the legacy interface only to give a nice error. LegacyGDExtensionInterface *legacy_interface = (LegacyGDExtensionInterface *)p_get_proc_address; internal::gdextension_interface_print_error = (GDExtensionInterfacePrintError)legacy_interface->print_error;