port 2A step 2: copy the 40250 header closure into the port mirror
76 closure headers (EterBase, EterLocale, EterPack, EterLib, GameLib, MilesLib, EffectLib, SphereLib, EterImageLib) copied by the new port_copy.py (CP949->UTF-8, LF, include-path case only); platform-class headers go to the mirror path too, as the interface platform/ implements. Six manual `// PORT:` edits (Random, Singleton, Pool, Stl, Utils, FlyTarget). - common/D3D8Types.h: D3D8 value types with SDK values/layout, opaque COM interfaces - common/shim/sdk (d3d8/d3dx8/mss) on every platform, common/shim/win32 off Windows - Win32Types/Win32Crt: HRESULT, GUID, LARGE_INTEGER, LOGFONT/TEXTMETRIC, _atoi64, CRITICAL_SECTION on std::recursive_mutex - header gate prepends each library's StdAfx.h (40250's precompiled header) port_gate: macOS, Android, iOS, Windows (mingw) PASS; Linux BLOCKED (no toolchain). ScriptLib/EterPythonLib/UserInterface wait for 2P (their StdAfx includes Python). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+30
-4
@@ -43,13 +43,21 @@ extension/src/port/GameLib/ActorInstance.cpp
|
||||
extension/src/port/ScriptLib/PythonLauncher.cpp
|
||||
extension/src/port/EterPythonLib/PythonWindow*.cpp
|
||||
extension/src/port/UserInterface/*Module.cpp # app/net/player/chr/... Python 模块
|
||||
extension/src/platform/ # CGraphicThingInstance、CSoundManager 等同名适配接口
|
||||
extension/src/port/EterLib/GrpBase.h # 平台类的 40250 头文件同样照抄在镜像路径(接口)
|
||||
extension/src/platform/ # 这些平台类的实现(CGraphicThingInstance、CSoundManager 等)
|
||||
extension/third_party/cpython-2.7.18/ # 静态库(2P 批次加入)
|
||||
```
|
||||
|
||||
逻辑层规则:
|
||||
|
||||
- 40250 调用平台类的地方,调用 `extension/src/platform/` 下同名的适配接口,ported 代码里不直接写 Godot 调用。
|
||||
闭包里的 40250 头文件**不分逻辑层和平台层,一律照抄到镜像路径**(`port/EterLib/GrpBase.h` 等),作为平台类的接口,
|
||||
这样原来的相对 include(`../eterLib/StdAfx.h`)保持不变;`platform/` 只放这些类的 `.cpp` 实现,不另写同名头文件。
|
||||
- 照抄只做机械转换,用 `port_copy.py copy <Lib/File>`:CP949 转 UTF-8、CRLF 转 LF、`#include "..."` 路径改成磁盘上的
|
||||
大小写;含非 ASCII 字符串字面量的文件拒绝照抄,需手工处理。其他任何改动都是手工修改,行上标 `// PORT:` 并写原因,
|
||||
`port_copy.py diff` 列出全部手工修改。
|
||||
- 40250 源码里的系统头保持原样 include,由 `port/common/shim/` 提供替身:`shim/sdk/`(`d3d8.h`、`d3dx8.h`、`mss.h`,
|
||||
所有平台都用,只含值类型和不透明接口)、`shim/win32/`(`windows.h`、`winsock.h`、`mmsystem.h` 等,仅非 Windows 平台用)。
|
||||
- 40250 的单例(`CPythonPlayer`、`CPythonCharacterManager`、`CPythonNetworkStream`)归扩展所有,GDScript 不持有玩法状态。
|
||||
- **保持 40250 的宽度和溢出语义,不是机械保留 C++ 类型名。** 40250 可执行文件目标是 32 位 Win32(ILP32):
|
||||
`long`/`unsigned long` 和指针都是 32 位;移植目标则可能是 LP64 或 LLP64。`port/common/Win32Types.h`(批次 2A)
|
||||
@@ -133,13 +141,31 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次
|
||||
- 2V3 切片用到的 `D3DXVec*`、`D3DXMatrix*`、`D3DXQuaternion*` 函数,采用行向量、左手旋转、D3DX 的乘法顺序;
|
||||
后续单元用到新函数时再按需补。
|
||||
|
||||
这一层不包含 D3D8 渲染枚举和结构(`D3DLIGHT8`、`D3DRS_*` 等),它们归 platform 层。测试在 `port.common` 里。
|
||||
- 未完成:闭包头文件照抄(步骤 2)、platform 接口骨架(步骤 4)。
|
||||
测试在 `port.common` 里。
|
||||
- 已完成(步骤 2,不含依赖 Python 的库):闭包头文件照抄,76 个,覆盖 EterBase、EterLocale、EterPack、EterLib、
|
||||
GameLib、MilesLib、EffectLib、SphereLib、EterImageLib。
|
||||
- 门禁中每个头文件前先 include 本库的 `StdAfx.h`(40250 把它作为预编译头)。
|
||||
- D3D8 的值类型(`D3DFORMAT`、`D3DCAPS8`、`D3DLIGHT8`、`D3DMATERIAL8` 等,按 SDK 取值和布局并加 `static_assert`)
|
||||
放在 `port/common/D3D8Types.h`;COM 接口(`IDirect3DDevice8` 等)只做不透明声明,由 platform 持有。
|
||||
- 手工 `// PORT:` 修改共 6 个文件:
|
||||
- `Random.h`:`random`/`srandom` 与 POSIX 重名,改名;
|
||||
- `Singleton.h`:`(int)` 指针运算改为 `intptr_t`;
|
||||
- `Pool.h`:`operator new(unsigned int)` 改为 `size_t`;
|
||||
- `Stl.h`:`<SSTREAM>` 改为小写;
|
||||
- `Utils.h`:补 `<math.h>`;
|
||||
- `FlyTarget.h`:补 `CFlyTarget` 前置声明(MSVC 会让 friend 声明可见)。
|
||||
- 40250 StdAfx 里有影响语义的宏,移植逻辑时要注意:
|
||||
- EterBase 的 `#define atoi _atoi64`;
|
||||
- UserInterface 的 `_USE_32BIT_TIME_T`;
|
||||
- `EterBase/ServiceDefs.h` 的 `_IMPROVED_PACKET_ENCRYPTION_`;
|
||||
- 工程字符集是 MultiByte,所以 `TCHAR` 就是 `char`。
|
||||
- ScriptLib、EterPythonLib、UserInterface 的 StdAfx 会 include Python 头,要等 2P 把 CPython 加进来之后再照抄。
|
||||
- 未完成:platform 接口骨架(步骤 4);依赖 Python 的三个库的闭包头(等 2P)。
|
||||
|
||||
| 平台 | port_gate |
|
||||
| --- | --- |
|
||||
| macOS arm64 | PASS(含 `port.common` 测试) |
|
||||
| Android arm64(NDK 27.2,API 24) | PASS |
|
||||
| Android arm64(脚本取已装的最新 NDK,本机 28.2;API 24) | PASS |
|
||||
| iOS arm64 | PASS(Xcode,未签名) |
|
||||
| Windows x64 | mingw-w64 PASS;MSVC 需在 Windows 主机上跑,**BLOCKED** |
|
||||
| Linux x86_64 | **BLOCKED**(本机无 Linux 工具链;Linux 主机上直接运行脚本) |
|
||||
|
||||
Reference in New Issue
Block a user