소스 검색

Only check for Godot 4.0 if the pointer is aligned how it would be for the legacy interface.

Ben Lubar 1 개월 전
부모
커밋
05d2ce3006
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/godot.cpp

+ 1 - 1
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;