Framework for Sacred 2 Gold, game log mirror, borderless fullscreen
Ported from sacredK with module-relative addresses, hooks by exported name and a SHA-256 check of the six game modules (Community Patch 2.65.1). Borderless windowed at monitor size replaces exclusive fullscreen, whose focus loss during loading made the game quit and crash on exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
8a7bdfd99f
44 files changed
+2505
No files matched your search
@@ -0,0 +1,45 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(sacred2K LANGUAGES C CXX)
|
||||
|
||||
# sacred2.exe is a 32-bit process; everything we inject into it must be 32-bit too.
|
||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
message(FATAL_ERROR "sacred2K must be built for 32-bit x86 (use the 'x86-*' presets / an x86 MSVC environment).")
|
||||
endif()
|
||||
if(NOT MSVC)
|
||||
message(FATAL_ERROR "sacred2K requires MSVC (the game's C++ ABI is MSVC's).")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# Static CRT: no VC++ redistributable needed next to the game.
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX _CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
include(cmake/Detours.cmake)
|
||||
|
||||
set(SACRED2K_CXX_FLAGS /W4 /permissive- /utf-8)
|
||||
|
||||
# --- sacred2K.dll: injected into sacred2.exe, installs the hooks -----------
|
||||
add_library(sacred2K SHARED
|
||||
src/re/dllmain.cpp
|
||||
src/re/hook.cpp
|
||||
src/re/module.cpp
|
||||
src/re/log.cpp
|
||||
src/re/config.cpp
|
||||
src/re/patch.cpp
|
||||
src/re/crash.cpp
|
||||
src/re/sacred2K.def
|
||||
src/game/orc/log.cpp
|
||||
src/mods/borderless.cpp
|
||||
)
|
||||
target_include_directories(sacred2K PRIVATE src)
|
||||
target_compile_options(sacred2K PRIVATE ${SACRED2K_CXX_FLAGS})
|
||||
target_link_libraries(sacred2K PRIVATE detours dbghelp bcrypt)
|
||||
|
||||
# --- sacred2K.exe: launches sacred2.exe with sacred2K.dll injected ---------
|
||||
add_executable(sacred2K_launcher WIN32 src/launcher/main.cpp)
|
||||
set_target_properties(sacred2K_launcher PROPERTIES OUTPUT_NAME sacred2K)
|
||||
target_compile_options(sacred2K_launcher PRIVATE ${SACRED2K_CXX_FLAGS})
|
||||
target_link_libraries(sacred2K_launcher PRIVATE detours)
|
||||
add_dependencies(sacred2K_launcher sacred2K)
|
||||
Reference in new issue
Block a user