layout: restructure into src/ tests/ android/ scripts/ tools/

- extension/src/{port,platform,codepage} -> src/; native_render -> src/host
  (+ dxt, shaders/); libgr2 -> src/gr2; extension/third_party -> third_party
- extension/tests -> tests/port, libgr2/tests -> tests/gr2
- android-native -> android (build.sh, push-client.sh moved in)
- script -> scripts; tools/40250 -> tools/server; oracle -> tools/granny-oracle;
  perf tools -> tools/perf
- all build trees under build/ (native, release, android, port-gate)
- xrender:: CMake aliases -> mt::; port-map ledger impl paths rewritten

No code changes. ctest 15/15, port_gate macos+android PASS, port_map check 0 errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-29 19:08:19 +09:00
co-authored by Claude Opus 5.5
parent 70710477cf
commit a46093104c
2817 changed files with 13728 additions and 13744 deletions
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/compile.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <compile.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/errcode.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <errcode.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/eval.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <eval.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/frameobject.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <frameobject.h>
@@ -0,0 +1,14 @@
#pragma once
// Shim for 40250's <Python-2.7/grammar.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <grammar.h>
// CPython's bitset.h (pulled in by grammar.h) does `#define BYTE char`; the copy under 40250's
// extern/include/Python-2.7 has that line removed, so BYTE stays the Win32 unsigned char in every
// file that includes ScriptLib/StdAfx.h. bitset.h's own macros only use sizeof(BYTE), which is 1
// either way.
#undef BYTE
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/longintrepr.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <longintrepr.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/marshal.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <marshal.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/node.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <node.h>
@@ -0,0 +1,13 @@
#pragma once
// Shim for 40250's <Python-2.7/parsetok.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
// parsetok.h names `node` and `grammar` without including their headers; 40250's StdAfx includes
// node.h and grammar.h before it, in this order.
#include <node.h>
#include <grammar.h>
#include <parsetok.h>
@@ -0,0 +1,7 @@
#pragma once
// Shim for 40250's <Python-2.7/python.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>.
#include <Python.h>
@@ -0,0 +1,16 @@
#pragma once
// Shim for 40250's <Python-2.7/symtable.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
// CPython's Include/symtable.h is not self-contained: it names mod_ty, which only Python-ast.h
// declares — and that header also defines one-word macros (Module, Delete, Set, Print, Num, ...)
// that collide with 40250 identifiers such as CPool::Delete. 40250's own extern/include copy
// comments the one declaration that needs mod_ty (PySymtable_Build) out; repeating Python-ast.h's
// typedef keeps the upstream header intact and the macros out.
struct _mod;
typedef struct _mod *mod_ty;
#include <symtable.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/token.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <token.h>
+465
View File
@@ -0,0 +1,465 @@
// Shim for IDV SpeedTreeRT 1.6.0 <SpeedTreeRT.h> (40250 extern/include): the public section below is
// the SDK header verbatim. SpeedTreeRT.lib is closed Windows COFF, so the private section is replaced
// by one opaque pointer and the members SpeedTreeLib calls are implemented in
// platform/SpeedTreeLib/SpeedTreeRT.cpp. <cstddef> stands in for the size_t the SDK got from <windows.h>.
#include <cstddef>
///////////////////////////////////////////////////////////////////////
// Name: SpeedTreeRT.h
//
// *** INTERACTIVE DATA VISUALIZATION (IDV) PROPRIETARY INFORMATION ***
//
// Copyright (c) 2001-2003 IDV, Inc.
// All Rights Reserved.
//
// IDV, Inc.
// 1233 Washington St. Suite 610
// Columbia, SC 29201
// Voice: (803) 799-1699
// Fax: (803) 931-0320
// Web: http://www.idvinc.com
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Interactive Data Visualization and may not
// be copied or disclosed except in accordance with the terms of that
// agreement.
//
// Release version 1.6.0 (December 19, 2003)
#pragma once
// define static or dynamic library build
#ifdef SPEEDTREERT_DYNAMIC_LIB
#ifdef IDV_SPEEDTREERT_EXPORTS
#define BUILD_SPEED_TREE_RT_SET __declspec(dllexport)
#else
#define BUILD_SPEED_TREE_RT_SET __declspec(dllimport)
#endif
#else
#define BUILD_SPEED_TREE_RT_SET
#endif
// big or little endian system
#ifdef __ppc__
#define ST_BIG_ENDIAN
#else
#define ST_LITTLE_ENDIAN
#endif
// Macintosh-specific
#ifdef __ppc__
#pragma export on
#endif
// forward refernces
class CIndexedGeometry;
class CTreeEngine;
class CLeafGeometry;
class CLightingEngine;
class CWindEngine;
class CTreeFileAccess;
class CSimpleBillboard;
class CFrondEngine;
struct STreeInstanceData;
struct SInstanceList;
struct SEmbeddedTexCoords;
struct SCollisionObjects;
class CProjectedShadow;
///////////////////////////////////////////////////////////////////////
// class SpeedTreeRT
//
// In an effort to make the SpeedTreeRT.h header file dependency free
// and easy to include into almost any project, a number of steps have
// been taken:
//
// 1. No external header files need to be included by SpeedTreeRT.h
// or by the application before including it.
//
// 2. Most of the implementation of the class is hidden by pointers
// to the major sections of the library (the internal classes
// can then just be forward-referenced)
//
// 3. Where possible, basic C++ datatypes are used to define the
// member functions' parameters.
//
// Because almost all of the implementation details are hidden, none of
// the functions for CSpeedTreeRT are inlined. However, inlined functions
// were copiously used within the library.
class BUILD_SPEED_TREE_RT_SET CSpeedTreeRT
{
public:
///////////////////////////////////////////////////////////////////////
// Enumerations
enum EWindMethod
{
WIND_GPU, WIND_CPU, WIND_NONE
};
enum ELodMethod
{
LOD_POP, LOD_SMOOTH, LOD_NONE = 3
};
enum ELightingMethod
{
LIGHT_DYNAMIC, LIGHT_STATIC
};
enum EStaticLightingStyle
{
SLS_BASIC, SLS_USE_LIGHT_SOURCES, SLS_SIMULATE_SHADOWS
};
enum ECollisionObjectType
{
CO_SPHERE, CO_CYLINDER, CO_BOX
};
///////////////////////////////////////////////////////////////////////
// SGeometry bit vectors
//
// Passed into GetGeometry() in order to mask out unneeded geometric elements
#define SpeedTree_BranchGeometry (1 << 0)
#define SpeedTree_FrondGeometry (1 << 1)
#define SpeedTree_LeafGeometry (1 << 2)
#define SpeedTree_BillboardGeometry (1 << 3)
#define SpeedTree_SimpleBillboardOverride (1 << 4)
#define SpeedTree_AllGeometry SpeedTree_BranchGeometry + SpeedTree_FrondGeometry + SpeedTree_LeafGeometry + SpeedTree_BillboardGeometry
///////////////////////////////////////////////////////////////////////
// struct SGeometry declaration
struct BUILD_SPEED_TREE_RT_SET SGeometry
{
SGeometry( );
~SGeometry( );
///////////////////////////////////////////////////////////////////////
// struct SGeometry::SIndexed declaration
struct BUILD_SPEED_TREE_RT_SET SIndexed
{
SIndexed( );
~SIndexed( );
// these values change depending on the active discrete LOD level
int m_nDiscreteLodLevel; // range: [0, GetNumBranch/FrondLodLevels( ) - 1], -1 if inactive
unsigned short m_usNumStrips; // total number of strips in current LOD
const unsigned short* m_pStripLengths; // lengths of strips in current LOD (m_usNumStrips in length)
const unsigned short** m_pStrips; // triangle strip indices (m_usNumStrips in length)
// these values are shared across all discete LOD levels
unsigned short m_usVertexCount; // total vertex count in tables, referenced by all LOD levels
const unsigned long* m_pColors; // RGBA values for each leaf - static lighting only (m_usVertexCount in length)
const float* m_pNormals; // normals for each vertex (3 * m_usVertexCount in length)
const float* m_pBinormals; // binormals (bump mapping) for each vertex (3 * m_usVertexCount in length)
const float* m_pTangents; // tangents (bump mapping) for each vertex (3 * m_usVertexCount in length)
const float* m_pCoords; // coordinates for each vertex (3 * m_usVertexCount in length)
const float* m_pTexCoords0; // 1st layer (s,t) texcoords for each vertex (2 * m_usVertexCount in length)
const float* m_pTexCoords1; // 2nd layer (s,t) texcoords for each vertex (2 * m_usVertexCount in length)
const float* m_pWindWeights; // values from from 0.0 for rigid to 1.0 for flexible (m_usVertexCount in length)
const unsigned char* m_pWindMatrixIndices; // table of wind matrix indices (m_usVertexCount in length)
};
///////////////////////////////////////////////////////////////////////
// struct SGeometry::SLeaf declaration
struct BUILD_SPEED_TREE_RT_SET SLeaf
{
SLeaf( );
~SLeaf( );
// active LOD level data
bool m_bIsActive; // flag indicating visibility
float m_fAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
int m_nDiscreteLodLevel; // range: [0, GetNumLeafLodLevels( ) - 1]
unsigned short m_usLeafCount; // number of leaves stored in this structure
// tables for referencing the leaf cluster table
const unsigned char* m_pLeafMapIndices; // references which leaf texture map used for each leaf (m_usLeafCount in length)
const unsigned char* m_pLeafClusterIndices; // references which leaf cluster used for each leaf (m_usLeafCount in length)
const float* m_pCenterCoords; // (x,y,z) values for the centers of leaf clusters (3 * m_usLeafCount in length)
const float** m_pLeafMapTexCoords; // table of unique leaf cluster texcoords (m_usLeafCount in length) - each entry
// points to 4 pairs of (s,t) texcoords stored in one contiguous array
const float** m_pLeafMapCoords; // table of unique leaf cluster coordinates (m_usLeafCount in length) - each entry
// points to 4 sets of (x,y,z,0) coordinates stored in one contiguous array
// remaining vertex attributes
const unsigned long* m_pColors; // RGBA values for each leaf (m_usLeafCount in length)
const float* m_pNormals; // normals for each leaf (3 * m_usLeafCount in length)
const float* m_pBinormals; // binormals (bump mapping) for each leaf (3 * m_usLeafCount in length)
const float* m_pTangents; // tangents (bump mapping) for each leaf (3 * m_usLeafCount in length)
const float* m_pWindWeights; // values from from 0.0 for rigid to 1.0 for flexible (m_usLeafCount in length)
const unsigned char* m_pWindMatrixIndices; // table of wind matrix indices (m_usLeafCount in length)
};
///////////////////////////////////////////////////////////////////////
// struct SGeometry::SBillboard declaration
struct BUILD_SPEED_TREE_RT_SET SBillboard
{
SBillboard( );
~SBillboard( );
bool m_bIsActive; // flag indicating visibility
const float* m_pTexCoords; // 4 pairs of (s,t) texcoords stored in one contiguous array
const float* m_pCoords; // 4 sets of (x,y,z) coordindates stored in one contiguous array
float m_fAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
};
///////////////////////////////////////////////////////////////////////
// branch geometry
SIndexed m_sBranches; // holds the branch vertices and index buffers for all
// of the discrete LOD levels
float m_fBranchAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
///////////////////////////////////////////////////////////////////////
// frond geometry
SIndexed m_sFronds; // holds the frond vertices and index buffers for all
// of the discrete LOD levels
float m_fFrondAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
///////////////////////////////////////////////////////////////////////
// leaf geometry
SLeaf m_sLeaves0; // holds the primary leaf geometry, alpha fades into
SLeaf m_sLeaves1; // m_sLeaves1 during LOD transitions
///////////////////////////////////////////////////////////////////////
// billboard geometry
SBillboard m_sBillboard0; // holds the main simple billboard geometry, alpha fades
SBillboard m_sBillboard1; // into m_sBillboard1 in 360 degree mode
SBillboard m_sHorizontalBillboard; // optional horizontal billboard used for aerial views
};
///////////////////////////////////////////////////////////////////////
// struct SGeometry::STextures declaration
struct BUILD_SPEED_TREE_RT_SET STextures
{
STextures( );
~STextures( );
// branches
const char* m_pBranchTextureFilename; // null-terminated string
// leaves
unsigned int m_uiLeafTextureCount; // the number of char* elements in m_pLeafTextureFilenames
const char** m_pLeafTextureFilenames; // array of null-terminated strings m_uiLeafTextureCount in size
// fronds
unsigned int m_uiFrondTextureCount; // the number of char* elements in m_pFrondTextureFilenames
const char** m_pFrondTextureFilenames; // array of null-terminated strings m_uiFrondTextureCount in size
// composite
const char* m_pCompositeFilename; // null-terminated string
// self-shadow
const char* m_pSelfShadowFilename; // null-terminated string
};
///////////////////////////////////////////////////////////////////////
// Constructor/Destructor
CSpeedTreeRT( );
~CSpeedTreeRT( );
///////////////////////////////////////////////////////////////////////
// Memory allocation
static void* operator new(size_t nSize);
static void* operator new[](size_t nSize);
static void operator delete(void* pRawMemory);
static void operator delete[](void* pRawMemory);
///////////////////////////////////////////////////////////////////////
// Specifying a tree model
bool Compute(const float* pTransform = 0, unsigned int nSeed = 1, bool bCompositeStrips = true);
CSpeedTreeRT* Clone(float x = 0.0f, float y = 0.0f, float z = 0.0f, unsigned int nSeed = 0) const;
const CSpeedTreeRT* InstanceOf(void) const;
CSpeedTreeRT* MakeInstance(void);
void DeleteTransientData(void);
bool LoadTree(const char* pFilename);
bool LoadTree(const unsigned char* pBlock, unsigned int nNumBytes);
// PORT: supply the pack path when LoadTree receives only a memory block.
void SetSourceName(const char* pFilename);
unsigned char* SaveTree(unsigned int& nNumBytes, bool bSaveLeaves = false) const;
void GetTreeSize(float& fSize, float& fVariance) const;
void SetTreeSize(float fNewSize, float fNewVariance = 0.0f);
unsigned int GetSeed( ) const;
const float* GetTreePosition(void) const;
void SetTreePosition(float x, float y, float z);
void SetLeafTargetAlphaMask(unsigned char ucMask = 0x54);
///////////////////////////////////////////////////////////////////////
// Lighting
// lighting style
ELightingMethod GetBranchLightingMethod(void) const;
void SetBranchLightingMethod(ELightingMethod eMethod);
ELightingMethod GetLeafLightingMethod(void) const;
void SetLeafLightingMethod(ELightingMethod eMethod);
ELightingMethod GetFrondLightingMethod(void) const;
void SetFrondLightingMethod(ELightingMethod eMethod);
EStaticLightingStyle GetStaticLightingStyle(void) const;
void SetStaticLightingStyle(EStaticLightingStyle eStyle);
float GetLeafLightingAdjustment( ) const;
void SetLeafLightingAdjustment(float fScalar);
// global lighting state
static bool GetLightState(unsigned int nLightIndex);
static void SetLightState(unsigned int nLightIndex, bool bLightOn);
static const float* GetLightAttributes(unsigned int nLightIndex);
static void SetLightAttributes(unsigned int nLightIndex, const float* pLightAttributes);
// branch material
const float* GetBranchMaterial(void) const;
void SetBranchMaterial(const float* pMaterial);
// leaf material
const float* GetLeafMaterial(void) const;
void SetLeafMaterial(const float* pMaterial);
// frond material
const float* GetFrondMaterial(void) const;
void SetFrondMaterial(const float* pMaterial);
///////////////////////////////////////////////////////////////////////
// Camera
static void GetCamera(float* pPosition, float* pDirection);
static void SetCamera(const float* pPosition, const float* pDirection);
///////////////////////////////////////////////////////////////////////
// Wind
static void SetTime(float fTime);
void ComputeWindEffects(bool bBranches, bool bLeaves, bool bFronds = true);
void ResetLeafWindState(void);
bool GetLeafRockingState(void) const;
void SetLeafRockingState(bool bFlag);
void SetNumLeafRockingGroups(unsigned int nRockingGroups);
EWindMethod GetLeafWindMethod(void) const;
void SetLeafWindMethod(EWindMethod eMethod);
EWindMethod GetBranchWindMethod(void) const;
void SetBranchWindMethod(EWindMethod eMethod);
EWindMethod GetFrondWindMethod(void) const;
void SetFrondWindMethod(EWindMethod eMethod);
float GetWindStrength(void) const;
float SetWindStrength(float fNewStrength, float fOldStrength = -1.0f, float fFrequencyTimeOffset = -1.0f);
static void SetNumWindMatrices(unsigned int nNumMatrices);
static void SetWindMatrix(unsigned int nMatrixIndex, const float* pMatrix);
void GetLocalMatrices(unsigned int& nStartingIndex, unsigned int& nMatrixSpan);
void SetLocalMatrices(unsigned int nStartingMatrix, unsigned int nMatrixSpan);
///////////////////////////////////////////////////////////////////////
// LOD
void ComputeLodLevel(void);
float GetLodLevel(void) const;
void SetLodLevel(float fLodLevel);
static void SetDropToBillboard(bool bFlag);
void GetLodLimits(float& fNear, float& fFar) const;
void SetLodLimits(float fNear, float fFar);
short GetDiscreteBranchLodLevel(float fLodLevel = -1.0f) const;
unsigned short GetDiscreteLeafLodLevel(float fLodLevel = -1.0f) const;
short GetDiscreteFrondLodLevel(float fLodLevel = -1.0f) const;
unsigned short GetNumBranchLodLevels(void) const;
unsigned short GetNumLeafLodLevels(void) const;
unsigned short GetNumFrondLodLevels(void) const;
///////////////////////////////////////////////////////////////////////
// Geometry
void DeleteBranchGeometry(void);
void DeleteFrondGeometry(void);
unsigned char* GetFrondGeometryMapIndexes(int nLodLevel) const;
const float* GetLeafBillboardTable(unsigned int& nEntryCount) const;
const float* GetLeafLodSizeAdjustments(void);
void GetGeometry(SGeometry& sGeometry, unsigned long ulBitVector = SpeedTree_AllGeometry, short sOverrideBranchLodValue = -1, short sOverrideFrondLodValue = -1, short sOverrideLeafLodValue = -1);
///////////////////////////////////////////////////////////////////////
// Textures
void GetTextures(STextures& sTextures) const;
void SetLeafTextureCoords(unsigned int nLeafMapIndex, const float* pTexCoords);
void SetFrondTextureCoords(unsigned int nFrondMapIndex, const float* pTexCoords);
static bool GetTextureFlip(void);
static void SetTextureFlip(bool bFlag);
void SetBranchTextureFilename(const char* pFilename);
void SetLeafTextureFilename(unsigned int nLeafMapIndex, const char* pFilename);
void SetFrondTextureFilename(unsigned int nFrondMapIndex, const char* pFilename);
///////////////////////////////////////////////////////////////////////
// Statistics & information
static void Authorize(const char* pKey);
static bool IsAuthorized(void);
static const char* GetCurrentError(void);
static void ResetError(void);
void GetBoundingBox(float* pBounds) const;
unsigned int GetLeafTriangleCount(float fLodLevel = -1.0f) const;
unsigned int GetBranchTriangleCount(float fLodLevel = -1.0f) const;
unsigned int GetFrondTriangleCount(float fLodLevel = -1.0f) const;
///////////////////////////////////////////////////////////////////////
// Collision objects
unsigned int GetCollisionObjectCount(void);
void GetCollisionObject(unsigned int nIndex, ECollisionObjectType& eType, float* pPosition, float* pDimensions);
///////////////////////////////////////////////////////////////////////
// User Data
const char* GetUserData(void) const;
private:
// PORT: the SDK's private engine members (m_pEngine .. m_afHorizontalCoords) are opaque here.
struct SImpl;
SImpl* m_pImpl;
CSpeedTreeRT(const CSpeedTreeRT&) = delete;
CSpeedTreeRT& operator=(const CSpeedTreeRT&) = delete;
};
// Macintosh-specific
#ifdef __ppc__
#pragma export off
#endif
@@ -0,0 +1,3 @@
#pragma once
// Shim for 40250's <cryptopp/cryptoppLibLink.h>, which only holds MSVC `#pragma comment(lib, ...)` auto-link
// lines; the vendored Crypto++ (mt3p::cryptopp) is linked by CMake.
+5
View File
@@ -0,0 +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. The real header pulls in <string.h> (objbase.h).
#include <string.h>
#include "../../D3DXMath.h"
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Shim for <d3d8types.h>; see d3d8.h.
#include "d3d8.h"
+43
View File
@@ -0,0 +1,43 @@
#pragma once
// Shim for <d3dx8.h>: platform-independent D3DX8 math (common/D3DXMath.h); D3DX objects are
// opaque, owned by platform/.
#include "d3d8.h"
// d3dx8core.h ID3DXBuffer / D3DXAssembleShader. There is no D3D8 shader assembler here:
// D3DXAssembleShader fails with no code and no error buffer.
struct ID3DXBuffer
{
virtual ~ID3DXBuffer() = default;
virtual ULONG Release() = 0;
virtual void* GetBufferPointer() = 0;
virtual DWORD GetBufferSize() = 0;
};
typedef ID3DXBuffer* LPD3DXBUFFER;
inline HRESULT D3DXAssembleShader(const void*, UINT, DWORD, LPD3DXBUFFER* ppConstants, LPD3DXBUFFER* ppCompiledShader, LPD3DXBUFFER* ppCompilationErrors)
{
if (ppConstants)
*ppConstants = nullptr;
if (ppCompiledShader)
*ppCompiledShader = nullptr;
if (ppCompilationErrors)
*ppCompilationErrors = nullptr;
return E_FAIL;
}
struct ID3DXMesh;
typedef ID3DXMesh* LPD3DXMESH;
struct ID3DXMatrixStack;
typedef ID3DXMatrixStack* LPD3DXMATRIXSTACK;
// d3dx8tex.h filter flags
#define D3DX_DEFAULT ((UINT)-1)
#define D3DX_FILTER_NONE (1 << 0)
#define D3DX_FILTER_POINT (2 << 0)
#define D3DX_FILTER_LINEAR (3 << 0)
#define D3DX_FILTER_TRIANGLE (4 << 0)
#define D3DX_FILTER_BOX (5 << 0)
#define D3DX_FILTER_MIRROR_U (1 << 16)
#define D3DX_FILTER_MIRROR_V (2 << 16)
#define D3DX_FILTER_MIRROR_W (4 << 16)
#define D3DX_FILTER_MIRROR (7 << 16)
#define D3DX_FILTER_DITHER (8 << 16)
+424
View File
@@ -0,0 +1,424 @@
#pragma once
// Shim for RAD Granny 2.11 <granny.h> (40250 extern/include): the scalar types, the public data structs
// EterGrnLib reads (SDK field names and order) and the functions it calls. The file-data structs are
// built from libgr2 and the runtime objects (file, model instance, control, pose, binding, deformer)
// stay opaque; both live in platform/EterGrnLib/GrannyRuntime.cpp.
#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 double granny_real64x;
typedef granny_uint32 granny_bool32;
typedef granny_int32 granny_int32x;
typedef granny_uint32 granny_uint32x;
typedef uintptr_t granny_uintaddrx;
typedef granny_real32 granny_triple[3];
typedef granny_real32 granny_quad[4];
typedef granny_real32 granny_matrix_4x4[4][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;
typedef enum granny_material_texture_type
{
GrannyUnknownTextureType,
GrannyAmbientColorTexture,
GrannyDiffuseColorTexture,
GrannySpecularColorTexture,
GrannySelfIlluminationTexture,
GrannyOpacityTexture,
GrannyBumpHeightTexture,
GrannyReflectionTexture,
GrannyRefractionTexture,
GrannyDisplacementTexture,
GrannyOnePastLastMaterialTextureType,
Grannymaterial_texture_type_forceint = 0x7fffffff
} granny_material_texture_type;
typedef enum granny_deformation_type
{
GrannyDeformPosition = 1,
GrannyDeformPositionNormal,
GrannyDeformPositionNormalTangent,
GrannyDeformPositionNormalTangentBinormal,
Grannydeformation_type_forceint = 0x7fffffff
} granny_deformation_type;
typedef enum granny_deformer_tail_flags
{
GrannyDontAllowUncopiedTail,
GrannyAllowUncopiedTail,
GrannyAllowUninitializedDestTail,
Grannydeformer_tail_flags_forceint = 0x7fffffff
} granny_deformer_tail_flags;
typedef enum granny_standard_section_index
{
GrannyStandardMainSection = 0,
GrannyStandardRigidVertexSection = 1,
GrannyStandardRigidIndexSection = 2,
GrannyStandardDeformableVertexSection = 3,
GrannyStandardDeformableIndexSection = 4,
GrannyStandardTextureSection = 5,
GrannyStandardDiscardableSection = 6,
GrannyStandardUnloadedSection = 7,
GrannyStandardSectionCount = 8,
Grannystandard_section_index_forceint = 0x7fffffff
} granny_standard_section_index;
typedef enum granny_log_message_type
{
GrannyIgnoredLogMessage,
GrannyNoteLogMessage,
GrannyWarningLogMessage,
GrannyErrorLogMessage,
GrannyOnePastLastMessageType,
Grannylog_message_type_forceint = 0x7fffffff
} granny_log_message_type;
typedef granny_int32 granny_log_message_origin;
#define GrannyVertexPositionName "Position"
#define GrannyVertexNormalName "Normal"
#define GrannyVertexTangentName "Tangent"
#define GrannyVertexBinormalName "Binormal"
#define GrannyVertexTangentBinormalCrossName "TangentBinormalCross"
#define GrannyVertexBoneWeightsName "BoneWeights"
#define GrannyVertexBoneIndicesName "BoneIndices"
#define GrannyVertexDiffuseColorName "DiffuseColor"
#define GrannyVertexSpecularColorName "SpecularColor"
#define GrannyVertexTextureCoordinatesName "TextureCoordinates"
#define GrannyVertexMorphCurvePrefix "VertexMorphCurve"
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_bone;
struct granny_control;
struct granny_file;
struct granny_local_pose;
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_texture;
struct granny_world_pose;
struct granny_conversion_handler;
struct granny_variant
{
granny_data_type_definition* Type;
void* Object;
};
struct granny_transform
{
granny_uint32 Flags;
granny_triple Position;
granny_quad Orientation;
granny_triple ScaleShear[3];
};
struct granny_texture
{
char const* FromFileName;
granny_int32 TextureType;
granny_int32 Width;
granny_int32 Height;
granny_int32 Encoding;
granny_int32 SubFormat;
granny_variant ExtendedData;
};
struct granny_material_map
{
char const* Usage;
granny_material* Material;
};
struct granny_material
{
char const* Name;
granny_int32 MapCount;
granny_material_map* Maps;
granny_texture* Texture;
granny_variant ExtendedData;
};
struct granny_bone
{
char const* Name;
granny_int32 ParentIndex;
granny_transform LocalTransform;
granny_matrix_4x4 InverseWorld4x4;
granny_real32 LODError;
granny_variant ExtendedData;
};
struct granny_skeleton
{
char const* Name;
granny_int32 BoneCount;
granny_bone* Bones;
granny_int32 LODType;
granny_variant ExtendedData;
};
struct granny_vertex_data
{
granny_data_type_definition* VertexType;
granny_int32 VertexCount;
granny_uint8* Vertices;
granny_int32 VertexComponentNameCount;
char const** VertexComponentNames;
};
struct granny_tri_material_group
{
granny_int32 MaterialIndex;
granny_int32 TriFirst;
granny_int32 TriCount;
};
struct granny_tri_topology
{
granny_int32 GroupCount;
granny_tri_material_group* Groups;
granny_int32 IndexCount;
granny_int32* Indices;
granny_int32 Index16Count;
granny_uint16* Indices16;
};
struct granny_material_binding
{
granny_material* Material;
};
struct granny_bone_binding
{
char const* BoneName;
granny_triple OBBMin;
granny_triple OBBMax;
granny_int32 TriangleCount;
granny_int32* TriangleIndices;
};
struct granny_mesh
{
char const* Name;
granny_vertex_data* PrimaryVertexData;
granny_int32 MorphTargetCount;
void* MorphTargets;
granny_tri_topology* PrimaryTopology;
granny_int32 MaterialBindingCount;
granny_material_binding* MaterialBindings;
granny_int32 BoneBindingCount;
granny_bone_binding* BoneBindings;
granny_variant ExtendedData;
};
struct granny_model_mesh_binding
{
granny_mesh* Mesh;
};
struct granny_model
{
char const* Name;
granny_skeleton* Skeleton;
granny_transform InitialPlacement;
granny_int32 MeshBindingCount;
granny_model_mesh_binding* MeshBindings;
granny_variant ExtendedData;
};
struct granny_text_track_entry
{
granny_real32 TimeStamp;
char const* Text;
};
struct granny_text_track
{
char const* Name;
granny_int32 EntryCount;
granny_text_track_entry* Entries;
};
struct granny_track_group
{
char const* Name;
granny_int32 TextTrackCount;
granny_text_track* TextTracks;
granny_transform InitialPlacement;
granny_int32 Flags;
granny_variant ExtendedData;
};
struct granny_animation
{
char const* Name;
granny_real32 Duration;
granny_real32 TimeStep;
granny_real32 Oversampling;
granny_int32 TrackGroupCount;
granny_track_group** TrackGroups;
granny_int32 DefaultLoopCount;
granny_int32 Flags;
granny_variant ExtendedData;
};
struct granny_file_info
{
char const* FromFileName;
granny_int32 TextureCount;
granny_texture** Textures;
granny_int32 MaterialCount;
granny_material** Materials;
granny_int32 SkeletonCount;
granny_skeleton** Skeletons;
granny_int32 MeshCount;
granny_mesh** Meshes;
granny_int32 ModelCount;
granny_model** Models;
granny_int32 AnimationCount;
granny_animation** Animations;
granny_variant ExtendedData;
};
struct granny_system_clock
{
granny_uint32 Data[4];
};
typedef void granny_log_function(granny_log_message_type Type, granny_log_message_origin Origin,
char const* File, granny_int32x Line, char const* Message, void* UserData);
struct granny_log_callback
{
granny_log_function* Function;
void* UserData;
};
extern granny_data_type_definition* GrannyPNT332VertexType;
// Files
granny_file* GrannyReadEntireFileFromMemory(granny_int32x MemorySize, void const* Memory);
granny_file_info* GrannyGetFileInfo(granny_file* File);
void GrannyFreeFile(granny_file* File);
void GrannyFreeFileSection(granny_file* File, granny_int32x SectionIndex);
void GrannySetLogCallback(granny_log_callback const* LogCallback);
// Data types
granny_int32x GrannyGetTotalTypeSize(granny_data_type_definition const* TypeDefinition);
bool GrannyFindMatchingMember(granny_data_type_definition const* SourceType, void const* SourceObject,
char const* DestMemberName, granny_variant* Result);
void GrannyConvertSingleObject(granny_data_type_definition const* SourceType, void const* SourceObject,
granny_data_type_definition const* DestType, void* DestObject,
granny_conversion_handler* OverrideHandler);
// Materials, skeletons, meshes
granny_texture* GrannyGetMaterialTextureByType(granny_material const* Material, granny_material_texture_type Type);
bool GrannyFindBoneByName(granny_skeleton const* Skeleton, char const* BoneName, granny_int32x* BoneIndex);
bool GrannyMeshIsRigid(granny_mesh const* Mesh);
granny_int32x GrannyGetMeshVertexCount(granny_mesh const* Mesh);
granny_data_type_definition* GrannyGetMeshVertexType(granny_mesh const* Mesh);
void* GrannyGetMeshVertices(granny_mesh const* Mesh);
void GrannyCopyMeshVertices(granny_mesh const* Mesh, granny_data_type_definition const* VertexType, void* DestVertices);
granny_int32x GrannyGetMeshIndexCount(granny_mesh const* Mesh);
void GrannyCopyMeshIndices(granny_mesh const* Mesh, granny_int32x BytesPerIndex, void* DestIndices);
granny_int32x GrannyGetMeshTriangleGroupCount(granny_mesh const* Mesh);
granny_tri_material_group* GrannyGetMeshTriangleGroups(granny_mesh const* Mesh);
// Mesh binding and deformation
granny_mesh_binding* GrannyNewMeshBinding(granny_mesh const* Mesh, granny_skeleton const* FromSkeleton, granny_skeleton const* ToSkeleton);
void GrannyFreeMeshBinding(granny_mesh_binding* Binding);
granny_int32x const* GrannyGetMeshBindingToBoneIndices(granny_mesh_binding const* Binding);
granny_mesh_deformer* GrannyNewMeshDeformer(granny_data_type_definition const* InputVertexLayout,
granny_data_type_definition const* OutputVertexLayout,
granny_deformation_type DeformationType, granny_deformer_tail_flags TailFlag);
void GrannyFreeMeshDeformer(granny_mesh_deformer* Deformer);
void GrannyDeformVertices(granny_mesh_deformer const* Deformer, granny_int32x const* MatrixIndices,
granny_real32 const* MatrixBuffer4x4, granny_int32x VertexCount,
void const* SourceVertices, void* DestVertices);
// Model instances and controls
granny_model_instance* GrannyInstantiateModel(granny_model const* Model);
void GrannyFreeModelInstance(granny_model_instance* ModelInstance);
granny_skeleton* GrannyGetSourceSkeleton(granny_model_instance const* Model);
void GrannySetModelClock(granny_model_instance const* ModelInstance, granny_real32 NewClock);
void GrannyFreeCompletedModelControls(granny_model_instance const* ModelInstance);
void GrannyUpdateModelMatrix(granny_model_instance const* ModelInstance, granny_real32 SecondsElapsed,
granny_real32 const* ModelMatrix4x4, granny_real32* DestMatrix4x4, bool Inverse);
granny_control* GrannyPlayControlledAnimation(granny_real32 StartTime, granny_animation const* Animation, granny_model_instance* Model);
void GrannyFreeControl(granny_control* Control);
void GrannyFreeControlOnceUnused(granny_control* Control);
bool GrannyFreeControlIfComplete(granny_control* Control);
bool GrannyControlIsComplete(granny_control const* Control);
void GrannyCompleteControlAt(granny_control* Control, granny_real32 AtSeconds);
void GrannySetControlSpeed(granny_control* Control, granny_real32 Speed);
granny_real32 GrannyGetControlSpeed(granny_control const* Control);
void GrannySetControlLoopCount(granny_control* Control, granny_int32x LoopCount);
granny_int32x GrannyGetControlLoopCount(granny_control const* Control);
void GrannySetControlRawLocalClock(granny_control* Control, granny_real32 LocalClock);
granny_real32 GrannyGetControlRawLocalClock(granny_control* Control);
granny_real32 GrannyGetControlLocalDuration(granny_control const* Control);
void GrannySetControlEaseIn(granny_control* Control, bool EaseIn);
void GrannySetControlEaseOut(granny_control* Control, bool EaseOut);
void GrannySetControlEaseInCurve(granny_control* Control, granny_real32 StartSeconds, granny_real32 EndSeconds,
granny_real32 StartValue, granny_real32 StartTangent, granny_real32 EndTangent, granny_real32 EndValue);
void GrannySetControlEaseOutCurve(granny_control* Control, granny_real32 StartSeconds, granny_real32 EndSeconds,
granny_real32 StartValue, granny_real32 StartTangent, granny_real32 EndTangent, granny_real32 EndValue);
// Poses
granny_local_pose* GrannyNewLocalPose(granny_int32x BoneCount);
void GrannyFreeLocalPose(granny_local_pose* LocalPose);
granny_world_pose* GrannyNewWorldPose(granny_int32x BoneCount);
void GrannyFreeWorldPose(granny_world_pose* WorldPose);
void GrannySampleModelAnimationsAccelerated(granny_model_instance const* ModelInstance, granny_int32x BoneCount,
granny_real32 const* Offset4x4, granny_local_pose* Scratch, granny_world_pose* Result);
granny_real32* GrannyGetWorldPose4x4(granny_world_pose const* WorldPose, granny_int32x BoneIndex);
granny_real32* GrannyGetWorldPoseComposite4x4(granny_world_pose const* WorldPose, granny_int32x BoneIndex);
granny_matrix_4x4* GrannyGetWorldPoseComposite4x4Array(granny_world_pose const* WorldPose);
+53
View File
@@ -0,0 +1,53 @@
#pragma once
// DevIL interface needed by 40250 app.GetImageInfo / MarkImage / GuildMarkUploader.
typedef unsigned int ILenum;
typedef unsigned char ILboolean;
typedef unsigned int ILbitfield;
typedef char ILbyte;
typedef short ILshort;
typedef int ILint;
typedef int ILsizei;
typedef unsigned char ILubyte;
typedef unsigned short ILushort;
typedef unsigned int ILuint;
typedef float ILfloat;
typedef double ILdouble;
typedef void ILvoid;
typedef const char* ILstring;
#define IL_FALSE 0
#define IL_TRUE 1
#define IL_RGB 0x1907
#define IL_RGBA 0x1908
#define IL_BGRA 0x80E1
#define IL_BYTE 0x1400
#define IL_UNSIGNED_BYTE 0x1401
#define IL_TYPE_UNKNOWN 0x0000
#define IL_TGA 0x042D
#define IL_ORIGIN_SET 0x0600
#define IL_ORIGIN_UPPER_LEFT 0x0602
#define IL_FILE_OVERWRITE 0x0DE3
#define IL_IMAGE_WIDTH 0x0DE4
#define IL_IMAGE_HEIGHT 0x0DE5
void ilInit();
void ilShutDown();
void ilEnable(ILenum mode);
void ilDisable(ILenum mode);
void ilOriginFunc(ILenum mode);
void ilGenImages(ILsizei count, ILuint* images);
void ilBindImage(ILuint image);
void ilDeleteImages(ILsizei count, const ILuint* images);
bool ilLoad(ILenum type, const ILstring filename);
bool ilSave(ILenum type, const ILstring filename);
int ilGetInteger(ILenum mode);
bool ilConvertImage(ILenum destFormat, ILenum destType);
bool ilTexImage(ILuint width, ILuint height, ILuint depth, ILubyte bpp, ILenum format, ILenum type, void* data);
ILuint ilCopyPixels(ILuint xOff, ILuint yOff, ILuint zOff, ILuint width, ILuint height, ILuint depth, ILenum format, ILenum type, void* data);
void ilSetPixels(ILint xOff, ILint yOff, ILint zOff, ILuint width, ILuint height, ILuint depth, ILenum format, ILenum type, void* data);
@@ -0,0 +1,3 @@
#pragma once
// Shim for 40250's <lzo/lzoLibLink.h>, which only holds MSVC `#pragma comment(lib, ...)` auto-link lines;
// the vendored minilzo (mt3p::minilzo) is linked by CMake.
+26
View File
@@ -0,0 +1,26 @@
#pragma once
// Shim for Miles Sound System <mss.h>: the scalar types and opaque handles 40250's MilesLib
// headers name. Playback goes through platform/, never through these declarations.
#include "../../Win32Types.h"
typedef int32_t S32;
typedef uint32_t U32;
typedef float F32;
typedef int16_t S16;
typedef uint16_t U16;
typedef int8_t S8;
typedef uint8_t U8;
#define AILCALLBACK
#define AILEXPORT
struct _SAMPLE;
struct _STREAM;
struct _DIG_DRIVER;
struct _H3DSAMPLE;
typedef _SAMPLE* HSAMPLE;
typedef _STREAM* HSTREAM;
typedef _DIG_DRIVER* HDIGDRIVER;
typedef void* H3DPOBJECT;
typedef H3DPOBJECT H3DSAMPLE;
typedef U32 HPROVIDER;
+7
View File
@@ -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;
+128
View File
@@ -0,0 +1,128 @@
#pragma once
// 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;
// DirectInput scan codes used by PythonApplicationModule.cpp, from mingw-w64 dinput.h.
#define DIK_0 0x0B
#define DIK_1 0x02
#define DIK_2 0x03
#define DIK_3 0x04
#define DIK_4 0x05
#define DIK_5 0x06
#define DIK_6 0x07
#define DIK_7 0x08
#define DIK_8 0x09
#define DIK_9 0x0A
#define DIK_A 0x1E
#define DIK_ADD 0x4E
#define DIK_APOSTROPHE 0x28
#define DIK_APPS 0xDD
#define DIK_B 0x30
#define DIK_BACK 0x0E
#define DIK_BACKSLASH 0x2B
#define DIK_C 0x2E
#define DIK_CALCULATOR 0xA1
#define DIK_CAPITAL 0x3A
#define DIK_COMMA 0x33
#define DIK_D 0x20
#define DIK_DECIMAL 0x53
#define DIK_DELETE 0xD3
#define DIK_DIVIDE 0xB5
#define DIK_DOWN 0xD0
#define DIK_E 0x12
#define DIK_END 0xCF
#define DIK_EQUALS 0x0D
#define DIK_ESCAPE 0x01
#define DIK_F 0x21
#define DIK_F1 0x3B
#define DIK_F10 0x44
#define DIK_F11 0x57
#define DIK_F12 0x58
#define DIK_F2 0x3C
#define DIK_F3 0x3D
#define DIK_F4 0x3E
#define DIK_F5 0x3F
#define DIK_F6 0x40
#define DIK_F7 0x41
#define DIK_F8 0x42
#define DIK_F9 0x43
#define DIK_G 0x22
#define DIK_GRAVE 0x29
#define DIK_H 0x23
#define DIK_HOME 0xC7
#define DIK_I 0x17
#define DIK_INSERT 0xD2
#define DIK_J 0x24
#define DIK_K 0x25
#define DIK_L 0x26
#define DIK_LBRACKET 0x1A
#define DIK_LCONTROL 0x1D
#define DIK_LEFT 0xCB
#define DIK_LMENU 0x38
#define DIK_LSHIFT 0x2A
#define DIK_LWIN 0xDB
#define DIK_M 0x32
#define DIK_MEDIASTOP 0xA4
#define DIK_MINUS 0x0C
#define DIK_MULTIPLY 0x37
#define DIK_MUTE 0xA0
#define DIK_N 0x31
#define DIK_NEXT 0xD1
#define DIK_NEXTTRACK 0x99
#define DIK_NUMLOCK 0x45
#define DIK_NUMPAD0 0x52
#define DIK_NUMPAD1 0x4F
#define DIK_NUMPAD2 0x50
#define DIK_NUMPAD3 0x51
#define DIK_NUMPAD4 0x4B
#define DIK_NUMPAD5 0x4C
#define DIK_NUMPAD6 0x4D
#define DIK_NUMPAD7 0x47
#define DIK_NUMPAD8 0x48
#define DIK_NUMPAD9 0x49
#define DIK_NUMPADCOMMA 0xB3
#define DIK_NUMPADENTER 0x9C
#define DIK_O 0x18
#define DIK_P 0x19
#define DIK_PAUSE 0xC5
#define DIK_PERIOD 0x34
#define DIK_PLAYPAUSE 0xA2
#define DIK_PRIOR 0xC9
#define DIK_Q 0x10
#define DIK_R 0x13
#define DIK_RBRACKET 0x1B
#define DIK_RCONTROL 0x9D
#define DIK_RETURN 0x1C
#define DIK_RIGHT 0xCD
#define DIK_RMENU 0xB8
#define DIK_RSHIFT 0x36
#define DIK_RWIN 0xDC
#define DIK_S 0x1F
#define DIK_SCROLL 0x46
#define DIK_SEMICOLON 0x27
#define DIK_SLASH 0x35
#define DIK_SPACE 0x39
#define DIK_SUBTRACT 0x4A
#define DIK_SYSRQ 0xB7
#define DIK_T 0x14
#define DIK_TAB 0x0F
#define DIK_U 0x16
#define DIK_UP 0xC8
#define DIK_V 0x2F
#define DIK_VOLUMEDOWN 0xAE
#define DIK_VOLUMEUP 0xB0
#define DIK_W 0x11
#define DIK_WEBHOME 0xB2
#define DIK_X 0x2D
#define DIK_Y 0x15
#define DIK_Z 0x2C
+8
View File
@@ -0,0 +1,8 @@
#pragma once
// Shim for <direct.h> on non-Windows targets; what 40250 logic uses from it is in <windows.h>.
#include "windows.h"
#ifndef _MSC_VER
#include <unistd.h>
#define _getcwd getcwd
#define _chdir chdir
#endif
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Shim for <imagehlp.h> on non-Windows targets; what 40250 logic uses from it is in <windows.h>.
#include "windows.h"
+11
View File
@@ -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;
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Shim for <io.h> on non-Windows targets; what 40250 logic uses from it (_access) is in <windows.h>.
#include "windows.h"
+8
View File
@@ -0,0 +1,8 @@
#pragma once
// Shim for MSVC <malloc.h> on non-Windows targets. Linux/Android ship a <malloc.h> that their
// <stdlib.h> itself includes, so defer to it; macOS has none.
#if __has_include_next(<malloc.h>)
#include_next <malloc.h>
#else
#include <stdlib.h>
#endif
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Shim for <mmsystem.h> on non-Windows targets; what 40250 logic uses from it is in <windows.h>.
#include "windows.h"
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Shim for <process.h> on non-Windows targets; what 40250 logic uses from it is in <windows.h>.
#include "windows.h"
+12
View File
@@ -0,0 +1,12 @@
#pragma once
// Win32 shell-folder API used only by the screenshot command in grp.
#include <windows.h>
#define CSIDL_PERSONAL 0x0005
inline BOOL SHGetSpecialFolderPath(void*, char* path, int, BOOL)
{
if (path)
path[0] = '\0';
return FALSE;
}
+48
View File
@@ -0,0 +1,48 @@
#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), plus the headers the real one pulls
// in that 40250 relies on transitively (winnt.h brings <string.h> for memcpy/memset, and <wchar.h>
// for wcslen).
#include <string.h>
#include <wchar.h>
#include "../../Win32Types.h"
#include "../../Win32Crt.h"
#include "wingdi.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
#define FAR
#define VK_LEFT 0x25
#define VK_UP 0x26
#define VK_RIGHT 0x27
#define VK_DOWN 0x28
#define VK_HOME 0x24
#define VK_END 0x23
#define VK_DELETE 0x2E
#define VK_BACK 0x08
#define VK_TAB 0x09
#define VK_RETURN 0x0D
#define VK_ESCAPE 0x1B
#define WM_KEYDOWN 0x0100
#define WM_CHAR 0x0102
#define SM_CXFULLSCREEN 16
#define SM_CYFULLSCREEN 17
inline int GetSystemMetrics(int nIndex)
{
if (nIndex == SM_CXFULLSCREEN) return 1920;
if (nIndex == SM_CYFULLSCREEN) return 1080;
return 0;
}
// winuser.h functions the platform layer implements (platform/ScriptLib/PythonBoot.cpp).
void PostQuitMessage(int nExitCode);
+2
View File
@@ -0,0 +1,2 @@
#pragma once
#include <windows.h>
+64
View File
@@ -0,0 +1,64 @@
#pragma once
// Shim for the <wingdi.h> subset the 40250 font path uses (EterLib/GrpDIB, GrpFontTexture, Util).
// The calls are implemented by the platform layer over FreeType (platform/Win32Gdi.cpp): one DIB
// per memory DC, glyphs rendered the way GDI lays out a TrueType face for a LOGFONT cell height.
#include "../../Win32Types.h"
typedef DWORD COLORREF;
typedef void* HGDIOBJ;
#define RGB(r, g, b) ((COLORREF)(((BYTE)(r) | ((WORD)((BYTE)(g)) << 8)) | (((DWORD)(BYTE)(b)) << 16)))
typedef struct _ABCFLOAT
{
FLOAT abcfA;
FLOAT abcfB;
FLOAT abcfC;
} ABCFLOAT, *LPABCFLOAT;
#define TRANSPARENT 1
#define OPAQUE 2
#define FW_NORMAL 400
#define FW_BOLD 700
#define OUT_DEFAULT_PRECIS 0
#define CLIP_DEFAULT_PRECIS 0
#define DEFAULT_QUALITY 0
#define NONANTIALIASED_QUALITY 3
#define ANTIALIASED_QUALITY 4
#define DEFAULT_PITCH 0
#define ANSI_CHARSET 0
#define DEFAULT_CHARSET 1
#define SHIFTJIS_CHARSET 128
#define HANGUL_CHARSET 129
#define GB2312_CHARSET 134
#define CHINESEBIG5_CHARSET 136
#define GREEK_CHARSET 161
#define TURKISH_CHARSET 162
#define VIETNAMESE_CHARSET 163
#define HEBREW_CHARSET 177
#define ARABIC_CHARSET 178
#define BALTIC_CHARSET 186
#define RUSSIAN_CHARSET 204
#define THAI_CHARSET 222
#define EASTEUROPE_CHARSET 238
#define BI_RGB 0L
#define DIB_RGB_COLORS 0
HDC CreateCompatibleDC(HDC hdc);
BOOL DeleteDC(HDC hdc);
HBITMAP CreateDIBSection(HDC hdc, const BITMAPINFO* pbmi, UINT usage, void** ppvBits, HANDLE hSection, DWORD offset);
int SetDIBitsToDevice(HDC hdc, int xDest, int yDest, DWORD w, DWORD h, int xSrc, int ySrc, UINT StartScan,
UINT cLines, const void* lpvBits, const BITMAPINFO* lpbmi, UINT ColorUse);
HFONT CreateFontIndirect(const LOGFONT* lplf);
BOOL DeleteObject(HGDIOBJ ho);
HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h);
COLORREF SetTextColor(HDC hdc, COLORREF color);
COLORREF SetBkColor(HDC hdc, COLORREF color);
int SetBkMode(HDC hdc, int mode);
BOOL GetTextExtentPoint32W(HDC hdc, LPCWSTR lpString, int c, LPSIZE psizl);
BOOL GetCharABCWidthsFloatW(HDC hdc, UINT iFirst, UINT iLast, LPABCFLOAT lpABC);
BOOL TextOutW(HDC hdc, int x, int y, LPCWSTR lpString, int c);
BOOL TextOutA(HDC hdc, int x, int y, LPCSTR lpString, int c);
#define TextOut TextOutA
+89
View File
@@ -0,0 +1,89 @@
#pragma once
// Shim for <winsock.h> on non-Windows targets: the BSD socket API under its Winsock names, with the
// Winsock semantics 40250 relies on where the two differ (see the notes on each function).
#include "windows.h"
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <unistd.h>
typedef int SOCKET;
typedef struct sockaddr SOCKADDR;
typedef struct sockaddr* PSOCKADDR;
typedef struct sockaddr_in SOCKADDR_IN;
typedef struct in_addr IN_ADDR;
typedef struct timeval TIMEVAL;
typedef struct hostent HOSTENT;
#define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-1)
#define WSAEWOULDBLOCK EWOULDBLOCK
typedef struct WSAData
{
WORD wVersion;
WORD wHighVersion;
} WSADATA;
// There is no Winsock DLL to start. A send on a socket the peer has closed raises SIGPIPE on POSIX
// where Winsock returns an error, so the process ignores it from here on.
inline int WSAStartup(WORD version, WSADATA* data)
{
signal(SIGPIPE, SIG_IGN);
if (data)
data->wVersion = data->wHighVersion = version;
return 0;
}
inline int WSACleanup() { return 0; }
// A non-blocking connect() answers WSAEWOULDBLOCK on Winsock and EINPROGRESS on POSIX.
inline int WSAGetLastError() { return errno == EINPROGRESS ? WSAEWOULDBLOCK : errno; }
inline int closesocket(SOCKET s) { return close(s); }
inline int ioctlsocket(SOCKET s, long cmd, DWORD* argp)
{
int value = static_cast<int>(*argp);
return ioctl(s, static_cast<unsigned long>(cmd), &value);
}
// Winsock ignores nfds, and a socket whose connect failed is reported only in exceptfds; POSIX needs
// nfds and marks such a socket writable. Callers pass 0 and treat "writable" as "connected"
// (CNetworkStream::Process), so writable sockets without a peer are dropped from the write set.
inline int mt_winsock_select(fd_set* readfds, fd_set* writefds, fd_set* exceptfds, TIMEVAL* timeout)
{
int ret = ::select(FD_SETSIZE, readfds, writefds, exceptfds, timeout);
if (ret <= 0 || !writefds)
return ret;
for (int fd = 0; fd < FD_SETSIZE; ++fd)
{
if (!FD_ISSET(fd, writefds))
continue;
sockaddr_in peer;
socklen_t len = sizeof(peer);
if (getpeername(fd, reinterpret_cast<sockaddr*>(&peer), &len) != 0)
FD_CLR(fd, writefds);
}
return ret;
}
#define select(nfds, readfds, writefds, exceptfds, timeout) mt_winsock_select(readfds, writefds, exceptfds, timeout)
inline int mt_winsock_recvfrom(SOCKET s, void* buf, size_t len, int flags, struct sockaddr* from, int* fromlen)
{
socklen_t slen = fromlen ? static_cast<socklen_t>(*fromlen) : 0;
ssize_t ret = ::recvfrom(s, buf, len, flags, from, fromlen ? &slen : nullptr);
if (fromlen)
*fromlen = static_cast<int>(slen);
return static_cast<int>(ret);
}
inline int mt_winsock_recvfrom(SOCKET s, void* buf, size_t len, int flags, struct sockaddr* from, socklen_t* fromlen)
{
return static_cast<int>(::recvfrom(s, buf, len, flags, from, fromlen));
}
#define recvfrom mt_winsock_recvfrom