From d8e043293237a4eed3a9852b2a6744d9f362cc68 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 10:15:30 +0000 Subject: [PATCH] Decompile 2 functions in Source/Render/DX7/DirectDrawEnumeration.cpp Batch #15808 by Yommy: 2 byte-identical, 0 confirmed by peer review. - fn_09779 DirectDrawEnumeration::Adapter: byte-identical - fn_09784 DirectDrawEnumeration::CompareModes: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/Render/DX7/DirectDrawEnumeration.cpp | 29 +++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Source/Render/DX7/DirectDrawEnumeration.cpp b/Source/Render/DX7/DirectDrawEnumeration.cpp index b3ecb2f42..b37b81d9a 100644 --- a/Source/Render/DX7/DirectDrawEnumeration.cpp +++ b/Source/Render/DX7/DirectDrawEnumeration.cpp @@ -68,16 +68,23 @@ int __cdecl DirectDrawEnumeration::CompareModes(const void* left, const void* ri const auto& a = *static_cast(left); const auto& b = *static_cast(right); - if (a.dwWidth != b.dwWidth) { - return a.dwWidth < b.dwWidth ? -1 : 1; + if (a.dwWidth < b.dwWidth) { + return -1; } - - if (a.dwHeight != b.dwHeight) { - return a.dwHeight < b.dwHeight ? -1 : 1; + if (a.dwWidth > b.dwWidth) { + return 1; } - - if (a.ddpfPixelFormat.dwRGBBitCount != b.ddpfPixelFormat.dwRGBBitCount) { - return a.ddpfPixelFormat.dwRGBBitCount < b.ddpfPixelFormat.dwRGBBitCount ? -1 : 1; + if (a.dwHeight < b.dwHeight) { + return -1; + } + if (a.dwHeight > b.dwHeight) { + return 1; + } + if (a.ddpfPixelFormat.dwRGBBitCount < b.ddpfPixelFormat.dwRGBBitCount) { + return -1; + } + if (a.ddpfPixelFormat.dwRGBBitCount > b.ddpfPixelFormat.dwRGBBitCount) { + return 1; } return 0; @@ -165,20 +172,20 @@ HRESULT CALLBACK DirectDrawEnumeration::Device(char*, char* name, D3DDEVICEDESC7 // FUNCTION: fn_09779 BOOL WINAPI DirectDrawEnumeration::Adapter(GUID* guid, char* description, char*, void*, HMONITOR monitor) { - if (guid && monitor && std::memcmp(guid, g_guidDriver, sizeof(GUID)) == 0) { + if (guid && monitor && std::memcmp(g_guidDriver, guid, sizeof(GUID)) == 0) { MONITORINFOEXA information; information.cbSize = sizeof(information); GetMonitorInfoA(monitor, &information); g_monitorRectangleDX7 = information.rcMonitor; } - IDirectDraw7* draw = nullptr; + IDirectDraw7* draw; if (FAILED(DirectDrawCreateEx(guid, reinterpret_cast(&draw), IID_IDirectDraw7, nullptr))) { return TRUE; } - IDirect3D7* render = nullptr; + IDirect3D7* render; if (FAILED(draw->QueryInterface(IID_IDirect3D7, reinterpret_cast(&render)))) { draw->Release();