Skip to content

3.7 version OHOS adaptation #20828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ int register_all_cocos2dx_audioengine(lua_State* tolua_S);


#endif // __cocos2dx_audioengine_h__
#endif //#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#endif //#if CC_TARGET_PLATFORM == CC_PLATFORM_OHOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ int register_ui_moudle(lua_State* L)
{
register_all_cocos2dx_ui(L);
register_all_cocos2dx_ui_manual(L);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_OHOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
register_all_cocos2dx_experimental_video(L);
register_all_cocos2dx_experimental_video_manual(L);
register_all_cocos2dx_experimental_webview(L);
Expand Down
8 changes: 5 additions & 3 deletions tests/lua-tests/project/Classes/AppDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ bool AppDelegate::applicationDidFinishLaunching()
}
lua_pop(L, 1);


FileUtils::getInstance()->addSearchPath("");
pEngine->executeScriptFile("controller.lua");
#if (CC_TARGET_PLATFORM == CC_PLATFORM_OHOS)
pEngine->executeScriptFile("controller.lua");
#else
pEngine->executeScriptFile("src/controller.lua");
#endif
return true;
}

Expand Down
12 changes: 10 additions & 2 deletions tests/lua-tests/src/controller.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@

local currPlatform = cc.Application:getInstance():getTargetPlatform()
cc.PLATFORM_OS_OHOS=12
if (cc.PLATFORM_OS_OHOS == currPlatform) then
local jit = require("jit")
jit.off()
print("jit.off()")
end
-- avoid memory leak
collectgarbage("setpause", 100)
collectgarbage("setstepmul", 5000)

----------------
-- run
--cc.FileUtils:getInstance():addSearchPath("src")
if (cc.PLATFORM_OS_OHOS ~= currPlatform) then
cc.FileUtils:getInstance():addSearchPath("src")
end
CC_USE_DEPRECATED_API = true
require "cocos.init"

Expand Down
13 changes: 4 additions & 9 deletions tests/lua-tests/src/mainMenu.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
local currPlatform = cc.Application:getInstance():getTargetPlatform()

-- ohos jit off
if (cc.PLATFORM_OS_OHOS == currPlatform) then
local jit = require("jit")
jit.off()
end

require "helper"
require "testResource"
require "VisibleRect"
Expand All @@ -19,7 +11,10 @@ require "AssetsManagerTest/AssetsManagerTest"
require "AssetsManagerExTest/AssetsManagerExTest"
require "BillBoardTest/BillBoardTest"
require "BugsTest/BugsTest"
---require "ByteCodeEncryptTest/ByteCodeEncryptTest"
local currPlatform = cc.Application:getInstance():getTargetPlatform()
if (cc.PLATFORM_OS_OHOS ~= currPlatform) then
require "ByteCodeEncryptTest/ByteCodeEncryptTest"
end
require "Camera3DTest/Camera3DTest"
require "ClickAndMoveTest/ClickAndMoveTest"
require "CocosDenshionTest/CocosDenshionTest"
Expand Down