From 598422b7016ce2f99b365bebddb231398ce524b6 Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Tue, 22 Apr 2025 00:21:45 -0700 Subject: [PATCH] build: large address aware variant of 32-bit spice.exe (#298) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Link to GitHub Issue, if one exists Fixes #280 ## Description of change Introduce a variant of 32bit spice.exe that is large address aware. ## Compiling 👍 ## Testing Minimal testing has been done to see if the LAA variant can boot existing 32 bit games. --- src/spice2x/CMakeLists.txt | 19 +++++++++++++++++-- src/spice2x/build_all.sh | 4 +++- .../external/hash-library/CMakeLists.txt | 2 +- src/spice2x/external/minhook/CMakeLists.txt | 2 +- src/spice2x/launcher/launcher.cpp | 2 ++ 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/spice2x/CMakeLists.txt b/src/spice2x/CMakeLists.txt index b9114b6..a8db848 100644 --- a/src/spice2x/CMakeLists.txt +++ b/src/spice2x/CMakeLists.txt @@ -607,6 +607,22 @@ IF(NOT MSVC) set_target_properties(spicetools_spice PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") endif() +# spice_laa.exe +########### + +set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc) +add_executable(spicetools_spice_laa ${SOURCE_FILES} ${RESOURCE_FILES}) +target_link_libraries(spicetools_spice_laa + PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp + PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features) +set_target_properties(spicetools_spice_laa PROPERTIES PREFIX "") +set_target_properties(spicetools_spice_laa PROPERTIES OUTPUT_NAME "spice_laa") +target_compile_definitions(spicetools_spice_laa PRIVATE SPICE32_LARGE_ADDRESS_AWARE=1) + +IF(NOT MSVC) + set_target_properties(spicetools_spice_laa PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32 -Wl,--large-address-aware") +endif() + # spice64.exe ############# @@ -626,7 +642,6 @@ IF(NOT MSVC) set_target_properties(spicetools_spice64 PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64") endif() - # spicecfg.exe ############## @@ -732,7 +747,7 @@ set_target_properties(spicetools_cfg RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools") # output 32bit -set_target_properties(spicetools_spice spicetools_stubs_kbt spicetools_stubs_kld +set_target_properties(spicetools_spice spicetools_spice_laa spicetools_stubs_kbt spicetools_stubs_kld PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/archive32" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/32" diff --git a/src/spice2x/build_all.sh b/src/spice2x/build_all.sh index 825ac92..713512a 100755 --- a/src/spice2x/build_all.sh +++ b/src/spice2x/build_all.sh @@ -60,7 +60,7 @@ DIST_ENABLE=1 DIST_FOLDER="./dist" DIST_NAME="spice2x-$(date +%y)-$(date +%m)-$(date +%d).zip" DIST_COMMENT=${DIST_NAME}$'\n'"$GIT_BRANCH - $GIT_HEAD"$'\nThank you for playing.' -TARGETS_32="spicetools_stubs_kbt spicetools_stubs_kld spicetools_cfg spicetools_spice" +TARGETS_32="spicetools_stubs_kbt spicetools_stubs_kld spicetools_cfg spicetools_spice spicetools_spice_laa" TARGETS_64="spicetools_stubs_kbt64 spicetools_stubs_kld64 spicetools_stubs_nvEncodeAPI64 spicetools_stubs_nvcuvid spicetools_stubs_nvcuda spicetools_spice64" # determine build type @@ -183,6 +183,7 @@ rm -rf ${OUTDIR} mkdir -p ${OUTDIR} #mkdir -p ${OUTDIR}/stubs/32 mkdir -p ${OUTDIR}/stubs/64 +mkdir -p ${OUTDIR}/extras/largeaddressaware if false # ((DEBUG > 0)) then # debug files @@ -203,6 +204,7 @@ else # release files cp ${BUILDDIR_32}/spicetools/spicecfg.exe ${OUTDIR} 2>/dev/null cp ${BUILDDIR_32}/spicetools/32/spice.exe ${OUTDIR} 2>/dev/null + cp ${BUILDDIR_32}/spicetools/32/spice_laa.exe ${OUTDIR}/extras/largeaddressaware/spice.exe 2>/dev/null #cp ${BUILDDIR_32}/spicetools/32/kbt.dll ${OUTDIR}/stubs/32 2>/dev/null #cp ${BUILDDIR_32}/spicetools/32/kld.dll ${OUTDIR}/stubs/32 2>/dev/null cp ${BUILDDIR_64}/spicetools/64/spice64.exe ${OUTDIR} 2>/dev/null diff --git a/src/spice2x/external/hash-library/CMakeLists.txt b/src/spice2x/external/hash-library/CMakeLists.txt index e010de7..2701a8b 100644 --- a/src/spice2x/external/hash-library/CMakeLists.txt +++ b/src/spice2x/external/hash-library/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.12) project(imgui CXX) set(HASH_LIBRARY_HEADERS diff --git a/src/spice2x/external/minhook/CMakeLists.txt b/src/spice2x/external/minhook/CMakeLists.txt index 79bc15b..5e514ba 100644 --- a/src/spice2x/external/minhook/CMakeLists.txt +++ b/src/spice2x/external/minhook/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.12) cmake_policy(SET CMP0069 NEW) project(minhook) diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index 3ef3ac8..7f5da40 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -1118,6 +1118,8 @@ int main_implementation(int argc, char *argv[]) { // log #ifdef SPICE64 log_info("launcher", "SpiceTools Bootstrap (x64) (spice2x)"); +#elif SPICE32_LARGE_ADDRESS_AWARE + log_info("launcher", "SpiceTools Bootstrap (x32) (Large Address Aware) (spice2x)"); #else log_info("launcher", "SpiceTools Bootstrap (x32) (spice2x)"); #endif