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:
shenlei
2026-09-22 20:27:57 +09:00
co-authored by Claude Opus 5
parent 0f2eee0b24
commit fc47582017
98 changed files with 7645 additions and 41 deletions
+143
View File
@@ -0,0 +1,143 @@
#ifndef AFX_IMAGE_DXTC_H__4B89D8D0_7857_11D4_9630_00A0C996DE3D__INCLUDED_
#define AFX_IMAGE_DXTC_H__4B89D8D0_7857_11D4_9630_00A0C996DE3D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
enum EPixFormat
{
PF_ARGB,
PF_DXT1,
PF_DXT2,
PF_DXT3,
PF_DXT4,
PF_DXT5,
PF_UNKNOWN
};
#define MAX_MIPLEVELS 12
#ifndef DUMMYUNIONNAMEN
#if defined(__cplusplus) || !defined(NONAMELESSUNION)
#define DUMMYUNIONNAMEN(n)
#else
#define DUMMYUNIONNAMEN(n) u##n
#endif
#endif
typedef struct _XDDPIXELFORMAT
{
DWORD dwSize; // size of structure
DWORD dwFlags; // pixel format flags
DWORD dwFourCC; // (FOURCC code)
union
{
DWORD dwRGBBitCount; // how many bits per pixel
DWORD dwYUVBitCount; // how many bits per pixel
DWORD dwZBufferBitDepth; // how many total bits/pixel in z buffer (including any stencil bits)
DWORD dwAlphaBitDepth; // how many bits for alpha channels
DWORD dwLuminanceBitCount; // how many bits per pixel
DWORD dwBumpBitCount; // how many bits per "buxel", total
DWORD dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture
// format list and if DDPF_D3DFORMAT is set
} DUMMYUNIONNAMEN(1);
union
{
DWORD dwRBitMask; // mask for red bit
DWORD dwYBitMask; // mask for Y bits
DWORD dwStencilBitDepth; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
DWORD dwLuminanceBitMask; // mask for luminance bits
DWORD dwBumpDuBitMask; // mask for bump map U delta bits
DWORD dwOperations; // DDPF_D3DFORMAT Operations
} DUMMYUNIONNAMEN(2);
union
{
DWORD dwGBitMask; // mask for green bits
DWORD dwUBitMask; // mask for U bits
DWORD dwZBitMask; // mask for Z bits
DWORD dwBumpDvBitMask; // mask for bump map V delta bits
struct
{
WORD wFlipMSTypes; // Multisample methods supported via flip for this D3DFORMAT
WORD wBltMSTypes; // Multisample methods supported via blt for this D3DFORMAT
} MultiSampleCaps;
} DUMMYUNIONNAMEN(3);
union
{
DWORD dwBBitMask; // mask for blue bits
DWORD dwVBitMask; // mask for V bits
DWORD dwStencilBitMask; // mask for stencil bits
DWORD dwBumpLuminanceBitMask; // mask for luminance in bump map
} DUMMYUNIONNAMEN(4);
union
{
DWORD dwRGBAlphaBitMask; // mask for alpha channel
DWORD dwYUVAlphaBitMask; // mask for alpha channel
DWORD dwLuminanceAlphaBitMask;// mask for alpha channel
DWORD dwRGBZBitMask; // mask for Z channel
DWORD dwYUVZBitMask; // mask for Z channel
} DUMMYUNIONNAMEN(5);
} XDDPIXELFORMAT;
class CDXTCImage
{
public:
CDXTCImage();
virtual ~CDXTCImage();
void Initialize();
void Clear();
public:
const BYTE * m_pbCompBufferByLevels[MAX_MIPLEVELS];
std::vector<BYTE> m_bCompVector[MAX_MIPLEVELS];
int m_nCompSize;
int m_nCompLineSz;
char m_strFormat[32];
EPixFormat m_CompFormat;
long m_lPitch;
DWORD m_dwMipMapCount;
bool m_bMipTexture; // texture has mipmaps?
DWORD m_dwFlags;
int m_nWidth; // in pixels of uncompressed image
int m_nHeight;
XDDPIXELFORMAT m_xddPixelFormat;
bool LoadFromFile(const char * filename); // true if success
bool LoadFromMemory(const BYTE * c_pbMap);
bool LoadHeaderFromMemory(const BYTE * c_pbMap);
bool Copy(int miplevel, BYTE * pbDest, long lDestPitch);
void Decompress(int miplevel, DWORD * pdwDest);
void DecompressDXT1(int miplevel, DWORD * pdwDest);
void DecompressDXT3(int miplevel, DWORD * pdwDest);
void DecompressDXT5(int miplevel, DWORD * pdwDest);
void DecompressARGB(int miplevel, DWORD * pdwDest);
VOID DecodePixelFormat(CHAR* strPixelFormat, XDDPIXELFORMAT* pddpf);
void Unextract(BYTE * pbDest, int iWidth, int iHeight, int iPitch);
/*
struct TimingInfo; // defined in Image_DXTC.cpp
void RunTimingSession(); // run a few methods & time the code
// must use dxt5 texture
void Time_Decomp5_01(int ntimes, TimingInfo * info);
void Time_Decomp5_02(int ntimes, TimingInfo * info);
void Time_Decomp5_03(int ntimes, TimingInfo * info);
void Time_Decomp5_04(int ntimes, TimingInfo * info);
*/
};
#endif // #ifndef AFX_IMAGE_DXTC_H__4B89D8D0_7857_11D4_9630_00A0C996DE3D__INCLUDED_
+48
View File
@@ -0,0 +1,48 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__BCF68E23_E7D8_4BF3_A905_AFDBEF92B0F6__INCLUDED_)
#define AFX_STDAFX_H__BCF68E23_E7D8_4BF3_A905_AFDBEF92B0F6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#pragma warning(disable:4786)
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
//#include <crtdbg.h>
#include <windows.h>
#include <assert.h>
#pragma warning(push, 3)
#include <string>
#include <vector>
#pragma warning(pop)
inline void _TraceForImage(const char* c_szFormat, ...)
{
va_list args;
va_start(args, c_szFormat);
static char szBuf[1024];
_vsnprintf(szBuf, sizeof(szBuf), c_szFormat, args);
#ifdef _DEBUG
OutputDebugString(szBuf);
#endif
va_end(args);
printf(szBuf);
}
#pragma warning(default:4018)
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__BCF68E23_E7D8_4BF3_A905_AFDBEF92B0F6__INCLUDED_)