2019-11-22 07:37:09 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* gd_mono_cache.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2022-01-03 20:27:34 +00:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2019-11-22 07:37:09 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2019-11-10 16:10:38 +00:00
|
|
|
#include "gd_mono_cache.h"
|
|
|
|
|
|
|
|
#include "gd_mono.h"
|
|
|
|
#include "gd_mono_class.h"
|
|
|
|
#include "gd_mono_marshal.h"
|
|
|
|
#include "gd_mono_method.h"
|
|
|
|
#include "gd_mono_utils.h"
|
|
|
|
|
|
|
|
namespace GDMonoCache {
|
|
|
|
|
|
|
|
CachedData cached_data;
|
|
|
|
|
2020-04-01 23:20:12 +00:00
|
|
|
#define CACHE_AND_CHECK(m_var, m_val) \
|
|
|
|
{ \
|
|
|
|
CRASH_COND(m_var != nullptr); \
|
|
|
|
m_var = m_val; \
|
|
|
|
ERR_FAIL_COND_MSG(m_var == nullptr, "Mono Cache: Member " #m_var " is null."); \
|
2019-11-10 16:10:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define CACHE_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(cached_data.class_##m_class, m_val)
|
|
|
|
#define CACHE_NS_CLASS_AND_CHECK(m_ns, m_class, m_val) CACHE_AND_CHECK(cached_data.class_##m_ns##_##m_class, m_val)
|
|
|
|
#define CACHE_RAW_MONO_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(cached_data.rawclass_##m_class, m_val)
|
|
|
|
#define CACHE_FIELD_AND_CHECK(m_class, m_field, m_val) CACHE_AND_CHECK(cached_data.field_##m_class##_##m_field, m_val)
|
|
|
|
#define CACHE_METHOD_AND_CHECK(m_class, m_method, m_val) CACHE_AND_CHECK(cached_data.method_##m_class##_##m_method, m_val)
|
|
|
|
#define CACHE_PROPERTY_AND_CHECK(m_class, m_property, m_val) CACHE_AND_CHECK(cached_data.property_##m_class##_##m_property, m_val)
|
|
|
|
|
2020-04-01 23:20:12 +00:00
|
|
|
#define CACHE_METHOD_THUNK_AND_CHECK_IMPL(m_var, m_val) \
|
|
|
|
{ \
|
|
|
|
CRASH_COND(!m_var.is_null()); \
|
|
|
|
ERR_FAIL_COND_MSG(m_val == nullptr, "Mono Cache: Method for member " #m_var " is null."); \
|
|
|
|
m_var.set_from_method(m_val); \
|
|
|
|
ERR_FAIL_COND_MSG(m_var.is_null(), "Mono Cache: Member " #m_var " is null."); \
|
2019-11-10 16:10:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define CACHE_METHOD_THUNK_AND_CHECK(m_class, m_method, m_val) CACHE_METHOD_THUNK_AND_CHECK_IMPL(cached_data.methodthunk_##m_class##_##m_method, m_val)
|
|
|
|
|
|
|
|
void CachedData::clear_corlib_cache() {
|
|
|
|
corlib_cache_updated = false;
|
|
|
|
|
2020-04-01 23:20:12 +00:00
|
|
|
class_MonoObject = nullptr;
|
|
|
|
class_bool = nullptr;
|
|
|
|
class_int8_t = nullptr;
|
|
|
|
class_int16_t = nullptr;
|
|
|
|
class_int32_t = nullptr;
|
|
|
|
class_int64_t = nullptr;
|
|
|
|
class_uint8_t = nullptr;
|
|
|
|
class_uint16_t = nullptr;
|
|
|
|
class_uint32_t = nullptr;
|
|
|
|
class_uint64_t = nullptr;
|
|
|
|
class_float = nullptr;
|
|
|
|
class_double = nullptr;
|
|
|
|
class_String = nullptr;
|
|
|
|
class_IntPtr = nullptr;
|
|
|
|
|
|
|
|
class_System_Collections_IEnumerable = nullptr;
|
2020-04-23 00:19:32 +00:00
|
|
|
class_System_Collections_ICollection = nullptr;
|
2020-04-01 23:20:12 +00:00
|
|
|
class_System_Collections_IDictionary = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
2020-04-01 23:20:12 +00:00
|
|
|
class_System_Diagnostics_StackTrace = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
methodthunk_System_Diagnostics_StackTrace_GetFrames.nullify();
|
2020-04-01 23:20:12 +00:00
|
|
|
method_System_Diagnostics_StackTrace_ctor_bool = nullptr;
|
|
|
|
method_System_Diagnostics_StackTrace_ctor_Exception_bool = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
#endif
|
|
|
|
|
2020-04-01 23:20:12 +00:00
|
|
|
class_KeyNotFoundException = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CachedData::clear_godot_api_cache() {
|
|
|
|
godot_api_cache_updated = false;
|
|
|
|
|
2020-04-01 23:20:12 +00:00
|
|
|
rawclass_Dictionary = nullptr;
|
|
|
|
|
|
|
|
class_Vector2 = nullptr;
|
|
|
|
class_Vector2i = nullptr;
|
|
|
|
class_Rect2 = nullptr;
|
|
|
|
class_Rect2i = nullptr;
|
|
|
|
class_Transform2D = nullptr;
|
|
|
|
class_Vector3 = nullptr;
|
|
|
|
class_Vector3i = nullptr;
|
Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-19 23:11:13 +00:00
|
|
|
class_Vector4 = nullptr;
|
|
|
|
class_Vector4i = nullptr;
|
2020-04-01 23:20:12 +00:00
|
|
|
class_Basis = nullptr;
|
2021-01-20 07:02:02 +00:00
|
|
|
class_Quaternion = nullptr;
|
2020-10-17 05:08:21 +00:00
|
|
|
class_Transform3D = nullptr;
|
Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-19 23:11:13 +00:00
|
|
|
class_Projection = nullptr;
|
2020-04-01 23:20:12 +00:00
|
|
|
class_AABB = nullptr;
|
|
|
|
class_Color = nullptr;
|
|
|
|
class_Plane = nullptr;
|
|
|
|
class_StringName = nullptr;
|
|
|
|
class_NodePath = nullptr;
|
|
|
|
class_RID = nullptr;
|
|
|
|
class_GodotObject = nullptr;
|
|
|
|
class_GodotResource = nullptr;
|
|
|
|
class_Node = nullptr;
|
|
|
|
class_Control = nullptr;
|
|
|
|
class_Node3D = nullptr;
|
|
|
|
class_WeakRef = nullptr;
|
|
|
|
class_Callable = nullptr;
|
|
|
|
class_SignalInfo = nullptr;
|
|
|
|
class_Array = nullptr;
|
|
|
|
class_Dictionary = nullptr;
|
|
|
|
class_MarshalUtils = nullptr;
|
|
|
|
class_ISerializationListener = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
2020-04-01 23:20:12 +00:00
|
|
|
class_DebuggingUtils = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
methodthunk_DebuggingUtils_GetStackFrameInfo.nullify();
|
|
|
|
#endif
|
|
|
|
|
2020-04-01 23:20:12 +00:00
|
|
|
class_ExportAttribute = nullptr;
|
|
|
|
field_ExportAttribute_hint = nullptr;
|
|
|
|
field_ExportAttribute_hintString = nullptr;
|
|
|
|
class_SignalAttribute = nullptr;
|
|
|
|
class_ToolAttribute = nullptr;
|
2022-07-07 01:13:41 +00:00
|
|
|
class_RPCAttribute = nullptr;
|
|
|
|
property_RPCAttribute_Mode = nullptr;
|
|
|
|
property_RPCAttribute_CallLocal = nullptr;
|
|
|
|
property_RPCAttribute_TransferMode = nullptr;
|
|
|
|
property_RPCAttribute_TransferChannel = nullptr;
|
2020-04-01 23:20:12 +00:00
|
|
|
class_GodotMethodAttribute = nullptr;
|
|
|
|
field_GodotMethodAttribute_methodName = nullptr;
|
2021-03-05 23:12:42 +00:00
|
|
|
class_ScriptPathAttribute = nullptr;
|
|
|
|
field_ScriptPathAttribute_path = nullptr;
|
|
|
|
class_AssemblyHasScriptsAttribute = nullptr;
|
|
|
|
field_AssemblyHasScriptsAttribute_requiresLookup = nullptr;
|
|
|
|
field_AssemblyHasScriptsAttribute_scriptTypes = nullptr;
|
2020-04-01 23:20:12 +00:00
|
|
|
|
|
|
|
field_GodotObject_ptr = nullptr;
|
|
|
|
field_StringName_ptr = nullptr;
|
|
|
|
field_NodePath_ptr = nullptr;
|
|
|
|
field_Image_ptr = nullptr;
|
|
|
|
field_RID_ptr = nullptr;
|
2019-11-10 16:10:38 +00:00
|
|
|
|
|
|
|
methodthunk_GodotObject_Dispose.nullify();
|
|
|
|
methodthunk_Array_GetPtr.nullify();
|
|
|
|
methodthunk_Dictionary_GetPtr.nullify();
|
|
|
|
methodthunk_SignalAwaiter_SignalCallback.nullify();
|
|
|
|
methodthunk_GodotTaskScheduler_Activate.nullify();
|
|
|
|
|
2020-03-14 18:20:17 +00:00
|
|
|
methodthunk_Delegate_Equals.nullify();
|
|
|
|
|
|
|
|
methodthunk_DelegateUtils_TrySerializeDelegate.nullify();
|
|
|
|
methodthunk_DelegateUtils_TryDeserializeDelegate.nullify();
|
|
|
|
|
2019-11-10 16:10:38 +00:00
|
|
|
// Start of MarshalUtils methods
|
|
|
|
|
|
|
|
methodthunk_MarshalUtils_TypeIsGenericArray.nullify();
|
|
|
|
methodthunk_MarshalUtils_TypeIsGenericDictionary.nullify();
|
2020-04-23 00:19:32 +00:00
|
|
|
methodthunk_MarshalUtils_TypeIsSystemGenericList.nullify();
|
|
|
|
methodthunk_MarshalUtils_TypeIsSystemGenericDictionary.nullify();
|
|
|
|
methodthunk_MarshalUtils_TypeIsGenericIEnumerable.nullify();
|
|
|
|
methodthunk_MarshalUtils_TypeIsGenericICollection.nullify();
|
|
|
|
methodthunk_MarshalUtils_TypeIsGenericIDictionary.nullify();
|
2022-03-06 17:04:29 +00:00
|
|
|
methodthunk_MarshalUtils_TypeHasFlagsAttribute.nullify();
|
2019-11-10 16:10:38 +00:00
|
|
|
|
2021-12-02 19:05:05 +00:00
|
|
|
methodthunk_MarshalUtils_GetGenericTypeDefinition.nullify();
|
|
|
|
|
2019-11-10 16:10:38 +00:00
|
|
|
methodthunk_MarshalUtils_ArrayGetElementType.nullify();
|
|
|
|
methodthunk_MarshalUtils_DictionaryGetKeyValueTypes.nullify();
|
|
|
|
|
|
|
|
methodthunk_MarshalUtils_MakeGenericArrayType.nullify();
|
|
|
|
methodthunk_MarshalUtils_MakeGenericDictionaryType.nullify();
|
|
|
|
|
|
|
|
// End of MarshalUtils methods
|
|
|
|
|
2019-12-11 16:08:40 +00:00
|
|
|
task_scheduler_handle = Ref<MonoGCHandleRef>();
|
2019-11-10 16:10:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
|
|
|
|
#define GODOT_API_NS_CLASS(m_ns, m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(m_ns, #m_class))
|
|
|
|
|
|
|
|
void update_corlib_cache() {
|
|
|
|
CACHE_CLASS_AND_CHECK(MonoObject, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_object_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(bool, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_boolean_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(int8_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_sbyte_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(int16_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_int16_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(int32_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_int32_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(int64_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_int64_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(uint8_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_byte_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(uint16_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_uint16_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(uint32_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_uint32_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(uint64_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_uint64_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(float, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_single_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(double, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_double_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(String, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_string_class()));
|
|
|
|
CACHE_CLASS_AND_CHECK(IntPtr, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_intptr_class()));
|
|
|
|
|
|
|
|
CACHE_CLASS_AND_CHECK(System_Collections_IEnumerable, GDMono::get_singleton()->get_corlib_assembly()->get_class("System.Collections", "IEnumerable"));
|
2020-04-23 00:19:32 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(System_Collections_ICollection, GDMono::get_singleton()->get_corlib_assembly()->get_class("System.Collections", "ICollection"));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(System_Collections_IDictionary, GDMono::get_singleton()->get_corlib_assembly()->get_class("System.Collections", "IDictionary"));
|
|
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
|
CACHE_CLASS_AND_CHECK(System_Diagnostics_StackTrace, GDMono::get_singleton()->get_corlib_assembly()->get_class("System.Diagnostics", "StackTrace"));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(System_Diagnostics_StackTrace, GetFrames, CACHED_CLASS(System_Diagnostics_StackTrace)->get_method("GetFrames"));
|
|
|
|
CACHE_METHOD_AND_CHECK(System_Diagnostics_StackTrace, ctor_bool, CACHED_CLASS(System_Diagnostics_StackTrace)->get_method_with_desc("System.Diagnostics.StackTrace:.ctor(bool)", true));
|
|
|
|
CACHE_METHOD_AND_CHECK(System_Diagnostics_StackTrace, ctor_Exception_bool, CACHED_CLASS(System_Diagnostics_StackTrace)->get_method_with_desc("System.Diagnostics.StackTrace:.ctor(System.Exception,bool)", true));
|
|
|
|
#endif
|
|
|
|
|
2020-07-05 17:19:36 +00:00
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(Delegate, Equals, GDMono::get_singleton()->get_corlib_assembly()->get_class("System", "Delegate")->get_method_with_desc("System.Delegate:Equals(object)", true));
|
2020-03-14 18:20:17 +00:00
|
|
|
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(KeyNotFoundException, GDMono::get_singleton()->get_corlib_assembly()->get_class("System.Collections.Generic", "KeyNotFoundException"));
|
|
|
|
|
|
|
|
cached_data.corlib_cache_updated = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void update_godot_api_cache() {
|
|
|
|
CACHE_CLASS_AND_CHECK(Vector2, GODOT_API_CLASS(Vector2));
|
2020-03-03 09:42:20 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Vector2i, GODOT_API_CLASS(Vector2i));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Rect2, GODOT_API_CLASS(Rect2));
|
2020-03-03 09:42:20 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Rect2i, GODOT_API_CLASS(Rect2i));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Transform2D, GODOT_API_CLASS(Transform2D));
|
|
|
|
CACHE_CLASS_AND_CHECK(Vector3, GODOT_API_CLASS(Vector3));
|
2020-03-03 09:42:20 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Vector3i, GODOT_API_CLASS(Vector3i));
|
Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-19 23:11:13 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Vector4, GODOT_API_CLASS(Vector4));
|
|
|
|
CACHE_CLASS_AND_CHECK(Vector4i, GODOT_API_CLASS(Vector4i));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
|
2021-01-20 07:02:02 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Quaternion, GODOT_API_CLASS(Quaternion));
|
2020-10-17 05:08:21 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Transform3D, GODOT_API_CLASS(Transform3D));
|
Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-19 23:11:13 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Projection, GODOT_API_CLASS(Projection));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
|
|
|
|
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
|
|
|
|
CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane));
|
2020-03-14 18:20:17 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(StringName, GODOT_API_CLASS(StringName));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath));
|
|
|
|
CACHE_CLASS_AND_CHECK(RID, GODOT_API_CLASS(RID));
|
|
|
|
CACHE_CLASS_AND_CHECK(GodotObject, GODOT_API_CLASS(Object));
|
|
|
|
CACHE_CLASS_AND_CHECK(GodotResource, GODOT_API_CLASS(Resource));
|
|
|
|
CACHE_CLASS_AND_CHECK(Node, GODOT_API_CLASS(Node));
|
|
|
|
CACHE_CLASS_AND_CHECK(Control, GODOT_API_CLASS(Control));
|
2020-04-02 23:38:48 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Node3D, GODOT_API_CLASS(Node3D));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(WeakRef, GODOT_API_CLASS(WeakRef));
|
2020-03-14 18:20:17 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Callable, GODOT_API_CLASS(Callable));
|
|
|
|
CACHE_CLASS_AND_CHECK(SignalInfo, GODOT_API_CLASS(SignalInfo));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(Array, GODOT_API_NS_CLASS(BINDINGS_NAMESPACE_COLLECTIONS, Array));
|
|
|
|
CACHE_CLASS_AND_CHECK(Dictionary, GODOT_API_NS_CLASS(BINDINGS_NAMESPACE_COLLECTIONS, Dictionary));
|
|
|
|
CACHE_CLASS_AND_CHECK(MarshalUtils, GODOT_API_CLASS(MarshalUtils));
|
|
|
|
CACHE_CLASS_AND_CHECK(ISerializationListener, GODOT_API_CLASS(ISerializationListener));
|
|
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
|
CACHE_CLASS_AND_CHECK(DebuggingUtils, GODOT_API_CLASS(DebuggingUtils));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Attributes
|
|
|
|
CACHE_CLASS_AND_CHECK(ExportAttribute, GODOT_API_CLASS(ExportAttribute));
|
|
|
|
CACHE_FIELD_AND_CHECK(ExportAttribute, hint, CACHED_CLASS(ExportAttribute)->get_field("hint"));
|
|
|
|
CACHE_FIELD_AND_CHECK(ExportAttribute, hintString, CACHED_CLASS(ExportAttribute)->get_field("hintString"));
|
|
|
|
CACHE_CLASS_AND_CHECK(SignalAttribute, GODOT_API_CLASS(SignalAttribute));
|
|
|
|
CACHE_CLASS_AND_CHECK(ToolAttribute, GODOT_API_CLASS(ToolAttribute));
|
2022-07-07 01:13:41 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(RPCAttribute, GODOT_API_CLASS(RPCAttribute));
|
|
|
|
CACHE_PROPERTY_AND_CHECK(RPCAttribute, Mode, CACHED_CLASS(RPCAttribute)->get_property("Mode"));
|
|
|
|
CACHE_PROPERTY_AND_CHECK(RPCAttribute, CallLocal, CACHED_CLASS(RPCAttribute)->get_property("CallLocal"));
|
|
|
|
CACHE_PROPERTY_AND_CHECK(RPCAttribute, TransferMode, CACHED_CLASS(RPCAttribute)->get_property("TransferMode"));
|
|
|
|
CACHE_PROPERTY_AND_CHECK(RPCAttribute, TransferChannel, CACHED_CLASS(RPCAttribute)->get_property("TransferChannel"));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(GodotMethodAttribute, GODOT_API_CLASS(GodotMethodAttribute));
|
|
|
|
CACHE_FIELD_AND_CHECK(GodotMethodAttribute, methodName, CACHED_CLASS(GodotMethodAttribute)->get_field("methodName"));
|
2021-03-05 23:12:42 +00:00
|
|
|
CACHE_CLASS_AND_CHECK(ScriptPathAttribute, GODOT_API_CLASS(ScriptPathAttribute));
|
|
|
|
CACHE_FIELD_AND_CHECK(ScriptPathAttribute, path, CACHED_CLASS(ScriptPathAttribute)->get_field("path"));
|
|
|
|
CACHE_CLASS_AND_CHECK(AssemblyHasScriptsAttribute, GODOT_API_CLASS(AssemblyHasScriptsAttribute));
|
|
|
|
CACHE_FIELD_AND_CHECK(AssemblyHasScriptsAttribute, requiresLookup, CACHED_CLASS(AssemblyHasScriptsAttribute)->get_field("requiresLookup"));
|
|
|
|
CACHE_FIELD_AND_CHECK(AssemblyHasScriptsAttribute, scriptTypes, CACHED_CLASS(AssemblyHasScriptsAttribute)->get_field("scriptTypes"));
|
2019-11-10 16:10:38 +00:00
|
|
|
|
|
|
|
CACHE_FIELD_AND_CHECK(GodotObject, ptr, CACHED_CLASS(GodotObject)->get_field(BINDINGS_PTR_FIELD));
|
2020-03-14 18:20:17 +00:00
|
|
|
CACHE_FIELD_AND_CHECK(StringName, ptr, CACHED_CLASS(StringName)->get_field(BINDINGS_PTR_FIELD));
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_FIELD_AND_CHECK(NodePath, ptr, CACHED_CLASS(NodePath)->get_field(BINDINGS_PTR_FIELD));
|
|
|
|
CACHE_FIELD_AND_CHECK(RID, ptr, CACHED_CLASS(RID)->get_field(BINDINGS_PTR_FIELD));
|
|
|
|
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(GodotObject, Dispose, CACHED_CLASS(GodotObject)->get_method("Dispose", 0));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(Array, GetPtr, GODOT_API_NS_CLASS(BINDINGS_NAMESPACE_COLLECTIONS, Array)->get_method("GetPtr", 0));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(Dictionary, GetPtr, GODOT_API_NS_CLASS(BINDINGS_NAMESPACE_COLLECTIONS, Dictionary)->get_method("GetPtr", 0));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(SignalAwaiter, SignalCallback, GODOT_API_CLASS(SignalAwaiter)->get_method("SignalCallback", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(GodotTaskScheduler, Activate, GODOT_API_CLASS(GodotTaskScheduler)->get_method("Activate", 0));
|
|
|
|
|
2020-03-14 18:20:17 +00:00
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(DelegateUtils, TrySerializeDelegate, GODOT_API_CLASS(DelegateUtils)->get_method("TrySerializeDelegate", 2));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(DelegateUtils, TryDeserializeDelegate, GODOT_API_CLASS(DelegateUtils)->get_method("TryDeserializeDelegate", 2));
|
|
|
|
|
2019-11-10 16:10:38 +00:00
|
|
|
// Start of MarshalUtils methods
|
|
|
|
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericArray, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericArray", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericDictionary, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericDictionary", 1));
|
2020-04-23 00:19:32 +00:00
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsSystemGenericList, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsSystemGenericList", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsSystemGenericDictionary, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsSystemGenericDictionary", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericIEnumerable, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericIEnumerable", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericICollection, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericICollection", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericIDictionary, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericIDictionary", 1));
|
2022-03-06 17:04:29 +00:00
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeHasFlagsAttribute, GODOT_API_CLASS(MarshalUtils)->get_method("TypeHasFlagsAttribute", 1));
|
2019-11-10 16:10:38 +00:00
|
|
|
|
2021-12-02 19:05:05 +00:00
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GetGenericTypeDefinition, GODOT_API_CLASS(MarshalUtils)->get_method("GetGenericTypeDefinition", 2));
|
|
|
|
|
2019-11-10 16:10:38 +00:00
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, ArrayGetElementType, GODOT_API_CLASS(MarshalUtils)->get_method("ArrayGetElementType", 2));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, DictionaryGetKeyValueTypes, GODOT_API_CLASS(MarshalUtils)->get_method("DictionaryGetKeyValueTypes", 3));
|
|
|
|
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, MakeGenericArrayType, GODOT_API_CLASS(MarshalUtils)->get_method("MakeGenericArrayType", 1));
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, MakeGenericDictionaryType, GODOT_API_CLASS(MarshalUtils)->get_method("MakeGenericDictionaryType", 2));
|
|
|
|
|
|
|
|
// End of MarshalUtils methods
|
|
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
|
CACHE_METHOD_THUNK_AND_CHECK(DebuggingUtils, GetStackFrameInfo, GODOT_API_CLASS(DebuggingUtils)->get_method("GetStackFrameInfo", 4));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// TODO Move to CSharpLanguage::init() and do handle disposal
|
|
|
|
MonoObject *task_scheduler = mono_object_new(mono_domain_get(), GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr());
|
|
|
|
GDMonoUtils::runtime_object_init(task_scheduler, GODOT_API_CLASS(GodotTaskScheduler));
|
2019-12-11 16:08:40 +00:00
|
|
|
cached_data.task_scheduler_handle = MonoGCHandleRef::create_strong(task_scheduler);
|
2019-11-10 16:10:38 +00:00
|
|
|
|
|
|
|
cached_data.godot_api_cache_updated = true;
|
|
|
|
}
|
|
|
|
} // namespace GDMonoCache
|