Skip to content

Commit 80fcb05

Browse files
qiuguohuaqiuguohua
andauthored
Integrating Game Controllers with HarmonyOS Next (#19060)
* Integrating Game Controllers with HarmonyOS Next * update HarmonyOS Next ci * Fix JSON formatting errors * update HarmonyOS Next ci * update HarmonyOS Next ci * Fix incorrect file casing * Filter system for non-gamepad events --------- Co-authored-by: qiuguohua <guohua.qiu@cocos.com>
1 parent 0726f9b commit 80fcb05

11 files changed

Lines changed: 535 additions & 100 deletions

File tree

.github/workflows/generate-oh-sdk-cache.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
id: cache-oh-sdk
2323
uses: actions/cache@v4
2424
env:
25-
cache-name: cache-oh-sdk-15
25+
cache-name: cache-oh-sdk-21
2626
with:
2727
path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}
2828
key: ${{ runner.os }}-build-${{ env.cache-name }}
@@ -33,11 +33,11 @@ jobs:
3333
run: |
3434
if [ ! -d "$HOME/openharmony" ]; then
3535
mkdir -p $HOME/openharmony
36-
echo "Download commandline-tools-linux-x64-5.0.13.200.zip ..."
37-
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-15/commandline-tools-linux-x64-5.0.13.200.zip.001
38-
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-15/commandline-tools-linux-x64-5.0.13.200.zip.002
39-
echo "Unzip commandline-tools-linux-x64-5.0.13.200.zip ..."
40-
7z x commandline-tools-linux-x64-5.0.13.200.zip.001 -o$HOME/openharmony > /dev/null
36+
echo "Download commandline-tools-linux-x64-6.0.1.246.zip ..."
37+
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-21/commandline-tools-linux-x64-6.0.1.246.zip.001
38+
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-21/commandline-tools-linux-x64-6.0.1.246.zip.002
39+
echo "Unzip commandline-tools-linux-x64-6.0.1.246.zip ..."
40+
7z x commandline-tools-linux-x64-6.0.1.246.zip.001 -o$HOME/openharmony > /dev/null
4141
cd $HOME/openharmony
4242
ls -l
4343
cd command-line-tools

.github/workflows/native-compile-platforms.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ jobs:
329329
id: cache-oh-sdk
330330
uses: actions/cache@v4
331331
env:
332-
cache-name: cache-oh-sdk-13
332+
cache-name: cache-oh-sdk-21
333333
with:
334334
path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}
335335
key: ${{ runner.os }}-build-${{ env.cache-name }}
@@ -348,11 +348,11 @@ jobs:
348348
run: |
349349
if [ ! -d "$HOME/openharmony" ]; then
350350
mkdir -p $HOME/openharmony
351-
echo "Download commandline-tools-linux-x64-5.0.13.200.zip ..."
352-
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-15/commandline-tools-linux-x64-5.0.13.200.zip.001
353-
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-15/commandline-tools-linux-x64-5.0.13.200.zip.002
354-
echo "Unzip commandline-tools-linux-x64-5.0.13.200.zip ..."
355-
7z x commandline-tools-linux-x64-5.0.13.200.zip.001 -o$HOME/openharmony > /dev/null
351+
echo "Download commandline-tools-linux-x64-6.0.1.246.zip ..."
352+
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-21/commandline-tools-linux-x64-6.0.1.246.zip.001
353+
wget -q https://github.com/cocos/oh-sdk-for-ci/releases/download/api-21/commandline-tools-linux-x64-6.0.1.246.zip.002
354+
echo "Unzip commandline-tools-linux-x64-6.0.1.246.zip ..."
355+
7z x commandline-tools-linux-x64-6.0.1.246.zip.001 -o$HOME/openharmony > /dev/null
356356
cd $HOME/openharmony
357357
ls -l
358358
cd command-line-tools

native/CMakeLists.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,15 @@ NO_WERROR cocos/audio/common/utils/primitives.cpp
368368
cocos/audio/android/utils/Utils.cpp
369369
cocos/audio/android/utils/Utils.h
370370
)
371-
if(ANDROID)
371+
if(ANDROID)
372372
cocos_source_files(
373373
cocos/audio/android/PcmAudioService.cpp
374374
cocos/audio/android/PcmAudioService.h
375375
cocos/audio/android/UrlAudioPlayer.cpp
376376
cocos/audio/android/UrlAudioPlayer.h
377377
)
378378
elseif(OPENHARMONY)
379-
cocos_source_files(
379+
cocos_source_files(
380380
cocos/audio/openharmony/PcmAudioService.cpp
381381
cocos/audio/openharmony/PcmAudioService.h
382382
cocos/audio/openharmony/UrlAudioPlayer.cpp
@@ -589,6 +589,8 @@ elseif(OPENHARMONY)
589589
cocos/platform/openharmony/WorkerMessageQueue.h
590590
cocos/platform/openharmony/OpenHarmonyPlatform.cpp
591591
cocos/platform/openharmony/OpenHarmonyPlatform.h
592+
cocos/platform/openharmony/OpenHarmonyGamepad.cpp
593+
cocos/platform/openharmony/OpenHarmonyGamepad.h
592594
)
593595
elseif(OHOS)
594596
cocos_source_files(
@@ -611,7 +613,7 @@ elseif(IOS)
611613
)
612614
endif()
613615

614-
if(USE_ADPF)
616+
if(USE_ADPF)
615617
cocos_source_files(
616618
cocos/platform/android/adpf_manager.h
617619
cocos/platform/android/adpf_manager.cpp
@@ -801,7 +803,7 @@ if(USE_GOOGLE_BILLING)
801803
vendor/google/billing/build-params/PendingPurchasesParams.h
802804
vendor/google/billing/build-params/QueryProductDetailsParams.h
803805
vendor/google/billing/build-params/QueryPurchasesParams.h
804-
806+
805807
vendor/google/billing/result-values/AccountIdentifiers.h
806808
vendor/google/billing/result-values/AlternativeBillingOnlyReportingDetails.h
807809
vendor/google/billing/result-values/BillingConfig.h
@@ -1140,7 +1142,7 @@ set(SWIG_OUTPUT_ROOT ${CMAKE_CURRENT_BINARY_DIR}/generated)
11401142
set(SWIG_OUTPUT ${SWIG_OUTPUT_ROOT}/cocos/bindings/auto)
11411143
cc_gen_swig_files(${CMAKE_CURRENT_LIST_DIR}/tools/swig-config ${SWIG_OUTPUT})
11421144

1143-
if(USE_GOOGLE_BILLING)
1145+
if(USE_GOOGLE_BILLING)
11441146
cc_gen_swig_files(${CMAKE_CURRENT_LIST_DIR}/tools/swig-config/android/google/billing ${SWIG_OUTPUT})
11451147
endif()
11461148

@@ -3040,7 +3042,7 @@ if(USE_SE_JSVM)
30403042

30413043
if (NOT OPENHARMONY)
30423044
include_directories(${CWD}/cocos/bindings/jswrapper/jsvm-v8-backend)
3043-
cocos_source_files(MODULE ccbindings
3045+
cocos_source_files(MODULE ccbindings
30443046
cocos/bindings/jswrapper/jsvm-v8-backend/js_native_api_v8.cc
30453047
cocos/bindings/jswrapper/jsvm-v8-backend/js_native_api_v8.h
30463048
cocos/bindings/jswrapper/jsvm-v8-backend/js_native_api_v8_internals.h
@@ -3441,7 +3443,7 @@ function(cc_apply_definations target)
34413443
$<IF:$<BOOL:${USE_GOOGLE_BILLING}>,CC_USE_GOOGLE_BILLING=1,CC_USE_GOOGLE_BILLING=0>
34423444
$<IF:$<BOOL:${USE_GOOGLE_PLAY_GAMES}>,CC_USE_GOOGLE_PLAY_GAMES=1,CC_USE_GOOGLE_PLAY_GAMES=0>
34433445
$<IF:$<BOOL:${USE_BOX2D_JSB}>,CC_USE_BOX2D_JSB=1,CC_USE_BOX2D_JSB=0>
3444-
3446+
34453447
)
34463448
endfunction()
34473449

@@ -3634,7 +3636,7 @@ if(OPENHARMONY)
36343636

36353637
find_library( hilog-lib
36363638
hilog_ndk.z )
3637-
3639+
36383640
find_library( # Sets the name of the path variable.
36393641
libace-lib
36403642
# Specifies the name of the NDK library that
@@ -3671,9 +3673,10 @@ if(OPENHARMONY)
36713673
libnative_window.so
36723674
libnative_buffer.so
36733675
libbundle_ndk.z.so
3674-
libace_napi.z.so
3675-
libace_ndk.z.so
3676-
libz.so
3676+
libace_napi.z.so
3677+
libace_ndk.z.so
3678+
libohgame_controller.z.so
3679+
libz.so
36773680
librawfile.z.so
36783681
libohsensor.so
36793682
${CC_EXTERNAL_LIBS}
@@ -3768,7 +3771,7 @@ set(COCOS_SOURCE_LIST_EXCLUDE_GENRATED ${COCOS_SOURCE_LIST})
37683771
set(COCOS_GENERATED_LIST)
37693772
foreach(src IN LISTS COCOS_SOURCE_LIST_EXCLUDE_GENRATED)
37703773
get_source_file_property(IS_GENERATED ${src} GENERATED)
3771-
if(IS_GENERATED)
3774+
if(IS_GENERATED)
37723775
list(REMOVE_ITEM COCOS_SOURCE_LIST_EXCLUDE_GENRATED ${src})
37733776
list(APPEND COCOS_GENERATED_LIST ${src})
37743777
endif()

0 commit comments

Comments
 (0)