[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.13 版本

This commit is contained in:
SmallMain
2024-10-16 16:23:25 +08:00
parent 7f956acda7
commit 887d4a96c9
61 changed files with 1313 additions and 981 deletions

View File

@@ -13203,6 +13203,21 @@ static bool js_cocos2dx_spine_SkeletonRenderer_paused(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_paused)
static bool js_cocos2dx_spine_SkeletonRenderer_destroy(se::State& s)
{
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_destroy : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc == 0) {
cobj->destroy();
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_destroy)
static bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(se::State& s)
{
CC_UNUSED bool ok = true;
@@ -14133,6 +14148,7 @@ bool js_register_cocos2dx_spine_SkeletonRenderer(se::Object* obj)
cls->defineFunction("setAttachUtil", _SE(js_cocos2dx_spine_SkeletonRenderer_setAttachUtil));
cls->defineFunction("setOpacityModifyRGB", _SE(js_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB));
cls->defineFunction("paused", _SE(js_cocos2dx_spine_SkeletonRenderer_paused));
cls->defineFunction("destroy", _SE(js_cocos2dx_spine_SkeletonRenderer_destroy));
cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_SkeletonRenderer_setAttachment));
cls->defineFunction("setBonesToSetupPose", _SE(js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose));
cls->defineFunction("onEnable", _SE(js_cocos2dx_spine_SkeletonRenderer_onEnable));
@@ -14600,6 +14616,21 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setEndListener(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEndListener)
static bool js_cocos2dx_spine_SkeletonAnimation_destroy(se::State& s)
{
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_destroy : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc == 0) {
cobj->destroy();
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_destroy)
static bool js_cocos2dx_spine_SkeletonAnimation_getState(se::State& s)
{
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject();
@@ -15284,6 +15315,7 @@ bool js_register_cocos2dx_spine_SkeletonAnimation(se::Object* obj)
cls->defineFunction("setTrackCompleteListenerNative", _SE(js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener));
cls->defineFunction("setAnimationStateData", _SE(js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData));
cls->defineFunction("setEndListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setEndListener));
cls->defineFunction("destroy", _SE(js_cocos2dx_spine_SkeletonAnimation_destroy));
cls->defineFunction("getState", _SE(js_cocos2dx_spine_SkeletonAnimation_getState));
cls->defineFunction("setCompleteListenerNative", _SE(js_cocos2dx_spine_SkeletonAnimation_setCompleteListener));
cls->defineFunction("setTrackDisposeListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setTrackDisposeListener));
@@ -15652,6 +15684,21 @@ static bool js_cocos2dx_spine_SkeletonCacheAnimation_paused(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_paused)
static bool js_cocos2dx_spine_SkeletonCacheAnimation_destroy(se::State& s)
{
spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_destroy : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc == 0) {
cobj->destroy();
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_destroy)
static bool js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment(se::State& s)
{
CC_UNUSED bool ok = true;
@@ -16334,6 +16381,7 @@ bool js_register_cocos2dx_spine_SkeletonCacheAnimation(se::Object* obj)
cls->defineFunction("findAnimation", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation));
cls->defineFunction("setAttachUtil", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachUtil));
cls->defineFunction("paused", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_paused));
cls->defineFunction("destroy", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_destroy));
cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment));
cls->defineFunction("setAnimation", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation));
cls->defineFunction("setBonesToSetupPose", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setBonesToSetupPose));

View File

@@ -923,6 +923,7 @@ SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithUUID);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setAttachUtil);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_paused);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_destroy);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setAttachment);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_onEnable);
@@ -973,6 +974,7 @@ SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setTrackInterruptListener);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEndListener);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_destroy);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_getState);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setCompleteListener);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setTrackDisposeListener);
@@ -1022,6 +1024,7 @@ SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachUtil);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_paused);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_destroy);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setBonesToSetupPose);

View File

@@ -509,10 +509,9 @@ void Object::setPrivateData(void* data){
//issue https://github.com/nodejs/node/issues/23999
auto tmpThis = _objRef.getValue(_env);
//_objRef.deleteRef();
napi_ref result = nullptr;
NODE_API_CALL(status, _env,
napi_wrap(_env, tmpThis, data, weakCallback,
(void*)this /* finalize_hint */, &result));
(void*)this /* finalize_hint */, nullptr));
//_objRef.setWeakref(_env, result);
setProperty("__native_ptr__", se::Value(static_cast<long>(reinterpret_cast<uintptr_t>(data))));
}

View File

@@ -180,13 +180,13 @@ bool jsb_register_all_modules()
se->addRegisterCallback(register_all_video);
#endif
#if USE_WEBVIEW
#if USE_WEB_VIEW
se->addRegisterCallback(register_all_webview);
#endif
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_OPENHARMONY)
#if USE_WEBVIEW
#if USE_WEB_VIEW
se->addRegisterCallback(register_all_webview);
#endif

View File

@@ -379,6 +379,12 @@ void XMLHttpRequest::getHeader(const std::string& header)
// Transform field name to lower case as they are case-insensitive
std::transform(http_field.begin(), http_field.end(), http_field.begin(), ::tolower);
if (CC_TARGET_PLATFORM == CC_PLATFORM_OPENHARMONY && _httpHeader.find(http_field) != _httpHeader.end()) {
_httpHeader[http_field].insert(strlen(_httpHeader[http_field].c_str()) - 1, ",");
_httpHeader[http_field].insert(strlen(_httpHeader[http_field].c_str()) - 1, http_value);
http_value = _httpHeader[http_field];
}
_httpHeader[http_field] = http_value;
}