port 2A step 4: platform skeleton + rest of the 2V3 header closure

- Mirror the remaining non-Python 2V3 closure headers (98 more, 173 total): EffectLib,
  EterGrnLib, SpeedTreeLib, SphereLib, PRTerrainLib, EterImageLib, EterBase/Poly, cipher/tea,
  EterLib Grp*/IME/Input/MSWindow/StateManager, GameLib actor/map/race headers, EterPack.
- SDK shims: granny.h, SpeedTreeRT.h, imm.h, Dimm.h (the SDK MIDL header, not mirrored),
  dinput/d3dx8 additions; D3D8 render-state enums, FVF macros and the COM resource hierarchy;
  more Win32 GDI/handle types with layout static_asserts.
- PORT edits for MSVC-permissive code (typename, friend visibility, <algorithm>, pointer→uintptr_t)
  and PRTerrainLib/StdAfx.h dropping the ScriptLib/Python include.
- port_logic links the vendored cryptopp/minilzo.
- extension/src/platform: port_platform target with 103 generated stub files (1917 function
  stubs, 146 static members) from the new platform_stub.py (clang -ast-dump-filter);
  MT_PLATFORM_STUB() marks every unimplemented body. libmtgodot links port_platform and
  port_gate.sh builds it.

Gate: macOS, Android, iOS, Windows (mingw) PASS; Linux BLOCKED (no toolchain).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-22 21:46:24 +09:00
co-authored by Claude Opus 5
parent fc47582017
commit 9a8e11f3dd
220 changed files with 24287 additions and 25 deletions
@@ -0,0 +1,21 @@
#pragma once
// Shim for IDV SpeedTreeRT <SpeedTreeRT.h> (40250 extern/include): the CSpeedTreeRT members that
// SpeedTreeLib headers name. Tree geometry and wind go through platform/, which defines them.
class CSpeedTreeRT
{
public:
enum ECollisionObjectType
{
CO_SPHERE,
CO_CYLINDER,
CO_BOX
};
struct SGeometry;
struct STextures;
float GetLeafLightingAdjustment() const;
float SetWindStrength(float fNewStrength, float fOldStrength = -1.0f, float fFrequencyTimeOffset = -1.0f);
void GetCollisionObject(unsigned int nIndex, ECollisionObjectType& eType, float* pPosition, float* pDimensions);
};
+2 -1
View File
@@ -1,4 +1,5 @@
#pragma once
// Shim for <d3d8.h>: the D3D8 value types 40250 logic uses as data. Rendering goes through
// platform/, never through these declarations.
// platform/, never through these declarations. The real header pulls in <string.h> (objbase.h).
#include <string.h>
#include "../../D3DXMath.h"
@@ -0,0 +1,70 @@
#pragma once
// Shim for RAD Granny 2.11 <granny.h> (40250 extern/include): the scalar types and structs that
// EterGrnLib headers name, with the SDK's layout; every other Granny object is opaque. Loading and
// skinning go through platform/ (backed by libgr2), never through these declarations.
#include <stdint.h>
typedef uint32_t granny_uint32;
typedef int32_t granny_int32;
typedef uint16_t granny_uint16;
typedef int16_t granny_int16;
typedef uint8_t granny_uint8;
typedef int8_t granny_int8;
typedef float granny_real32;
typedef granny_uint32 granny_bool32;
typedef uintptr_t granny_uintaddrx;
typedef granny_real32 granny_triple[3];
typedef granny_real32 granny_quad[4];
typedef enum granny_member_type
{
GrannyEndMember,
GrannyInlineMember,
GrannyReferenceMember,
GrannyReferenceToArrayMember,
GrannyArrayOfReferencesMember,
GrannyVariantReferenceMember,
GrannyUnsupportedMemberType_Remove,
GrannyReferenceToVariantArrayMember,
GrannyStringMember,
GrannyTransformMember,
GrannyReal32Member,
GrannyInt8Member,
GrannyUInt8Member,
GrannyBinormalInt8Member,
GrannyNormalUInt8Member,
GrannyInt16Member,
GrannyUInt16Member,
GrannyBinormalInt16Member,
GrannyNormalUInt16Member,
GrannyInt32Member,
GrannyUInt32Member,
GrannyReal16Member,
GrannyEmptyReferenceMember,
GrannyOnePastLastMemberType,
GrannyBool32Member = GrannyInt32Member,
Grannymember_type_forceint = 0x7fffffff
} granny_member_type;
struct granny_data_type_definition
{
granny_member_type Type;
char const* Name;
granny_data_type_definition* ReferenceType;
granny_int32 ArrayWidth;
granny_int32 Extra[3];
granny_uintaddrx Ignored_Ignored;
};
struct granny_animation;
struct granny_control;
struct granny_file;
struct granny_file_info;
struct granny_material;
struct granny_mesh;
struct granny_mesh_binding;
struct granny_mesh_deformer;
struct granny_model;
struct granny_model_instance;
struct granny_skeleton;
struct granny_world_pose;
@@ -0,0 +1,7 @@
#pragma once
// Shim for the Active IMM COM interfaces (<dimm.h>; 40250 vendors the MIDL output as
// EterLib/Dimm.h, which is the SDK header and not part of the port mirror) on non-Windows targets.
#include <imm.h>
struct IActiveIMMApp;
struct IActiveIMMMessagePumpOwner;
+11 -1
View File
@@ -1,3 +1,13 @@
#pragma once
// Shim for <dinput.h> on non-Windows targets; what 40250 logic uses from it is in <windows.h>.
// Shim for DirectInput 8 <dinput.h> on non-Windows targets: the interfaces 40250 headers name, as
// opaque types. Input goes through platform/.
#include "windows.h"
#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#endif
struct IDirectInput8;
struct IDirectInputDevice8;
typedef IDirectInput8* LPDIRECTINPUT8;
typedef IDirectInputDevice8* LPDIRECTINPUTDEVICE8;
@@ -0,0 +1,11 @@
#pragma once
// Shim for <imm.h> on non-Windows targets: the input-method handles 40250's IME declarations name.
// Text input goes through platform/.
#include "windows.h"
struct HIMC__;
typedef HIMC__* HIMC;
struct HIMCC__;
typedef HIMCC__* HIMCC;
struct tagINPUTCONTEXT;
typedef tagINPUTCONTEXT INPUTCONTEXT;
+15 -1
View File
@@ -1,5 +1,19 @@
#pragma once
// Shim for <windows.h> on non-Windows targets: the Win32 scalar types and CRT spellings
// 40250 sources use (common/Win32Types.h, common/Win32Crt.h).
// 40250 sources use (common/Win32Types.h, common/Win32Crt.h), plus the headers the real one pulls
// in that 40250 relies on transitively (winnt.h brings <string.h> for memcpy/memset).
#include <string.h>
#include "../../Win32Types.h"
#include "../../Win32Crt.h"
// winuser.h / wingdi.h constants named in 40250 declarations (default arguments).
#define WS_OVERLAPPED 0x00000000L
#define WS_CAPTION 0x00C00000L
#define WS_SYSMENU 0x00080000L
#define WS_THICKFRAME 0x00040000L
#define WS_MINIMIZEBOX 0x00020000L
#define WS_MAXIMIZEBOX 0x00010000L
#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
#define WHITE_BRUSH 0
#define BLACK_BRUSH 4
#define KL_NAMELENGTH 9