Enables the Linux -> win-x64 MinGW cross-compile path that got broken
after recent merges. Still INCOMPLETE — build fails later at missing
DirectX IME headers (DIMM.h) and likely more vendor SDK compat issues.
Commit captures the mechanical fixes so Jakub can adopt/iterate.
Changes:
1. toolchains/linux-mingw64.cmake — MinGW cross-compile toolchain
(Windows x86_64 target, mingw-w64 gcc/g++/windres, lld linker).
2. CMakeLists.txt:
- MSVC-only flags (/MP, /Zi, /DEBUG linker flag) gated behind
if(MSVC) — they break MinGW gcc which treats /MP as filename.
- UNICODE / _UNICODE defined globally (was inside if(MSVC), but
WIN32_FIND_DATA etc. need it everywhere).
- __int64 -> long long compile definition for non-MSVC compilers
so the Granny SDK header parses.
- -mssse3 compile option for non-MSVC so _mm_shuffle_epi8 in
EterLib/GrpImageTexture.cpp inlines correctly.
3. Include fixes for Linux case-sensitive filesystem and stricter
GCC standard library:
- Poly/StdAfx.h: backslash in include path -> forward slash.
- EterBase/Stl.h: <SSTREAM> -> <sstream>.
- EterBase/Utils.h: add <cmath> so cos() in templates resolves.
- AudioLib/MaSoundInstance.h: add <cstdint> so uint8_t vector
template argument is valid.
- AudioLib/Type.h: add <cstdint> for uint32_t.
- extern/include/utf8.h: add <cstdint> for uint8_t/uint16_t.
- EffectLib/Type.h: typedef typename std::vector<...>::iterator
(dependent-name C++11+ compliance).
Not committed (needs manual recreation per checkout, or git-tracking
them needs buy-in):
- 60+ stdafx case-variant symlinks (stdafx.h, StdAfx.h, Stdafx.h)
- 7 directory case symlinks (Eterlib, eterLib, eterBase, Gamelib,
gamelib, Eterbase, eterbase)
- header case-variant symlinks in individual dirs
Still failing at:
- src/EterLib/IME.h:7 wanting DIMM.h (DirectX IME, not in extern/
and not shipped with mingw-w64). Needs either a shim header, a
#ifdef _MSC_VER guard, or vendoring the Microsoft DirectX IME SDK.
Work done over ~2h trying to get a fresh release cycle through from
Linux. Stopping here because each fix exposes another vendor/compat
issue that benefits from Jakub's context of the build history.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Loads packs one by one so that duplicate file resolution
follows a deterministic order (last pack wins). Parallel loading made
the effective order depend on lock acquisition order, allowing older
packs to override newer ones. Sequential load stays under ~1s (~350ms
on typical hardware), so the performance tradeoff is considered acceptable.
- Guard leaf LOD access in CSpeedTreeWrapper::RenderLeaves() to avoid out-of-bounds indexing of m_pLeafVertexBuffer and m_pLeavesUpdatedByCpu.
- Skip leaf update/draw when LOD is invalid, inactive, empty, or has no vertex buffer.
- Add early safety returns for missing leaf buffer arrays and zero LOD count.
- Guard CSpeedTreeWrapper::EndLeafForTreeType() against null m_pLeavesUpdatedByCpu.
- Add shader re-init path in wrapper render entrypoints via CSpeedTreeForestDirectX8::EnsureVertexShaders() when cached shader state is missing.
- Introduce public EnsureVertexShaders() in SpeedTreeForestDirectX8 while keeping InitVertexShaders() private (resolves private-access compile error).
- Fix leaf shader input declaration to emit dcl_texcoord2 v9 for both GPU wind and GPU leaf placement configurations.
- Make LoadLeafShader() atomic: create new shader/decl first, then swap only if both succeed, preserving previous valid shader state on failure.
- Improve leaf shader failure logs to include HRESULT for easier diagnosis.
Unhandled exception at 0x00007FF9433E8B9C (KERNELBASE.dll) in metin2client__20260215_143044.dmp: 0xE06D7363: Microsoft C++ Exception (parameters: 0x0000000019930520, 0x0000001E1CF2CF80, 0x00007FF698014258, 0x00007FF696940000).
[External Code]
> Metin2_Debug.exe!std::filesystem::_Throw_fs_error(const char * _Op, const std::error_code & _Error, const std::filesystem::path & _Path1) Line 1863 C++
Metin2_Debug.exe!std::filesystem::exists(const std::filesystem::path & _Target) Line 3463 C++
Metin2_Debug.exe!CPackManager::IsExist(std::basic_string_view<char,std::char_traits<char>> path) Line 95 C++
Metin2_Debug.exe!CResourceManager::IsFileExist(const char * c_szFileName) Line 498 C++
Metin2_Debug.exe!CArea::__SetObjectInstance_SetBuilding(CArea::SObjectInstance * pObjectInstance, const CArea::SObjectData * c_pData, CProperty * pProperty) Line 599 C++
Metin2_Debug.exe!CArea::__SetObjectInstance(CArea::SObjectInstance * pObjectInstance, const CArea::SObjectData * c_pData) Line 479 C++
Metin2_Debug.exe!CArea::__Load_BuildObjectInstances() Line 449 C++
Metin2_Debug.exe!CArea::Load(const char * c_szPathName) Line 750 C++
Metin2_Debug.exe!CMapOutdoor::LoadArea(unsigned short wAreaCoordX, unsigned short wAreaCoordY, unsigned short wCellCoordX, unsigned short wCellCoordY) Line 173 C++
Metin2_Debug.exe!CMapOutdoor::Update(float fX, float fY, float fZ) Line 103 C++
Metin2_Debug.exe!CMapOutdoor::Load(float x, float y, float z) Line 40 C++
Metin2_Debug.exe!CMapManager::LoadMap(const std::string & c_rstrMapName, float x, float y, float z) Line 124 C++
Metin2_Debug.exe!CPythonBackground::Warp(unsigned long dwX, unsigned long dwY) Line 744 C++
Metin2_Debug.exe!CPythonNetworkStream::Warp(long lGlobalX, long lGlobalY) Line 374 C++
Metin2_Debug.exe!netWarp(_object * poSelf, _object * poArgs) Line 81 C++
[External Code]
Metin2_Debug.exe!CPythonLauncher::RunFile(const char * c_szFileName) Line 319 C++
Metin2_Debug.exe!RunMainScript(CPythonLauncher & pyLauncher, const char * lpCmdLine) Line 246 C++
Metin2_Debug.exe!Main(HINSTANCE__ * hInstance, char * lpCmdLine) Line 302 C++
Metin2_Debug.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 329 C++
[External Code]
+ this 0x0000001e1cf2f6a0 {m_load_from_pack=true m_entries={ size=50983 } m_pBufferPool=0x0000001e1d03b350 {...} ...} const CPackManager *
buf <Unable to read memory>
+ path "d:/ymir work/zone/b/obj/general_obj_stone19_lod_01.gr2" std::basic_string_view<char,std::char_traits<char>>
Fix for:
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1179, in exec_module
File "<frozen site>", line 723, in <module>
File "<frozen site>", line 709, in main
File "<frozen site>", line 382, in addusersitepackages
File "<frozen site>", line 254, in addsitedir
File "<frozen site>", line 197, in addpackage
LookupError: unknown encoding: utf-8-sig