Skip to content

Commit 85ff9dd

Browse files
authored
Merge pull request #106 from mix-il/sync
fix texture bug, add CJK display and IME
2 parents a343a97 + 5234fa6 commit 85ff9dd

15 files changed

Lines changed: 893 additions & 972 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
with:
1515
submodules: recursive
1616
- name: install dependencies
17-
run: sudo apt update && sudo apt install -y libglfw3-dev catch2 libfreetype-dev libgles-dev nlohmann-json3-dev clang
17+
run: sudo apt update && sudo apt install -y libglfw3-dev libgles-dev libfreetype-dev libutf8proc-dev nlohmann-json3-dev catch2 clang
1818
- name: compile terminal
19-
run: cd entry/src/main/cpp && clang++ terminal.cpp -I/usr/include/freetype2 -DSTANDALONE -lfreetype -lGLESv2 -lglfw -o terminal
19+
run: cd entry/src/main/cpp && clang++ -std=c++17 terminal.cpp -I/usr/include/freetype2 -DSTANDALONE -lGLESv2 -lglfw -lfreetype -lutf8proc -o terminal
2020
- name: compile test
21-
run: cd entry/src/main/cpp && clang++ -O2 -fsanitize=address test.cpp terminal.cpp -I/usr/include/freetype2 -DSTANDALONE -DTESTING -o test -lCatch2Main -lCatch2 -lfreetype -lGLESv2 -lglfw
21+
run: cd entry/src/main/cpp && clang++ -std=c++17 -O2 -fsanitize=address test.cpp terminal.cpp -I/usr/include/freetype2 -DSTANDALONE -DTESTING -o test -lGLESv2 -lglfw -lfreetype -lutf8proc -lCatch2Main -lCatch2
2222
- name: run test
2323
run: cd entry/src/main/cpp && ./test

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "entry/src/main/cpp/alacritty"]
55
path = entry/src/main/cpp/alacritty
66
url = https://github.com/alacritty/alacritty.git
7+
[submodule "utf8proc"]
8+
path = entry/src/main/cpp/utf8proc
9+
url = https://github.com/JuliaStrings/utf8proc

README.md

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,58 +16,22 @@ Also compile and run C/C++ programs on HarmonyOS Computer:
1616

1717
Bundled packages:
1818

19-
- aria2
20-
- bash
21-
- binutils
22-
- busybox
23-
- c-ares
24-
- coremark
25-
- curl
26-
- [elf-loader](https://github.com/MikhailProg/elf) (you can run executable without executable permission! e.g. `cp /data/app/bin/bash ~/ && loader ~/bash`)
27-
- expat
28-
- fastfetch
29-
- fish
30-
- gcc
31-
- gdb
32-
- gettext
33-
- git
34-
- glib
35-
- gmp
36-
- hdc
37-
- htop
38-
- kbd
39-
- libarchive
40-
- libevent
41-
- libffi
42-
- libidn2
43-
- libunistring
44-
- lz4
45-
- make
46-
- mpc
47-
- mpfr
48-
- ncnn
49-
- ncurses
50-
- openssh
51-
- openssl
52-
- pcre2
53-
- proot
54-
- python
55-
- qemu (you can run executable without executable permission! e.g. `cp /data/app/bin/bash ~/ && qemu-aarch64 ~/bash`)
56-
- qemu-vroot (qemu patched to mimic proot behavior)
57-
- readline
58-
- sl
59-
- strace
60-
- stream
61-
- talloc
62-
- tar
63-
- tmux
64-
- tree
65-
- vim
66-
- vkpeak
67-
- xxhash
68-
- xz
69-
- yyjson
70-
- zstd
19+
||||||
20+
| --- | --- | --- | --- | --- |
21+
| aria2 | bash | binutils | busybox | c-ares |
22+
| coremark | curl | elf-loader | expat | fastfetch |
23+
| fish | gcc | gdb | gettext | git |
24+
| glib | gmp | hdc | htop | kbd |
25+
|lib{archive|event|ffi|idn2|unistring}|
26+
| lz4 | make | mpc | mpfr | ncnn |
27+
|ncurses|openssh|openssl|pcre2|proot|
28+
|python|qemu|qemu-vroot|readline|sl|
29+
|strace|stream|talloc|tar|tmux|
30+
|tree|vim|vkpeak|xxhash|xz|
31+
|yyjson|zstd|
32+
33+
- [elf-loader](https://github.com/MikhailProg/elf): you can run executable without executable permission! e.g. `cp /data/app/bin/bash ~/ && loader ~/bash`
34+
- qemu{,vroot}: you can run executable without executable permission! e.g. `cp /data/app/bin/bash ~/ && qemu-aarch64 ~/bash`
7135

7236
Pro tip: you can use these utilities in the builtin Terminal app under `/data/service/hnp`:
7337

@@ -90,7 +54,8 @@ if [ -d "/data/service/hnp/base.org/base_1.0" ]; then
9054
fi
9155
```
9256

93-
However, the builtin Terminal app does not have the permission to map R+X pages, so you cannot use elf loader there. You can use it in Termony. Also, the public folder `/data/service/hnp` does not get updated if you upgrade Termony. You need to re-install Termony to get the latest version available.
57+
However, now whatever debug mode app has access to `mprotect(anon_page, R_X, ...)`, so you can use elf loader in HiShell.
58+
The HNP folder does not get updated if you upgrade Termony. You need to re-install Termony to get the latest version available.
9459

9560
Terminal features:
9661

@@ -100,7 +65,7 @@ Terminal features:
10065

10166
### Run in a new root file-system
10267

103-
`qemu-vroot-aarch64` is a user mode qemu modified to to mimic proot behavior. It allows user to run linux binary(even for another CPU architecture) and switch to a new root-filesystem like chroot or proot.
68+
`qemu-vroot-aarch64` is a user mode qemu modified to to mimic proot behavior. It allows user to run linux binary (even for another CPU architecture) and switch to a new root-filesystem like chroot or proot.
10469

10570
#### Alpine Linux
10671

README_CN.md

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,58 +16,22 @@ Termux for HarmonyOS Computer。开发进行中。
1616

1717
内置软件包:
1818

19-
- aria2
20-
- bash
21-
- binutils
22-
- busybox
23-
- c-ares
24-
- coremark
25-
- curl
26-
- [elf-loader](https://github.com/MikhailProg/elf) (你可以运行没有可执行权限的可执行文件!例如 `cp /data/app/bin/bash ~/ && loader ~/bash`)
27-
- expat
28-
- fastfetch
29-
- fish
30-
- gcc
31-
- gdb
32-
- gettext
33-
- git
34-
- glib
35-
- gmp
36-
- hdc
37-
- htop
38-
- kbd
39-
- libarchive
40-
- libevent
41-
- libffi
42-
- libidn2
43-
- libunistring
44-
- lz4
45-
- make
46-
- mpc
47-
- mpfr
48-
- ncnn
49-
- ncurses
50-
- openssh
51-
- openssl
52-
- pcre2
53-
- proot
54-
- python
55-
- qemu (你可以运行没有可执行权限的可执行文件!例如 `cp /data/app/bin/bash ~/ && qemu-aarch64 ~/bash`)
56-
- qemu-vroot (patch 过的 qemu 以模拟 proot 行为)
57-
- readline
58-
- sl
59-
- strace
60-
- stream
61-
- talloc
62-
- tar
63-
- tmux
64-
- tree
65-
- vim
66-
- vkpeak
67-
- xxhash
68-
- xz
69-
- yyjson
70-
- zstd
19+
||||||
20+
| --- | --- | --- | --- | --- |
21+
| aria2 | bash | binutils | busybox | c-ares |
22+
| coremark | curl | elf-loader | expat | fastfetch |
23+
| fish | gcc | gdb | gettext | git |
24+
| glib | gmp | hdc | htop | kbd |
25+
|lib{archive|event|ffi|idn2|unistring}|
26+
| lz4 | make | mpc | mpfr | ncnn |
27+
|ncurses|openssh|openssl|pcre2|proot|
28+
|python|qemu|qemu-vroot|readline|sl|
29+
|strace|stream|talloc|tar|tmux|
30+
|tree|vim|vkpeak|xxhash|xz|
31+
|yyjson|zstd|
32+
33+
- [elf-loader](https://github.com/MikhailProg/elf): (你可以运行没有可执行权限的可执行文件!例如 `cp /data/app/bin/bash ~/ && loader ~/bash`)
34+
- qemu{,vroot}: (你可以运行没有可执行权限的可执行文件!例如 `cp /data/app/bin/bash ~/ && qemu-aarch64 ~/bash`)
7135

7236
小技巧:你可以在内置终端应用中使用这些工具 `/data/service/hnp`
7337

@@ -90,12 +54,13 @@ if [ -d "/data/service/hnp/base.org/base_1.0" ]; then
9054
fi
9155
```
9256

93-
但是,系统自带的终端应用没有映射 R+X 页面的权限,因此不能在那里使用 elf 加载器。你可以在 Termony 中使用它。此外,如果你升级了 Termony,公共 HNP 安装路径 `/data/service/hnp` 不会更新。你需要重新安装 Termony 才能获得最新版本。
57+
HiShell 和其他 debug 模式的 app 也可以使用 elf 加载器,尽管这可能因系统更新而改变。
58+
如果你升级了 Termony,公共 HNP 安装路径 `/data/service/hnp` 不会更新。你需要重新安装 Termony 才能获得最新版本。
9459

9560
终端特性:
9661

9762
- 基本的转义序列支持
98-
- 通过上下文菜单粘贴(右键单击激活)
63+
- 通过右键菜单粘贴
9964
- 在命令行中通过 pbcopy/pbpaste 复制/粘贴(基于 OSC52 转义序列)
10065

10166
### 在新的根文件系统中运行

entry/src/main/cpp/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ find_library(
1818
)
1919

2020
add_subdirectory(freetype)
21+
add_subdirectory(utf8proc)
2122

2223
add_library(entry SHARED napi_init.cpp terminal.cpp)
23-
target_link_libraries(entry PUBLIC libace_napi.z.so ${EGL-lib} ${GLES-lib} libnative_window.so libhilog_ndk.z.so freetype)
24+
target_compile_features(entry PRIVATE cxx_std_17)
25+
target_link_libraries(entry PUBLIC ${EGL-lib} ${GLES-lib} libace_napi.z.so libnative_window.so libhilog_ndk.z.so freetype utf8proc)

entry/src/main/cpp/napi_init.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
#include "terminal.h"
33
#include <EGL/egl.h>
44
#include <GLES3/gl32.h>
5-
#include <assert.h>
5+
#include <cassert>
66
#include <cstdint>
7+
#include <cstdio>
78
#include <deque>
8-
#include <fcntl.h>
99
#include <map>
10-
#include <native_window/external_window.h>
11-
#include <poll.h>
12-
#include <pty.h>
1310
#include <set>
14-
#include <stdio.h>
1511
#include <string>
12+
#include <vector>
13+
#include <fcntl.h>
14+
#include <poll.h>
15+
#include <pty.h>
1616
#include <sys/time.h>
1717
#include <unistd.h>
18-
#include <vector>
18+
#include <native_window/external_window.h>
1919

2020
#include "hilog/log.h"
2121
#undef LOG_TAG
@@ -224,6 +224,14 @@ std::string GetPaste() {
224224
return res;
225225
}
226226

227+
napi_value OnForeground(napi_env env, napi_callback_info info) {
228+
return nullptr;
229+
}
230+
231+
napi_value OnBackground(napi_env env, napi_callback_info info) {
232+
return nullptr;
233+
}
234+
227235
EXTERN_C_START
228236
static napi_value Init(napi_env env, napi_value exports) {
229237
napi_property_descriptor desc[] = {
@@ -236,6 +244,8 @@ static napi_value Init(napi_env env, napi_value exports) {
236244
{"checkCopy", nullptr, CheckCopy, nullptr, nullptr, nullptr, napi_default, nullptr},
237245
{"checkPaste", nullptr, CheckPaste, nullptr, nullptr, nullptr, napi_default, nullptr},
238246
{"pushPaste", nullptr, PushPaste, nullptr, nullptr, nullptr, napi_default, nullptr},
247+
{"onForeground", nullptr, OnForeground, nullptr, nullptr, nullptr, napi_default, nullptr},
248+
{"onBackground", nullptr, OnBackground, nullptr, nullptr, nullptr, napi_default, nullptr},
239249
};
240250
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
241251
return exports;

0 commit comments

Comments
 (0)