From 34b511db6ce2115e7bd776e3e890dd611591d70d Mon Sep 17 00:00:00 2001 From: Toby Fleming Date: Sat, 26 Jul 2025 02:21:39 -0700 Subject: [PATCH 1/2] Build with MSVC --- .github/workflows/check.yaml | 41 +++++++++++++++++++++++++++++++----- rust-toolchain.toml | 2 +- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 32531d9..0d527ac 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -17,8 +17,8 @@ env: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse jobs: - check: - name: check + check-gnu: + name: check-gnu runs-on: ubuntu-latest steps: - name: Install Mingw-w64 @@ -36,7 +36,7 @@ jobs: shell: bash run: cargo fmt --all -- --check - - name: Run cargo check (gnu) + - name: Run cargo check shell: bash run: RUSTFLAGS="-D warnings" cargo check --workspace --target 'i686-pc-windows-gnu' @@ -44,10 +44,41 @@ jobs: shell: bash run: RUSTFLAGS="-D warnings" cargo test --workspace --target 'x86_64-unknown-linux-gnu' - - name: Run cargo build (release gnu) + - name: Run cargo build (release) shell: bash run: cargo build --verbose --release --package 'zipfixup' --package 'zippatch' --target 'i686-pc-windows-gnu' - - name: Run export checker (gnu) + - name: Run export checker shell: bash run: cargo run --package 'export-check' --target 'x86_64-unknown-linux-gnu' -- 'target/i686-pc-windows-gnu/release/zipfixup.dll' + + check-msvc: + name: check-msvc + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Sync toolchain + shell: bash + run: rustup show + + - name: Run cargo fmt + shell: bash + run: cargo fmt --all -- --check + + - name: Run cargo check + shell: bash + run: RUSTFLAGS="-D warnings" cargo check --workspace --target 'i686-pc-windows-msvc' + + - name: Run cargo test + shell: bash + run: RUSTFLAGS="-D warnings" cargo test --workspace --target 'i686-pc-windows-msvc' + + - name: Run cargo build (release) + shell: bash + run: cargo build --verbose --release --package 'zipfixup' --package 'zippatch' --target 'i686-pc-windows-msvc' + + - name: Run export checker + shell: bash + run: cargo run --package 'export-check' --target 'x86_64-pc-windows-msvc' -- 'target/i686-pc-windows-msvc/release/zipfixup.dll' diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 76f23f6..b8cc1fa 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "1.88.0" profile = "default" -targets = ["i686-pc-windows-gnu"] +targets = ["i686-pc-windows-gnu", "i686-pc-windows-msvc"] From 191f95fab0a452456a97a8867321dad63f1ade00 Mon Sep 17 00:00:00 2001 From: Toby Fleming Date: Sat, 26 Jul 2025 12:09:17 -0700 Subject: [PATCH 2/2] Update README/CHANGELOG for MSVC build --- CHANGELOG.md | 23 +++++++++++++++++------ README.md | 33 +++++++++++++++++++++++++-------- crates/zipfixup/build.rs | 8 ++------ 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ca2d05..0042af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,21 @@ ## [Unreleased] -- Project: Update Rust version to 1.88.0 and codebase. This moves off nightly, since everything we need is now stabilised, and should help with maintenance. - Patch: Rundll32 no longer seems to work... replaced it with `zippatch.exe`. -- Project: Use retour/detour for hooking functions. -- Project: Relicense under EUPL-1.2. - Patch: Patcher now waits for enter. +- Fixup: Use retour/detour for hooking functions. +- Fixup: Include timestamps in debug output. +- Fixup: Implement checker to verify DLL exports/forwards are correct. +- Fixup: Specify exports via [Module-Definition (.Def) + file](https://learn.microsoft.com/en-us/cpp/build/reference/module-definition-dot-def-files). +- Fixup: Now builds using either `i686-pc-windows-gnu` or `i686-pc-windows-msvc`. + +- Project: Update Rust version to 1.88.0 and edition to 2024. This moves off + nightly, since everything we need is now stabilised, and should help with + maintenance. +- Project: Relicense under EUPL-1.2. + ## [0.1.1] - 2021-01-29 - PM: Have another go at adding PM support. @@ -20,10 +29,12 @@ ## [0.0.2] - 2021-01-19 - Patch: Fix install script. -- DLL: Display version number during install. +- Fixup: Display version number during install. ## [0.0.1] - 2021-01-18 -- All: Fixed timing issues related GetTickCount having a resolution of 1ms but an accuracy of 16ms. +- All: Fixed timing issues related GetTickCount having a resolution of 1ms but + an accuracy of 16ms. - All: Fixed timing issues related to high system uptime. -- MW: Bounds checking on target box lines (prevents crashes at higher resolutions). +- MW: Bounds checking on target box lines (prevents crashes at higher + resolutions). diff --git a/README.md b/README.md index cbed0af..376b311 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ZipperFixup -A redistributable DLL to fix bugs and limitations of certain games developed by Zipper Interactive™ to modern formats and back: +This project fixes bugs and limitations of certain games/game engines developed by Zipper Interactive™: * the Recoil™ game (1999) * the MechWarrior 3™ base game (1999) @@ -10,15 +10,36 @@ Zipper Interactive™ was trademark or registered trademark of Sony Computer Ent Obviously, this is an unofficial fan effort and not connected to the developers, publishers, or rightsholders. [Join us on MW3 Discord](https://discord.gg/Be53gMy), or the Recoil Discord! -## Building +## Installation -[Rust](https://www.rust-lang.org/tools/install) is required. Also required is [Mingw-w64](http://mingw-w64.org/), specifically the 32 bit version. +1. Download [the latest release Zip file](https://github.com/TerranMechworks/ZipperFixup/releases), for example ` +ZipperFixup-0.1.2.zip`. +2. Extract the Zip file. +3. Follow instructions of `Readme.txt` in Zip file. + +## License + +Licensed under the European Union Public Licence (EUPL) 1.2 ([LICENSE](LICENSE) or https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12). + +## Development + +### Building + +[Rust](https://www.rust-lang.org/tools/install) is required. + +#### i686-pc-windows-msvc + +This target can only be build on Windows. Please see installing [Rust on Windows](https://rust-lang.github.io/rustup/installation/windows.html), including the Visual Studio requirement. + +#### i686-pc-windows-gnu + +This target can be built on any platform, but requires [Mingw-w64](http://mingw-w64.org/) (specifically the 32 bit version). * On Ubuntu: `apt install gcc-mingw-w64-i686` * On macOS: `brew install mingw-w64` * On Windows, use WSL. -## Release procedure +### Release procedure 1. Review `CHANGELOG.md` 1. Add release version number and release date to changelog; add a new `[Unreleased]` section @@ -29,7 +50,3 @@ Obviously, this is an unofficial fan effort and not connected to the developers, 1. The build will automatically create a release as a draft 1. Add changelog items to the release notes via the GitHub web interface 1. Publish the release via the GitHub web interface - -## License - -Licensed under the European Union Public Licence (EUPL) 1.2 ([LICENSE](LICENSE) or https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12). diff --git a/crates/zipfixup/build.rs b/crates/zipfixup/build.rs index 26f2191..55c1fa4 100644 --- a/crates/zipfixup/build.rs +++ b/crates/zipfixup/build.rs @@ -1,5 +1,6 @@ fn main() { let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap(); + println!("cargo::warning={env}"); let path = std::env::var("CARGO_MANIFEST_DIR").unwrap(); let mut path = std::path::PathBuf::from(path); @@ -11,15 +12,10 @@ fn main() { match env.as_str() { "gnu" => { - println!("cargo::warning=GNU"); println!("cargo::rustc-link-arg-cdylib={path}"); } - "msvc" => { - println!("cargo::warning=MSVC"); + "msvc" | _ => { println!("cargo::rustc-link-arg-cdylib=/DEF:{path}"); } - _ => { - println!("cargo::warning=unknown env `{env}`"); - } } }