# SMC64 A LibSM64 mod for Halo CE on MCC (Steam) [See it in action here.](https://www.youtube.com/watch?v=tj5fAk7KkHA) Check the [Discord](https://discord.gg/MzG7fqJtG) for the most up to date news and support. ## AI Disclosure I've used *some* AI for this project, but I have mixed feelings about use of AI in development. I'm weening myself off of writing new code with agents for my mental health. I still use coding assistants extensively for inline completions to supplement my poor memory and typing speed. A few isolated features were written primarily by coding agents. I still use agents extensively for rote refactoring. Most of the reverse engineering for this project was done by humans, but I have made moderate use of agents for static analysis via [Ghidra MCP](https://github.com/LaurieWired/GhidraMCP). I don't use AI generated art in this project. ## Installation Download the latest [release](https://github.com/KodyJKing/smc64/releases) and follow the installation instructions in the included `README.md`. ## Developer Setup - Clone the repository recursively to get submodules (including the `spark` mod-loader, which lives at `vendor/spark`): ```powershell git clone --recursive # Or if you already cloned: git submodule update --init --recursive ``` - [Setup Spark](./vendor/spark/README.md#developer-setup) - [Setup LibSM64](./vendor/libsm64/README.md#building-on-windows) - Add your MSYS install directory to your path (location may vary, `C:\msys64` for me) - Optionally, if you want debug symbols for LibSM64, download [cv2pdb](https://github.com/rainers/cv2pdb/releases) and add it to your path. ## Building and Running ```powershell scripts/build.ps1 scripts/run_launcher.ps1 ``` Halo MCC will need to be running when you run `run_launcher.ps1`. ## Workflow When developing, run `scripts/watch_launcher.ps1` to build/run in watch mode. When you save a source file, this script will uninject, rebuild, and reinject the mod DLL. If you're using Cheat Engine as part of your workflow, turn off symbols in the debug build configuration (`smc64/premake5.lua`). Otherwise, Cheat Engine will hold on to the PDB file and prevent rebuilding. ## Packaging If you want to package the mod for distribution, you will need to build MSDetours' `setdll.exe` first. Make sure that `nmake` is on your path. For me, it is located under `C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\\bin\Hostx64\x64`. Then run ```powershell .scripts/build_setdll.bat ``` To compile and generate the package, run ```powershell ./scripts/package.ps1 -Config Release ``` The generated `.zip` file will be under `bin/Release-Win64`. ## Scripts All scripts assume you are running from the root of the repository. ### `build.ps1` Builds mod once. Arguments: - `-Config` Configuration to build. Values are `Debug` and `Release`. Default is `Debug`. - `-IDE` IDE premake will generate project files for. Default is `vs2022`. ### `run_launcher.ps1` Injects mod into game once. MCC must already be running. Arguments: - `-Config` Configuration to run. Values are `Debug` and `Release`. Default is `Debug`. - `-Arguments` Arguments to pass to the launcher executable. Optional. ### `watch_build.ps1` Builds mod and recompiles on file change. Press `R` in the terminal to rebuild without waiting for a file change. Arguments: - Inherits from `build.ps1`. ### `watch_launcher.ps1` Builds mod and runs launcher. Uninjects mod from game, recompiles and reruns launcher on file change. Press `R` in the terminal to rebuild without waiting for a file change. Arguments: - Inherits from `watch_build.ps1` and `run_launcher.ps1`. ### `package.ps1` Packages mod and Spark into a `.zip` file. Creates a copy of xaudio2_9redist.dll that loads Spark. You must manually run `build_setdll.bat` before running this script. Arguments: - Inherits from `build.ps1`. - `-MCCPath` Path to the root of the MCC installation. This is where the xaudio dll is pulled from. Default is `C:\Program Files (x86)\Steam\steamapps\common\Halo The Master Chief Collection`. ### `install_package.ps1` Runs `package.ps1` and installs the mod into the game. This script is for testing, not for end users. Arguments: - Inherits from `package.ps1`. - `-MCCPath` Path to the root of the MCC installation. Default is `C:\Program Files (x86)\Steam\steamapps\common\Halo The Master Chief Collection`. - `-Uninstall` Uninstalls the mod instead of installing it. ### `build_setdll.bat` Builds `setdll.exe` (from MS Detours). This is only needed when packaging the mod for distribution.