mirror of
https://github.com/godotengine/godot.git
synced 2025-04-07 00:44:24 +08:00
Merge pull request #103199 from raulsntos/gdextension/version+status
GDExtension: Add `status` to `get_godot_version`
This commit is contained in:
commit
a5dbf3bd49
@ -241,12 +241,26 @@ GDExtensionInterfaceFunctionPtr gdextension_get_proc_address(const char *p_name)
|
||||
return GDExtension::get_interface_function(p_name);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
static void gdextension_get_godot_version(GDExtensionGodotVersion *r_godot_version) {
|
||||
r_godot_version->major = VERSION_MAJOR;
|
||||
r_godot_version->minor = VERSION_MINOR;
|
||||
r_godot_version->patch = VERSION_PATCH;
|
||||
r_godot_version->string = VERSION_FULL_NAME;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void gdextension_get_godot_version2(GDExtensionGodotVersion2 *r_godot_version) {
|
||||
r_godot_version->major = VERSION_MAJOR;
|
||||
r_godot_version->minor = VERSION_MINOR;
|
||||
r_godot_version->patch = VERSION_PATCH;
|
||||
r_godot_version->hex = VERSION_HEX;
|
||||
r_godot_version->status = VERSION_STATUS;
|
||||
r_godot_version->build = VERSION_BUILD;
|
||||
r_godot_version->hash = VERSION_HASH;
|
||||
r_godot_version->timestamp = VERSION_TIMESTAMP;
|
||||
r_godot_version->string = VERSION_FULL_NAME;
|
||||
}
|
||||
|
||||
// Memory Functions
|
||||
static void *gdextension_mem_alloc(size_t p_size) {
|
||||
@ -1666,7 +1680,10 @@ static void gdextension_editor_help_load_xml_from_utf8_chars(const char *p_data)
|
||||
#define REGISTER_INTERFACE_FUNC(m_name) GDExtension::register_interface_function(#m_name, (GDExtensionInterfaceFunctionPtr) & gdextension_##m_name)
|
||||
|
||||
void gdextension_setup_interface() {
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
REGISTER_INTERFACE_FUNC(get_godot_version);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
REGISTER_INTERFACE_FUNC(get_godot_version2);
|
||||
REGISTER_INTERFACE_FUNC(mem_alloc);
|
||||
REGISTER_INTERFACE_FUNC(mem_realloc);
|
||||
REGISTER_INTERFACE_FUNC(mem_free);
|
||||
|
@ -790,9 +790,22 @@ typedef struct {
|
||||
const char *string;
|
||||
} GDExtensionGodotVersion;
|
||||
|
||||
typedef struct {
|
||||
uint32_t major;
|
||||
uint32_t minor;
|
||||
uint32_t patch;
|
||||
uint32_t hex; // Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C)
|
||||
const char *status; // (e.g. "stable", "beta", "rc1", "rc2")
|
||||
const char *build; // (e.g. "custom_build")
|
||||
const char *hash; // Full Git commit hash.
|
||||
uint64_t timestamp; // Git commit date UNIX timestamp in seconds, or 0 if unavailable.
|
||||
const char *string; // (e.g. "Godot v3.1.4.stable.official.mono")
|
||||
} GDExtensionGodotVersion2;
|
||||
|
||||
/**
|
||||
* @name get_godot_version
|
||||
* @since 4.1
|
||||
* @deprecated in Godot 4.5. Use `get_godot_version2` instead.
|
||||
*
|
||||
* Gets the Godot version that the GDExtension was loaded into.
|
||||
*
|
||||
@ -800,6 +813,16 @@ typedef struct {
|
||||
*/
|
||||
typedef void (*GDExtensionInterfaceGetGodotVersion)(GDExtensionGodotVersion *r_godot_version);
|
||||
|
||||
/**
|
||||
* @name get_godot_version2
|
||||
* @since 4.5
|
||||
*
|
||||
* Gets the Godot version that the GDExtension was loaded into.
|
||||
*
|
||||
* @param r_godot_version A pointer to the structure to write the version information into.
|
||||
*/
|
||||
typedef void (*GDExtensionInterfaceGetGodotVersion2)(GDExtensionGodotVersion2 *r_godot_version);
|
||||
|
||||
/* INTERFACE: Memory */
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user