Skip to content

Commit

Permalink
[unity]update p-api
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Oct 16, 2024
1 parent c8b7c26 commit 924bf69
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ handle_underlying:
{
if (IsDelegate(klass))
{
JsClassInfoHeader* jsClassInfo = (JsClassInfoHeader*)pesapi_load_class_data(klass, true);
JsClassInfoHeader* jsClassInfo = (JsClassInfoHeader*)pesapi_get_class_data(klass, true);
if (!jsClassInfo)
{
Exception::Raise(Exception::GetInvalidOperationException("call not load type of delegate"));
Expand Down Expand Up @@ -2151,7 +2151,7 @@ void SetTypeInfo(puerts::WrapData* data, int index, Il2CppClass* typeInfo)

bool RegisterCSharpType(puerts::JsClassInfo* classInfo)
{
if (pesapi_load_class_data(classInfo->TypeId, false))
if (pesapi_get_class_data(classInfo->TypeId, false))
{
ReleaseCSharpTypeInfo(classInfo);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ PESAPI_EXTERN void pesapi_define_class(const void* type_id, const void* super_ty
pesapi_constructor constructor, pesapi_finalize finalize, size_t property_count, pesapi_property_descriptor properties,
void* data);

PESAPI_EXTERN void* pesapi_load_class_data(const void* type_id, bool callback_if_not_found);
PESAPI_EXTERN void* pesapi_get_class_data(const void* type_id, bool force_load);

PESAPI_EXTERN void pesapi_on_class_not_found(pesapi_class_not_found_callback callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ void pesapi_define_class (const void* type_id, const void* super_type_id, const
pesapi_define_class_ptr(type_id, super_type_id, type_name, constructor, finalize, property_count, properties, data);
}

typedef void* (*pesapi_load_class_dataType)(const void* type_id, bool callback_if_not_found);
static pesapi_load_class_dataType pesapi_load_class_data_ptr;
void* pesapi_load_class_data (const void* type_id, bool callback_if_not_found) {
return pesapi_load_class_data_ptr(type_id, callback_if_not_found);
typedef void* (*pesapi_get_class_dataType)(const void* type_id, bool force_load);
static pesapi_get_class_dataType pesapi_get_class_data_ptr;
void* pesapi_get_class_data (const void* type_id, bool force_load) {
return pesapi_get_class_data_ptr(type_id, force_load);
}

typedef void (*pesapi_on_class_not_foundType)(pesapi_class_not_found_callback callback);
Expand Down Expand Up @@ -661,7 +661,7 @@ void pesapi_init(pesapi_func_ptr* func_array){
pesapi_set_method_info_ptr = (pesapi_set_method_infoType)func_array[85];
pesapi_set_property_info_ptr = (pesapi_set_property_infoType)func_array[86];
pesapi_define_class_ptr = (pesapi_define_classType)func_array[87];
pesapi_load_class_data_ptr = (pesapi_load_class_dataType)func_array[88];
pesapi_get_class_data_ptr = (pesapi_get_class_dataType)func_array[88];
pesapi_on_class_not_found_ptr = (pesapi_on_class_not_foundType)func_array[89];
pesapi_class_type_info_ptr = (pesapi_class_type_infoType)func_array[90];
pesapi_find_type_id_ptr = (pesapi_find_type_idType)func_array[91];
Expand Down
2 changes: 1 addition & 1 deletion unity/native_src_il2cpp/Inc/pesapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ PESAPI_EXTERN void pesapi_define_class(const void* type_id, const void* super_ty
pesapi_constructor constructor, pesapi_finalize finalize, size_t property_count, pesapi_property_descriptor properties,
void* data);

PESAPI_EXTERN void* pesapi_load_class_data(const void* type_id, bool callback_if_not_found);
PESAPI_EXTERN void* pesapi_get_class_data(const void* type_id, bool force_load);

PESAPI_EXTERN void pesapi_on_class_not_found(pesapi_class_not_found_callback callback);

Expand Down
2 changes: 1 addition & 1 deletion unity/native_src_il2cpp/Src/PesapiAddonLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static pesapi_func_ptr funcs[] = {(pesapi_func_ptr) &pesapi_create_null, (pesapi
(pesapi_func_ptr) &pesapi_alloc_type_infos, (pesapi_func_ptr) &pesapi_set_type_info,
(pesapi_func_ptr) &pesapi_create_signature_info, (pesapi_func_ptr) &pesapi_alloc_property_descriptors,
(pesapi_func_ptr) &pesapi_set_method_info, (pesapi_func_ptr) &pesapi_set_property_info, (pesapi_func_ptr) &pesapi_define_class,
(pesapi_func_ptr) &pesapi_load_class_data, (pesapi_func_ptr) &pesapi_on_class_not_found,
(pesapi_func_ptr) &pesapi_get_class_data, (pesapi_func_ptr) &pesapi_on_class_not_found,
(pesapi_func_ptr) &pesapi_class_type_info, (pesapi_func_ptr) &pesapi_find_type_id};
MSVC_PRAGMA(warning(pop))

Expand Down
4 changes: 2 additions & 2 deletions unity/native_src_il2cpp/Src/PesapiV8Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,9 @@ void pesapi_define_class(const void* type_id, const void* super_type_id, const c
}
MSVC_PRAGMA(warning(pop))

void* pesapi_load_class_data(const void* type_id, bool callback_if_not_found)
void* pesapi_get_class_data(const void* type_id, bool force_load)
{
auto clsDef = callback_if_not_found ? puerts::LoadClassByID(type_id) : puerts::FindClassByID(type_id);
auto clsDef = force_load ? puerts::LoadClassByID(type_id) : puerts::FindClassByID(type_id);
return clsDef ? clsDef->Data : nullptr;
}

Expand Down

0 comments on commit 924bf69

Please sign in to comment.