Files
sacred_k/cmake/DxWrapper.cmake
T
khallaandClaude Opus 5.5 795fe8f087 Widescreen experiment: native render size via dxwrapper, classic menus
- mods/widescreen: redirect the world view's reads of the 1024.0/768.0
  constants and the 3D ortho extents to our variables; render size =
  monitor; relocate the world view's tile draw list (1750 entries, no
  bounds check) into an enlarged object (16384 entries).
- mods/dxwrapper: route DirectDraw through dxwrapper (Dd7to9, D3D9) since
  Windows' D3D7 cannot render to targets larger than 2048; fix the game's
  device info GUID pointer that dxwrapper's enumeration leaves invalid.
  Pinned release fetched by CMake (hash-checked), installed next to the DLL.
- Main menu (UI thread) and loading screen render in a 1024x768 viewport
  and are presented scaled ("classic" layout); in-game uses the full size.
- re/patch: verified code patches (operand redirect, push immediates,
  displacements) and startup hooks; build.ps1/CMake download fixes.

In-game view untested yet; HUD still at the top-left.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 00:47:03 +02:00

41 lines
1.8 KiB
CMake

# dxwrapper (zlib; github.com/elishacloud/dxwrapper): translates the game's
# DirectDraw 7 / Direct3D 7 to Direct3D 9, lifting D3D7's 2048x2048 render
# target limit. Pinned release, verified by hash; installed next to
# sacred_re.dll in dxwrapper/ and loaded by src/mods/dxwrapper.cpp, so the
# game folder stays untouched.
include(FetchContent)
# Some CMake builds (e.g. WinLibs/MinGW) ship curl without a CA store, so
# HTTPS downloads fail certificate verification. Fall back to Git for
# Windows' bundle when nothing else is configured.
if(NOT CMAKE_TLS_CAINFO AND NOT DEFINED ENV{SSL_CERT_FILE})
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _program_files)
foreach(_bundle "${_program_files}/Git/mingw64/etc/ssl/certs/ca-bundle.crt"
"${_program_files}/Git/mingw64/ssl/certs/ca-bundle.crt")
if(EXISTS "${_bundle}")
set(CMAKE_TLS_CAINFO "${_bundle}")
break()
endif()
endforeach()
endif()
FetchContent_Declare(dxwrapper_bin
URL https://github.com/elishacloud/dxwrapper/releases/download/v1.8.8600.25/dxwrapper.zip
URL_HASH SHA256=3894368ebce69f348d08e189c2f0818c49aa3b18ad01e06348743bf6a29af97a
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
FetchContent_MakeAvailable(dxwrapper_bin)
function(sacred_re_install_dxwrapper target)
set(_dest "$<TARGET_FILE_DIR:${target}>/dxwrapper")
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${_dest}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${dxwrapper_bin_SOURCE_DIR}/Stub/ddraw.dll"
"${dxwrapper_bin_SOURCE_DIR}/dxwrapper.dll"
"${dxwrapper_bin_SOURCE_DIR}/License.txt"
"${CMAKE_SOURCE_DIR}/config/dxwrapper.ini"
"${_dest}"
VERBATIM)
endfunction()