Commit Graph

17 Commits

Author SHA1 Message Date
Koray
cd2529ee15 prevent leaf render AV and harden leaf shader setup for speedtree
- 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.
2026-02-15 16:03:18 +03:00
Koray
cfe3c3cb7c Fix SpeedTree LOD strip handling to render all strips per LOD 2026-02-15 15:40:54 +03:00
Koray
219cf7e624 fix speedtree crash
Unhandled exception at 0x00007FF6DBFC5EB1 (Metin2_Debug.exe) in metin2client__20260215_142707.dmp: 0xC0000005: Access violation reading location 0x0000000000000000.

>	Metin2_Debug.exe!LoadLeafShader(IDirect3DDevice9 * pDx, IDirect3DVertexDeclaration9 * & pVertexDecl, IDirect3DVertexShader9 * & pVertexShader) Line 290	C++
 	Metin2_Debug.exe!CSpeedTreeForestDirectX8::InitVertexShaders() Line 70	C++
 	Metin2_Debug.exe!CSpeedTreeForestDirectX8::SetRenderingDevice(IDirect3DDevice9 * lpDevice) Line 85	C++
 	Metin2_Debug.exe!CMapOutdoor::Load(float x, float y, float z) Line 38	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]
 	[Frames may be missing, no binary loaded for kernel32.dll]
 	[External Code]

+		leafVertexDecl	0x000000dff7aed768 {{Stream=0 Offset=0 Type=2 '\x2' ...}, {Stream=0 Offset=12 Type=4 '\x4' ...}, {Stream=...}, ...}	const _D3DVERTEXELEMENT9[5]
+		pCode	0x0000000000000000 <NULL>	ID3DXBuffer *
+		pDx	0x000000dfbdbc37c0 {...}	IDirect3DDevice9 *
+		pError	0x0000000000000000 <NULL>	ID3DXBuffer *
+		pVertexDecl	0x0000000000000000 <NULL>	IDirect3DVertexDeclaration9 * &
+		pVertexShader	0x0000000000000000 <NULL>	IDirect3DVertexShader9 * &
2026-02-15 14:31:32 +03:00
Koray
9a896f982d fix rare crash after char select 2026-02-10 14:37:38 +03:00
rtw1x1
509e2638cb XChaCha20-Poly1305 via libsodium 2026-02-03 11:12:32 +00:00
rtw1x1
a955c50744 Full Unicode patch with RTL Support & BiDi logic.
This commit is well documented, so no need to tell you my life story.

Full Unicode patch with RTL Support & BiDi logic.

Removed the legacy codePage, normalised to UTF8 (65001).

It also comes with:

CTRL + A : select text (highlighted)
CTRL + C : copy
CTRL + V : paste
CTRL + X : cut
CTRL + Y : redo
CTRL + Z : undo
2025-12-26 12:32:43 +00:00
d1str4ught
b4637e4782 client sources moved to C++20 2025-09-22 00:45:08 +02:00
d1str4ught
5b1d3c6bce new pack system 2025-09-21 05:28:55 +02:00
mq1n
fb7e53b909 migrate to DirectX 9Ex from DirectX 9 2025-09-19 16:12:33 +03:00
d1str4ught
a418f8616d include paths normalized 2025-08-28 20:50:20 +02:00
mq1n
e5bd21ff75 fix some memory leaks 2025-08-27 23:37:19 +03:00
d1str4ught
67cabc3c89 removed all defines which are defined in the CMakeLists.txt 2025-08-27 12:48:33 +02:00
d1str4ught
67475fde15 GPU leaf placement fixed and enabled 2025-08-25 22:08:36 +02:00
d1str4ught
e87b6fc67b ported to DX9 2025-08-19 03:18:56 +02:00
d1str4ught
ea712bec83 file encoding to utf-8 2025-08-19 00:30:50 +02:00
d1str4ught
be56f3f31a client almost builds 2025-08-19 00:20:40 +02:00
d1str4ught
4be475f111 init 2025-08-18 19:46:48 +02:00