Created
November 24, 2025 14:02
-
-
Save martinellimarco/3df20a4c57330029fd1ed606a584b44c to your computer and use it in GitHub Desktop.
Patch for the Macromedia Director runtime used by ZeroZone and other games so it can run on systems with > 2 GiB of RAM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Patch for the Macromedia Director runtime used by ZeroZone so it can run on systems with > 2 GiB of RAM. | |
| # | |
| # This patch has been confirmed to work with: | |
| # - The Italian version of ZeroZone, where the runtime is located at ./ZZnet/ZZnet.exe | |
| # - The English version of ZeroZone, where the runtime is located at ./GalaxyNet.exe | |
| # | |
| # The same patch may also apply to other games built with the same Macromedia Director runtime. | |
| # There are several version of the runtime, see https://wiki.scummvm.org/index.php?title=Director/Versions | |
| # This patch only applies to versions equal or similar to the one used in ZeroZone. | |
| # Read the technical notes below before attempting to use it on other executables. | |
| # If it does work or you find a different location for another version please consider opening a PR. | |
| # | |
| # --------------------------------------------------------------------------- | |
| # Technical notes | |
| # --------------------------------------------------------------------------- | |
| # The Macromedia Director runtime requires at least 3 MB of memory to start. | |
| # | |
| # The runtime calls GlobalMemoryStatus and adds together | |
| # dwAvailPageFile + dwAvailPhys | |
| # and then casts the result to a 32-bit signed integer. | |
| # | |
| # On systems with 2+ GiB of RAM this addition overflows the 32-bit signed | |
| # range and becomes negative. The subsequent comparison against the 3 MB | |
| # threshold therefore always fails, and the program refuses to start even | |
| # though plenty of memory is available. | |
| # | |
| # This patch modifies the conditional check at offset 0x000B54C8 so that the | |
| # memory test is unconditionally treated as “passed”, allowing the runtime | |
| # to start normally on modern systems. | |
| # | |
| # An alternative approach would be to hook or patch GlobalMemoryStatus so | |
| # that it reports less than 2 GiB of available memory, but this script keeps | |
| # things simple and only adjusts the in-game check. | |
| # | |
| set -e | |
| # Detect target executable | |
| target="" | |
| if [ -f "ZZnet/ZZnet.exe" ]; then | |
| target="ZZnet/ZZnet.exe" | |
| echo "✓ Detected Italian ZeroZone runtime at '${target}'." | |
| elif [ -f "GalaxyNet.exe" ]; then | |
| target="GalaxyNet.exe" | |
| echo "✓ Detected English ZeroZone runtime at '${target}'." | |
| else | |
| echo "✗ No supported executable found." | |
| echo " Expected either './ZZnet/ZZnet.exe' or './GalaxyNet.exe' in the current directory." | |
| echo " Nothing was patched." | |
| exit 1 | |
| fi | |
| # Check that xxd is available | |
| if ! command -v xxd >/dev/null 2>&1; then | |
| echo "✗ The 'xxd' utility is not installed. Please install it and run this script again." | |
| exit 1 | |
| fi | |
| # Create a backup before patching | |
| backup="${target}.bak" | |
| if [ ! -f "${backup}" ]; then | |
| cp "${target}" "${backup}" | |
| echo "✓ Created backup: '${backup}'." | |
| else | |
| echo "ℹ Backup '${backup}' already exists; it will not be overwritten." | |
| fi | |
| # Apply the patch | |
| echo "→ Applying memory check patch to '${target}'..." | |
| echo "000b54c8: eb" | xxd -r - "${target}" | |
| echo "✓ Patch successfully applied to '${target}'." | |
| echo "All done. You can now run the game on systems with more than 2 GiB of RAM." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment