From 1aa1da5556f5b499551c8b485d6e1c40258c0247 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Tue, 13 Jan 2026 19:18:34 +0100 Subject: [PATCH 1/4] [BUILD] make OPEN_SHC_DLL_DEST a cmake cache variable and configurable via -D, resolves #30 --- CMakeLists.txt | 2 +- README.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efd7790..95b1606 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,7 @@ target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/shfolder.dll" "$ Date: Tue, 13 Jan 2026 21:45:13 +0100 Subject: [PATCH 2/4] explicate cmake cache situation and capitalize Path --- CMakeLists.txt | 2 +- README.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95b1606..08db327 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,7 @@ target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/shfolder.dll" "$ Date: Tue, 13 Jan 2026 22:47:30 +0100 Subject: [PATCH 3/4] use --refresh to clear -D variables --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e38747..1224bbb 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ The file `build.bat` exists for convenience. If you want more control, you can s ##### Output folder of dll Use `cmake --preset RelWithDebInfo -D OPEN_SHC_DLL_DEST=.\build-RelWithDebInfo\dll` to specify the destination folder for the .dll and .pdb files in favor of the default. -Note this will be set even if you remove the `-D` option later. To actually clear this configuration, use `cmake --build --preset RelWithDebInfo --target clean`. +Note this will be set even if you remove the `-D` option later. To actually clear this configuration, use `cmake --preset RelWithDebInfo --refresh` (cmake 3.24 or later). ##### Building Build using `cmake --build --preset RelWithDebInfo --target OpenSHC.dll` From 799cdaf89096ff653a9aa49fa2c8574885779488 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 14 Jan 2026 10:51:41 +0100 Subject: [PATCH 4/4] fix --refresh to --fresh and clarify docs --- README.md | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1224bbb..ecea8d2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # OpenSHC + An open source re-implementation of Stronghold Crusader 1. The beloved Castle Building, Real Time Strategy, and Simulation game remastered. ## Usage ### Download and Install + This reimplementation requires you to own a legal copy of the original Stronghold Crusader game from Firefly Studios. The current method of installation is via the [Unofficial Crusader Patch](https://github.com/UnofficialCrusaderPatch/UnofficialCrusaderPatch). Make sure to set that up first. @@ -14,17 +16,20 @@ The current method of installation is via the [Unofficial Crusader Patch](https: 3. Drag and drop the zip file unto your open UCP3 GUI, or manually move the zip file into the `ucp/modules` folder inside your game folder. 4. Reload the UCP3 GUI and activate the module. 5. Disable Security in the Launch tab of the GUI. -5. Launch the game! +6. Launch the game! -Note that the goal is to recreate the game. So if there are no changes compared to vanilla, then it is exactly like intended. +Note that the goal is to recreate the game. So if there are no changes compared to vanilla, then it is exactly like intended. ### Help + Raise an issue here on GitHub to receive support. Or visit the [Discord](https://discord.gg/27W68ZaFT4) server. ## Contribute + The development of this reimplementation is a stepwise process. All developers are welcome to contribute. ### Approach + The development of this reimplementation primarily focuses on reimplementing functions and data structures of the original game. The game 1.41 Latin version of the Stronghold Crusader executable serves as the reference point (SHA hash: 012E9D55DAC04B23ED9A334C975D3A5B6287020B). To achieve this, a combination approach is used. The code has mechanisms in place to allow a compilation to both and executable and a DLL. @@ -35,50 +40,57 @@ We use [reccmp](https://github.com/isledecomp/reccmp) to verify compatibility of Because the original game was compiled using an old compiler, you have to compile it using [this compiler](https://github.com/sourcehold/MSVC1400), which is included in the repository via a submodule. ### Prerequisites + 1. Stronghold Crusader 1.41 Latin. The Steam version is the easiest one to get, but any patched version will do. Make sure the installation uses a Latin version (English, German, etc). -2. CMake with the minimum version defined in the [CMakeLists.txt](CMakeLists.txt). +2. CMake with the minimum version 3.24. 3. [Python3](https://www.python.org/) 4. A way to execute `clang-format` 5. (Recommended) An IDE with CMake integration. The repository has been optimized for Visual Studio Code using the [Microsoft C/C++ Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack). ### Setup + 1. Clone the repository. Make sure to also pull the submodules to have the compiler included: - ```sh - git clone --recursive https://github.com/sourcehold/OpenSHC.git - ``` - - Should NET Framework 3.5 be required, it can be easily installed on Windows 11 by running `mt.exe` (from the MSVC1400 repo), Windows 11 will ask to install the right version. + ```sh + git clone --recursive https://github.com/sourcehold/OpenSHC.git + ``` + - Should NET Framework 3.5 be required, it can be easily installed on Windows 11 by running `mt.exe` (from the MSVC1400 repo), Windows 11 will ask to install the right version. 2. Create a softlink to the original game executable with the name `_original` by running [softlink.bat](softlink.bat). It will request the full path to the game folder. 3. Setup the needed Python environment to run `reccmp` for binary comparison by running [setup.bat](reccmp/setup.bat) in the reccmp folder. ### Development + The build can be run using the dev tools of the preferred IDE or via the build scripts. Regardless, a CMake installation is required. Visual Studio Code with the proper extensions only needs to open the folder and the targets can be chosen in the "CMake" menu. Additionally, it configures format-on-save and a debug target for the UCP3. If the scripts are preferred, the following triggers a build using the scripts: + 1. Open a terminal. If the Visual Studio CMake version is used, it needs to be the CMD developer command prompt. 2. Navigate to this project folder 3. Execute build.bat: - ```sh - build.bat RelWithDebInfo - ``` + ```sh + build.bat RelWithDebInfo + ``` 4. Compare a function byte by byte to check compilation: - ```sh - reccmp/run reccmp-reccmp --target STRONGHOLDCRUSADER --verbose 0x401000 - ``` + ```sh + reccmp/run reccmp-reccmp --target STRONGHOLDCRUSADER --verbose 0x401000 + ``` Note that any code needs to be formatted properly using the provided `clang-format`. The way to do so it up to the developer. Many IDEs support it out of the box. Should any files be added to the source code in `src/core` or the ucp files in `ucp`, the cmake script [create-include-lists.cmake](create-include-lists.cmake) needs to be rerun and the changed list files need to be committed. #### Manual configuration + The file `build.bat` exists for convenience. If you want more control, you can specify the following cmake options. ##### Output folder of dll + Use `cmake --preset RelWithDebInfo -D OPEN_SHC_DLL_DEST=.\build-RelWithDebInfo\dll` to specify the destination folder for the .dll and .pdb files in favor of the default. -Note this will be set even if you remove the `-D` option later. To actually clear this configuration, use `cmake --preset RelWithDebInfo --refresh` (cmake 3.24 or later). +Note this setting will remain present even if you remove the `-D` option later from the command. To actually clear this configuration, use `cmake --preset RelWithDebInfo --fresh`. ##### Building + Build using `cmake --build --preset RelWithDebInfo --target OpenSHC.dll`