[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-92670":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":13,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":17,"hasPages":17,"topics":19,"createdAt":10,"pushedAt":10,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":15,"starSnapshotCount":15,"syncStatus":13,"lastSyncTime":23,"discoverSource":24},92670,"WineHua","winehua\u002FWineHua","winehua","Run Windows exe on HarmonyOS via Wine","",null,"C",51,2,1,0,38.43,false,"master",[],"2026-07-22 04:02:06","# WineHua — Wine on HarmonyOS\n\n在 HarmonyOS (OpenHarmony) 设备上运行 Windows x86_64 程序，通过 Box64 指令翻译，嵌入 Wayland compositor 渲染窗口。\n\n![运行效果](docs\u002Fimages\u002Frun_wine_example.jpg)\n\n## 支持平台\n\n| 平台 | Wine | Box64 | 进程模型 | 打包方式 |\n|------|------|-------|---------|---------|\n| arm64 PC (emulator) | x86_64 (musl) | box64 可执行文件 | execve | HNP |\n| arm64 Pad (emulator) | x86_64 (musl) | box64.so (dlopen) | NCP appspawn | rawfile zip |\n| x86_64 PC emulator | x86_64 (musl) | - | execve | HNP |\n| x86_64 Pad emulator | x86_64 (musl) .so | - | NCP appspawn | rawfile zip |\n\nPC 设备有 execve 和 HNP 包管理；Pad 设备仅 fork、无 execve，通过 OHOS NativeChildProcess (appspawn) 启动子进程，产物放在 rawfile zip 中运行时解压。\n\n## 架构\n\n```\nWindows PE (x86_64)\n    ↓ Box64 (x86_64 → ARM64 指令翻译)\nWine (x86_64, musl libc)\n    ↓ winewayland.drv\n嵌入式 Wayland compositor (ARM64 原生, HAP 进程内)\n    ├── WaylandServer (wl_compositor, xdg_shell, wl_seat)\n    ├── InputManager  (鼠标\u002F键盘事件注入)\n    └── EglRenderer  (EGL\u002FGLES → XComponent 上屏)\n```\n\narm64 Pad 下 Box64 编译为 **共享库 (box64.so)**，由 NCP 子进程 dlopen 加载，通过 `box64_hmos_main()` 在同一进程内模拟执行 x86_64 Wine ELF。编译宏 `LIBBOX64_SO` 控制此模式，运行时通过 `USE_LIBBOX64` 环境变量通知 Wine 侧适配 entryParams 格式。\n\n## 当前状态\n\n| 功能 | 状态 |\n|------|------|\n| ARM64 Pad Box64 .so 方案 | ✅ |\n| x86_64 Pad Wine .so 方案 | ✅ |\n| Explorer 桌面 | ✅ |\n| GUI 程序 (notepad 等) | ✅ |\n| NAPI 沙箱运行 | ✅ |\n| 多窗口 | ✅ |\n| 鼠标 \u002F 键盘输入 | ✅ |\n| 音频 | ❌ |\n\n## 构建\n\n依赖 [Command Line Tools](https:\u002F\u002Fdeveloper.huawei.com\u002Fconsumer\u002Fcn\u002Fdownload\u002F) 命令行工具 (`hvigorw`)，通过 `TOOL_HOME` 环境变量定位。\n\n```bash\n# PC 构建 (execve + HNP)\nbash build.sh quick \u003Cdevice_ip>          # arm64 PC (默认)\nbash build.sh quick \u003Cdevice_ip> x86_64   # x86_64 PC\n\n# Pad 构建 (fork-only, rawfile zip)\nbash build.sh pad arm64                  # arm64 Pad\nbash build.sh pad x86_64                 # x86_64 Pad\n\n# Pad 增量构建 (只改 ArkTS\u002Fnative 时)\nbash build.sh pad-hap arm64\n```\n\n## 讨论交流\n\nWeChat 二维码\n\n\u003Cimg src=\"docs\u002Fimages\u002Fwechat_qrcode.png\" width=\"300\">\n\n## 目录结构\n\n```\nWineHua\u002F\n├── entry\u002Fsrc\u002Fmain\u002F\n│   ├── cpp\u002F                   # Native C++: Wayland compositor, EGL, Input\n│   │   ├── napi_init.cpp      # NAPI 桥接 + wine\u002Fwineserver\u002Fbroker 进程管理\n│   │   ├── wine_child.cpp     # NCP 子进程入口 (Main\u002FWineserverMain)\n│   │   ├── wayland_server.cpp # 嵌入式 Wayland compositor\n│   │   ├── egl_renderer.cpp   # EGL\u002FGLES 渲染器\n│   │   ├── input_manager.cpp  # 鼠标\u002F键盘事件注入\n│   │   ├── plugin_manager.cpp # surfaceId 驱动 XComponent 管理\n│   │   ├── xdg_shell.cpp      # xdg-shell 协议实现\n│   │   └── seat.cpp           # wl_seat + keycode 映射\n│   ├── ets\u002Fpages\u002F\n│   │   ├── Index.ets          # 主界面 (侧边栏 + 桌面)\n│   │   ├── WineWindow.ets     # Wine 子窗口\n│   │   └── DesktopWindow.ets  # 桌面窗口\n│   └── ets\u002Fmodel\u002F\n│       └── WineWindowManager.ets  # 窗口生命周期管理\n├── build.sh                   # 统一构建入口\n├── scripts\u002F\n│   ├── env.sh                 # 环境变量 (NATIVE_ARCH, DEVICE_TYPE, 工具链)\n│   ├── build_deps.sh          # 交叉编译依赖\n│   ├── build_wine.sh          # Wine 构建\n│   ├── build_box64.sh         # Box64 构建 (可执行文件 \u002F .so)\n│   ├── assemble.sh            # PC: HNP 布局 \u002F Pad: rawfile zip + libs\u002F\n│   └── package.sh             # HNP\u002FHAP 打包\n├── docs\u002F                      # 详细文档\n│   ├── CURRENT_STATUS.md      # 当前状态 & 修复清单\n│   ├── ARCHITECTURE.md        # 架构详解\n│   └── BUILD_GUIDE.md         # 构建指南\n└── thirdparty\u002F                # git submodule\n    ├── wine\u002F                  # winehua\u002Fwine (fork)\n    ├── box64\u002F                 # winehua\u002Fbox64 (fork)\n    ├── freetype\u002F\n    ├── wayland\u002F\n    ├── libxkbcommon\u002F\n    └── xkeyboard-config\u002F\n```\n\n## 关键适配\n\n- **Box64**: x86_64 → ARM64 指令翻译 (Dynarec)，Pad 下编译为 .so (LIBBOX64_SO) 由 NCP 子进程 dlopen 加载\n- **Wayland compositor**: HAP 进程内嵌入式 compositor，不依赖外部 Wayland 服务\n- **NCP appspawn**: Pad 通过 `OH_Ability_StartNativeChildProcess` 创建子进程，绕过无 execve 限制\n- **surfaceId 架构**: 通过 `XComponentController` 回调获取 surfaceId，解决多窗口冲突\n- **noexec 文件系统**: 可执行段用匿名 mmap + pread 替代文件映射\n- **dosdevices symlink**: OHOS 沙箱禁止 symlink()，fallback 到 drive_c\n- **XKB 键盘**: xkeyboard-config 打包到 rawfile\u002FHNP，通过 `XKB_CONFIG_ROOT` 指向\n\n## 日志\n\n所有 Wine 输出（stdout + stderr）重定向到 hilog + 文件：\n\n```bash\n# Pad 设备\nhdc -t \u003Cdevice_ip> hilog | grep -E '\\[wine\\]|WineChild|WL_NAPI|WL_Input'\n```\n","WineHua 是一个在 HarmonyOS（OpenHarmony）设备上运行 Windows x86_64 程序的兼容层项目。它基于 Wine（musl libc 版本）与 Box64 指令翻译器，通过嵌入式 Wayland compositor 实现 GUI 渲染，并适配 HarmonyOS 的进程模型（如 NCP appspawn 和 execve），支持多窗口、鼠标键盘输入及桌面环境（如 Explorer）。技术上采用 C 实现核心模块，Box64 以可执行文件或共享库（.so）形式集成，渲染层基于 EGL\u002FGLES 输出至 XComponent。适用于在 ARM64\u002Fx86_64 架构的 HarmonyOS 平板或模拟器上运行轻量级 Windows 桌面应用（如记事本），暂不支持音频。","2026-07-10 02:30:08","CREATED_QUERY"]