From 2fbd5dd9aba4625cfa8cc4043f8f5a5a9fbb2dfc Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 19:37:13 +0000 Subject: [PATCH] Decompile 2 functions in Source/Render/DX7/RendererFogDX7.cpp Batch #16431 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_02040 SquareRoot: logic confirmed by peer review - fn_01863 PerspectiveMatrixDX7: logic confirmed by peer review Peer-reviewed-by: Yommy, kyoshi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Render/DX7/RendererFogDX7.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Source/Render/DX7/RendererFogDX7.cpp b/Source/Render/DX7/RendererFogDX7.cpp index 323cb0876..5aa329ba8 100644 --- a/Source/Render/DX7/RendererFogDX7.cpp +++ b/Source/Render/DX7/RendererFogDX7.cpp @@ -11,21 +11,24 @@ namespace { // OFFSET: 0x00556E50 // FUNCTION: fn_02039 - __declspec(noinline) float Sine(float angle) { - return sinf(angle); + __declspec(noinline) float Sine(volatile float angle) { + angle = sinf(angle); + return angle; } // OFFSET: 0x00556E40 // FUNCTION: fn_02038 - __declspec(noinline) float Cosine(float angle) { - return cosf(angle); + __declspec(noinline) float Cosine(volatile float angle) { + angle = cosf(angle); + return angle; } } // OFFSET: 0x00556E60 // FUNCTION: fn_02040 -float SquareRoot(float value) { - return sqrtf(value); +float SquareRoot(volatile float value) { + value = sqrtf(value); + return value; } // OFFSET: 0x00548C30 @@ -44,12 +47,8 @@ HRESULT PerspectiveMatrixDX7(D3DMATRIX& matrix, float fov, float aspect, float n return E_INVALIDARG; } - const float cosineX = Cosine(half); - const float sineX = Sine(half); - const float scaleX = static_cast((static_cast(cosineX) / sineX) * aspect); - const float cosineY = Cosine(half); - const float sineY = Sine(half); - const float scaleY = static_cast(static_cast(cosineY) / sineY); + const float scaleX = Cosine(half) / Sine(half) * aspect; + const float scaleY = Cosine(half) / Sine(half); const float depth = farPlane / difference; matrix._12 = matrix._13 = matrix._14 = 0;