From a83e704028951e1b6a9b020fba2ebecbcf210cfe Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 04:11:38 +0000 Subject: [PATCH] Decompile fn_02485 (CTextureDX9::Lock) Batch #13994 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_02485 CTextureDX9::Lock: logic confirmed by peer review Peer-reviewed-by: Yommy, SapitoSucio, aDw Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Render/DX9/TextureDX9.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Source/Render/DX9/TextureDX9.cpp b/Source/Render/DX9/TextureDX9.cpp index a42a979ee..e9bcf3314 100644 --- a/Source/Render/DX9/TextureDX9.cpp +++ b/Source/Render/DX9/TextureDX9.cpp @@ -193,11 +193,25 @@ SurfaceLock CTextureDX9::Lock() { SurfaceLock output{}; D3DLOCKED_RECT locked; if (this->m_surface && SUCCEEDED(this->m_surface->LockRect(&locked, nullptr, 0))) { - output = {true, locked.pBits, locked.Pitch, this->m_description.Width, this->m_description.Height, 0}; - if (this->m_description.Format == D3DFMT_A8R8G8B8 || this->m_description.Format == D3DFMT_X8R8G8B8) { - output.bitsPerPixel = 32; - } else if (this->m_description.Format >= D3DFMT_R5G6B5 && this->m_description.Format <= D3DFMT_A4R4G4B4) { + output.pixels = locked.pBits; + output.pitch = locked.Pitch; + output.width = this->m_description.Width; + output.height = this->m_description.Height; + output.success = true; + switch (this->m_description.Format) { + case D3DFMT_R5G6B5: + case D3DFMT_X1R5G5B5: + case D3DFMT_A1R5G5B5: + case D3DFMT_A4R4G4B4: output.bitsPerPixel = 16; + break; + case D3DFMT_A8R8G8B8: + case D3DFMT_X8R8G8B8: + output.bitsPerPixel = 32; + break; + default: + output.bitsPerPixel = 0; + break; } }