feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -32,6 +32,7 @@
#define JAVA_CLASS_WRAPPER_H
#include "core/object/ref_counted.h"
#include "core/variant/typed_array.h"
#ifdef ANDROID_ENABLED
#include <android/log.h>
@ -46,7 +47,7 @@ class JavaClass : public RefCounted {
GDCLASS(JavaClass, RefCounted);
#ifdef ANDROID_ENABLED
enum ArgumentType{
enum ArgumentType {
ARG_TYPE_VOID,
ARG_TYPE_BOOLEAN,
ARG_TYPE_BYTE,
@ -57,6 +58,8 @@ class JavaClass : public RefCounted {
ARG_TYPE_FLOAT,
ARG_TYPE_DOUBLE,
ARG_TYPE_STRING, //special case
ARG_TYPE_CHARSEQUENCE,
ARG_TYPE_CALLABLE,
ARG_TYPE_CLASS,
ARG_ARRAY_BIT = 1 << 16,
ARG_NUMBER_CLASS_BIT = 1 << 17,
@ -67,6 +70,7 @@ class JavaClass : public RefCounted {
struct MethodInfo {
bool _static = false;
bool _constructor = false;
Vector<uint32_t> param_types;
Vector<StringName> param_sigs;
uint32_t return_type = 0;
@ -121,8 +125,12 @@ class JavaClass : public RefCounted {
likelihood = 0.5;
break;
case ARG_TYPE_STRING:
case ARG_TYPE_CHARSEQUENCE:
r_type = Variant::STRING;
break;
case ARG_TYPE_CALLABLE:
r_type = Variant::CALLABLE;
break;
case ARG_TYPE_CLASS:
r_type = Variant::OBJECT;
break;
@ -161,9 +169,11 @@ class JavaClass : public RefCounted {
likelihood = 0.5;
break;
case ARG_ARRAY_BIT | ARG_TYPE_STRING:
case ARG_ARRAY_BIT | ARG_TYPE_CHARSEQUENCE:
r_type = Variant::PACKED_STRING_ARRAY;
break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS:
case ARG_ARRAY_BIT | ARG_TYPE_CALLABLE:
r_type = Variant::ARRAY;
break;
}
@ -174,14 +184,30 @@ class JavaClass : public RefCounted {
bool _call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret);
friend class JavaClassWrapper;
friend class JavaObject;
String java_class_name;
String java_constructor_name;
HashMap<StringName, List<MethodInfo>> methods;
jclass _class;
#endif
protected:
static void _bind_methods();
bool _get(const StringName &p_name, Variant &r_ret) const;
public:
virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override;
String get_java_class_name() const;
TypedArray<Dictionary> get_java_method_list() const;
Ref<JavaClass> get_java_parent_class() const;
#ifdef ANDROID_ENABLED
virtual String to_string() override;
#endif
JavaClass();
~JavaClass();
};
class JavaObject : public RefCounted {
@ -191,14 +217,24 @@ class JavaObject : public RefCounted {
Ref<JavaClass> base_class;
friend class JavaClass;
jobject instance;
jobject instance = nullptr;
#endif
protected:
static void _bind_methods();
public:
virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override;
Ref<JavaClass> get_java_class() const;
#ifdef ANDROID_ENABLED
JavaObject(const Ref<JavaClass> &p_base, jobject *p_instance);
virtual String to_string() override;
jobject get_instance() { return instance; }
JavaObject();
JavaObject(const Ref<JavaClass> &p_base, jobject p_instance);
~JavaObject();
#endif
};
@ -209,13 +245,17 @@ class JavaClassWrapper : public Object {
#ifdef ANDROID_ENABLED
RBMap<String, Ref<JavaClass>> class_cache;
friend class JavaClass;
jmethodID getDeclaredMethods;
jmethodID getFields;
jmethodID getParameterTypes;
jmethodID getReturnType;
jmethodID getModifiers;
jmethodID getName;
jmethodID Class_getDeclaredConstructors;
jmethodID Class_getDeclaredMethods;
jmethodID Class_getFields;
jmethodID Class_getName;
jmethodID Class_getSuperclass;
jmethodID Constructor_getParameterTypes;
jmethodID Constructor_getModifiers;
jmethodID Method_getParameterTypes;
jmethodID Method_getReturnType;
jmethodID Method_getModifiers;
jmethodID Method_getName;
jmethodID Field_getName;
jmethodID Field_getModifiers;
jmethodID Field_get;
@ -231,6 +271,10 @@ class JavaClassWrapper : public Object {
bool _get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, String &strsig);
#endif
Ref<JavaObject> exception;
Ref<JavaClass> _wrap(const String &p_class, bool p_allow_private_methods_access);
static JavaClassWrapper *singleton;
protected:
@ -239,13 +283,18 @@ protected:
public:
static JavaClassWrapper *get_singleton() { return singleton; }
Ref<JavaClass> wrap(const String &p_class);
Ref<JavaClass> wrap(const String &p_class) {
return _wrap(p_class, false);
}
Ref<JavaObject> get_exception() {
return exception;
}
#ifdef ANDROID_ENABLED
JavaClassWrapper(jobject p_activity = nullptr);
#else
JavaClassWrapper();
Ref<JavaClass> wrap_jclass(jclass p_class, bool p_allow_private_methods_access = false);
#endif
JavaClassWrapper();
};
#endif // JAVA_CLASS_WRAPPER_H