Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ jobs:
cp dist/glide3x.dll stage/
cp README.md d2dx-defaults.cfg stage/
cp LICENSE.txt toml-LICENSE.txt stage/licenses/
cp "thirdparty/sgd2freeres/SGD2FreeRes - COPYING" "thirdparty/sgd2freeres/SGD2FreeRes - LICENSE.md" stage/licenses/
cp "thirdparty/sgd2freeres/SGD2FreeRes - COPYING" "thirdparty/sgd2freeres/SGD2FreeRes - LICENSE.md" "thirdparty/sgd2freeres/rapidjson - license.txt" stage/licenses/
cp "thirdparty/sgd2freeres/MODIFICATIONS.md" "stage/licenses/SGD2FreeRes - D2DX modifications.md"
cp thirdparty/pocketlzma/pocketlzma-LICENSE.txt stage/licenses/
cat > stage/SOURCE.txt <<EOF
D2DX $TAG
Expand Down
10 changes: 8 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ Also supported/detected: Project Diablo 2 (logged in `GameHelper`); its suggeste
- **Conventional commit titles** (`fix:`, `feat:`, `perf:`, `docs:`, `build:`, `ci:`, `chore:`, optional scope, `!` for breaking). release-please builds the changelog and picks the next version from them, and only `feat`/`fix`/`perf`/`revert` (or a `Release-As:` footer) trigger a release PR. Merging: release-please reads every commit on `main`. A merge commit whose PR title is also a conventional title is counted on top of the branch commits, which gave duplicate entries in the 0.0.2 notes. For ported multi-commit PRs use a **rebase merge** (keeps each commit and its author, no extra entry); squash is fine for a single-author change, but it makes the PR opener the author.
- Follow the global rules in `~/.claude/CLAUDE.md`: no commits or pushes unless asked; confirm before destructive or outward-facing actions.
- Don't edit `thirdparty/` except to deliberately update a dependency. It holds vendored binaries (`detours.lib`, `SGD2FreeRes.*`) and licensed code.
- If you change the SGD2FreeRes binaries, regenerate the matching `.lzma` files that `d2dx.rc` embeds (note the `.rc` references lowercase `sgd2freeres.*.lzma` filenames while the files on disk are `SGD2FreeRes.*.lzma`; fine on Windows, case-sensitive on Linux).
- If you change the SGD2FreeRes binaries, first apply `tools/patch_sgd2freeres.py` to the official DLL (see "Binaries need source" below), then regenerate the matching `.lzma` files that `d2dx.rc` embeds with `tools/pack_lzma.cpp` (note the `.rc` references lowercase `sgd2freeres.*.lzma` filenames while the files on disk are `SGD2FreeRes.*.lzma`; fine on Windows, case-sensitive on Linux). It must be built 32-bit and unoptimised (PocketLzma's size header relies on 32-bit shift behaviour), and with that it reproduces the existing files byte for byte. From the repo root:
```
podman run --rm --platform linux/amd64 -v "$PWD:/src:Z" d2dx-tests-linux clang++ -m32 -O0 -std=c++17 /src/tools/pack_lzma.cpp -o /src/build/pack_lzma
podman run --rm --platform linux/amd64 -v "$PWD:/src:Z" -w /src d2dx-tests-linux /src/build/pack_lzma thirdparty/sgd2freeres/SGD2FreeRes.dll thirdparty/sgd2freeres/SGD2FreeRes.dll.lzma
podman run --rm --platform linux/amd64 -v "$PWD:/src:Z" -w /src d2dx-tests-linux /src/build/pack_lzma thirdparty/sgd2freeres/SGD2FreeRes.mpq thirdparty/sgd2freeres/SGD2FreeRes.mpq.lzma
```
(Use `pack_lzma -d <in> <out>` to unpack and check the SHA-256 against the source file. The image comes from `tests/linux/run.sh`. Rootless podman writes the outputs as a subuid; `chown -R 0:0` them from inside the container to get your own ownership back.)
- New user-facing options: add to `OptionsFlag` (or a typed setter) in `Options.h/.cpp`, document in `d2dx-defaults.cfg`, and mention in `README.md`.
- Keep the changelog in `README.md` current for user-visible changes, and bump the version string there.
- Add unit tests in `src/d2dxtests` for logic that doesn't need a live game or D3D device (batching, SIMD, metrics, texture cache). New test `.cpp` files must be added to both `d2dxtests.vcxproj` and `tests/linux/CMakeLists.txt`. Run `tests/linux/run.sh` before committing.
Expand Down Expand Up @@ -111,6 +117,6 @@ This is GPLv3-or-later (`LICENSE.txt`; source headers say "any later version"),
- **Credit in the README.** Add contributors whose work we ship to the README "Credits" section, and list any new third-party library there (for example xxHash, BSD-2-Clause) with its licence file kept under `thirdparty/<lib>/`.
- **Mark modifications.** GPLv3 §5(a) asks for a notice that the work was modified, with a date. Keep git history intact, and keep a short changelog or "Changes from upstream" note when a release is cut.
- **Copyright notices.** New source files get "Copyright (C) <year> The D2DX contributors" in the GPL header; existing headers (for example "Bolrog") stay as they are, and the DLL's `LegalCopyright` reads "Copyright (C) 2021 Bolrog and contributors". Don't put an individual's name on code a coding agent wrote or on code ported from others: contributors keep their own copyright and the git history records authorship. The maintainer is credited in the README, which is a credit and not a copyright claim.
- **Binaries need source.** Anyone we hand a built DLL must be able to get the corresponding source (§6). Don't ship a pre-built binary from another fork (notably Jarcho's custom `SGD2FreeRes.dll`, AGPLv3) unless its source and licence are confirmed.
- **Binaries need source.** Anyone we hand a built DLL must be able to get the corresponding source (§6). The embedded SGD2FreeRes is the official 3.0.3.1 release from the original repository, <https://github.com/mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution> (tag `3.0.3.1`, asset `SGD2FreeRes.3.0.3.1.-.Vanilla.zip`, SHA-256 `4469a1f8d5299e9af935d088324504be5eed948f49c26aa568797a77d1c28463`), **with one 23-byte change**: the config file name inside the DLL (`SGD2FreeResolution.json` becomes `d2dx_sgd2freeres.json`) so it reads D2DX's generated config instead of ignoring it and falling back to defaults (the first unpatched attempt crashed in the menus). The source is public at that tag, the change is documented in `thirdparty/sgd2freeres/MODIFICATIONS.md` and reproducible with `tools/patch_sgd2freeres.py`, which satisfies the AGPLv3 source and modification-notice requirements. Don't ship a pre-built binary from any other build or fork (notably Jarcho's custom `SGD2FreeRes.dll`, AGPLv3) unless its source and licence are confirmed. When updating: take the official release DLL, run `tools/patch_sgd2freeres.py` (update its expected hash), repack with `tools/pack_lzma.cpp`, check the config/MPQ file names the new DLL reads against `BuiltinResMod.cpp` (read the binary's strings, not just the changelog), and record the new tag, zip hash and output hash in `MODIFICATIONS.md` and here. An unpatched official DLL is not a drop-in replacement.
- **Don't ping other people's threads.** In commit messages, PR descriptions and comments, never write a bare `#N` for an upstream issue/PR (in this fork GitHub resolves it to the upstream repo), nor `owner/repo#N` or a URL to someone else's issue or PR: each one posts a visible "mentioned in" entry on their thread, and it can't be removed afterwards. Write it as plain text instead ("upstream PR 188"). Files like `DEVELOPMENT.md` don't create references, so numbers are fine there.
- Only reuse code from forks that carry a licence file. All forks reviewed so far do.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ Many of the default settings of D2DX can be changed. To use a configuration file
D2DX was written by bolrog, with patches from Xenthalon. This fork is maintained by Jack Rayner.

D2DX embeds and uses the following third-party code:
- SGD2FreeRes (the resolution mod) by Mir Drualga, licensed under Affero GPL v3.
- SGD2FreeRes 3.0.3.1 (the resolution mod) by Mir Drualga, licensed under Affero GPL v3. This is the official release, with one file-name string changed so it reads D2DX's config (see [the modification notice](https://github.com/jackrayner/d2dx/blob/main/thirdparty/sgd2freeres/MODIFICATIONS.md)), from [mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution](https://github.com/mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution).
- RapidJSON by THL A29 Limited, a Tencent company, and Milo Yip, used by SGD2FreeRes and licensed under the MIT License (the licence file also covers some third-party components of RapidJSON).
- Detours by Microsoft.
- FNV1a hash reference implementation, which is in the public domain.
- FXAA implementation by Timothy Lottes. (This software contains source code provided by NVIDIA Corporation.)
Expand Down
33 changes: 33 additions & 0 deletions thirdparty/sgd2freeres/MODIFICATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Modifications to SGD2FreeRes in D2DX

D2DX embeds **SlashGaming Diablo II Free Resolution (SGD2FreeRes) 3.0.3.1** by Mir Drualga
(licensed under the GNU Affero General Public License v3 or later; see `SGD2FreeRes - LICENSE.md`
and `SGD2FreeRes - COPYING`). The embedded DLL is **modified**: one file-name string is changed.
Its complete corresponding source is the official source at tag `3.0.3.1` of
<https://github.com/mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution>, plus the change
described here. `SGD2FreeRes.mpq` is the official file, unmodified.

## The change (made 2026-10-24)

The official DLL reads its settings from a file named `SGD2FreeResolution.json` in the game folder.
D2DX writes its own copies of the SGD2FreeRes files (`d2dx_sgd2freeres.json`, `.dll`, `.mpq`) at
startup, so that it never overwrites an SGD2FreeRes installation a player already has. The one
change is in the DLL's read-only data: the string `SGD2FreeResolution.json` (23 bytes) becomes
`d2dx_sgd2freeres.json` (21 bytes) followed by two NUL bytes, at file offset `0x307cc`. Nothing else
differs (23 bytes in total), and no offsets move.

The 3.0.2.0 DLL that D2DX embedded before was the official 3.0.2.0 DLL with the same change (checked
byte for byte: the only difference was the same 23 bytes, at `0x2f964`).

## Reproducing it

1. Download the official release asset `SGD2FreeRes.3.0.3.1.-.Vanilla.zip` (SHA-256
`4469a1f8d5299e9af935d088324504be5eed948f49c26aa568797a77d1c28463`) from the release page of the
repository above, and extract `SGD2FreeRes.dll` (SHA-256
`ad59e227dfe1a4a1d26ce5f6b717a0ae27858656d14bf31ca8efb63becc50d39`).
2. `python3 tools/patch_sgd2freeres.py SGD2FreeRes.dll patched.dll` (it checks that hash first and
that the string occurs exactly once). The output has SHA-256
`408b1b5e0fd53295273a0c3af1745f4cac2554d73cf2e44f57337527c1c8bfa7`, which is the
`SGD2FreeRes.dll` in this folder.
3. `python3 tools/patch_sgd2freeres.py --verify SGD2FreeRes.dll <the DLL in this folder>` confirms it.
4. `SGD2FreeRes.dll.lzma` is that DLL compressed with `tools/pack_lzma.cpp` (see `AGENTS.md`).
203 changes: 203 additions & 0 deletions thirdparty/sgd2freeres/SGD2FreeRes - CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# SGD2FreeRes Changelog

## SGD2FreeRes 3.1.0.0 (Not yet available)
- Refactor and compile on Visual C++ 6.0.
- Improve compatability with every Windows system that can play
Diablo II.
- Remove requirement to install C/C++ runtime files, as they are
included with every Windows since Windows 95 OSR 2.

## SGD2FreeRes 3.0.3.1 (October 27, 2022)
- Extended the tile culling even more, to lessen the tile culling
problem in D2DX with motion prediction enabled.
- Fix issue preventing Windows 7 from loading the library.
- Add Diablo2Online server to the supported server list.

## SGD2FreeRes 3.0.3.0 (October 17, 2022)
- Add support for 1.10 and 1.12A. Credits to Jarcho for the ports.
- Fix a New Stats and New Skill button 800x600 alignment issue in
1.09D after using a waypoint.
- Extend the tile culling limit, so that tiles stay rendered with
extended field of vision and perspective mode enabled. Credits to
Szumigajowy for the starting point to fix this issue.
- Note that this does not fix room rendering boundary issues. Rooms
beyond the current adjacent rooms remain unrendered.
- Fix a Glide-only window resize issue when 800x600 isn't the second
resolution in the resolution list.
- Fix a crash caused by switching resolutions when 640x480 is the only
resolution in the resolution list.

## SGD2FreeRes 3.0.2.6d (September 18, 2022)
- Add Vahsify's "The Fury Within 1.02" server to the supported server
list.

## SGD2FreeRes 3.0.2.6c (August 15, 2022)
- Add Casual Nostalgia server to the supported server list.

## SGD2FreeRes 3.0.2.6b (August 3, 2022)
- Update Diablo09's event server in the supported server list.

## SGD2FreeRes 3.0.2.6 (June 26, 2022)
- Fix black rectangle being drawn when the Scroll of Inifuss screen is
open.

## SGD2FreeRes 3.0.2.5c (April 3, 2022)
- Updated timer's server in the supported server list.

## SGD2FreeRes 3.0.2.5b (February 5, 2022)
- Add Diablo 09's public test realm.

## SGD2FreeRes 3.0.2.5 (January 12, 2022)
- Fix crash in closed online games due to incorrectly-sized buffer for
storing the server's IP's SHA-1 hash.

## SGD2FreeRes 3.0.2.4d (January 10, 2022)
- Updated timer's server in the supported server list.

## SGD2FreeRes 3.0.2.4c (December 2, 2021)
- Add timer's server to the supported server list.

## SGD2FreeRes 3.0.2.4b (November 29, 2021)
- Add 1.09 DiabloFans to the supported server list.

## SGD2FreeRes 3.0.2.4 (November 05, 2021)
- Fix gateway IPv4 hash verification crash with code NTE_BAD_KEYSET.

## SGD2FreeRes 3.0.2.3b (November 05, 2021)
- Add Diablo II Evolution to the supported server list.

## SGD2FreeRes 3.0.2.3 (October 17, 2021)
- Add ZombiesRUs and D2 Rebirth to the supported server list.
- Fix D2Resurgence server not being properly detected. The IP address
entry has been updated.

Developer notes:
- MDC uses commit 30bda2723b8a18d1ddc3dca8e12f94c7aa2517c9.
- SGD2MAPI uses commit 7586477cd25d2bfd6a95e62199d885a2ac3543f2.

## SGD2FreeRes 3.0.2.2 (August 12, 2021)
- Fix interface bar background position cut off one pixel at the
bottom.

SGD2MAPI:
- Fix potential crash associated with game library paths.

Developer notes:
- MDC uses commit d86ca4fed14f08743c511d6d9fde323d5c66c5c3.
- SGD2MAPI uses commit 7586477cd25d2bfd6a95e62199d885a2ac3543f2.

## SGD2FreeRes 3.0.2.1 (June 9, 2021)
- Fix resolution reverting to 640x480 on gateway play, caused
by the number of config resolution being less than that on the
gateway.
- Fix a possible cause of D2SE version detection failing due to
improper string zero-termination.

1.09D Only:
- Fix crash after Act transition cutscene.

Developer notes:
- MDC uses commit e090165d9ce21534641104915bd0c75efad3dc2e.
- SGD2MAPI uses commit 8616bc941548fdf3541969694788e25c48dd2739.

## SGD2FreeRes 3.0.2.0 (May 1, 2021)
- Restore support for 1.13D.
- Add support for 1.14C and 1.14D.
- Add support for D2DX Glide wrapper. Special thanks to bolrog for
providing the extended API in D2DX.
- Add 856x480 resolution to all existing gateways.
- Add 1068x600 resolution to D2LOD.NET.
- Fix potential incorrect display of DirectDraw video mode.
- Fix config wiping when JSON is not valid.
- Display a warning and exit if the config is not valid JSON.

## SGD2FreeRes 3.0.1.1B (March 27, 2021)
- Add D2LOD.NET support. The custom resolution is 1024x768.

## SGD2FreeRes 3.0.1.1 (March 23, 2021)
- Add ProjectDiablo 2 support.
- Fix version detection bug that prevented D2SE from launching even
with valid values.
- Fix incorrect inventory positions caused by some resolution
configurations.
- Fix transfer of inventory arrangement positions between SP and MP.

## SGD2FreeRes 3.0.1.0 (March 13, 2021)
- Restore support for 1.13C.
- Support D2SE. Must be loaded using the PlugY.ini config.
- Fix video mode detection always incorrectly detecting DirectDraw
when game video mode is not controlled by command line options.
- Fix default assets mismatch for the right screen's border.
- Fix potential bug that may result in the New Skill button not
appearing correctly.

1.13C Only:
- Fix the aspect ratio window scaling when the maximize button is
pressed. Previously, the maximize button only scaled for 4:3 aspect
ratio even when the resolution's aspect ratio was different.
- Fix the restore down functionality when the maximize button is
pressed. Previously, the button would prevent re-maximizing the
game window when pressed.

Known issues:
- In 1.09D, Glide mode will sometimes crash from failed ingame
assertion "nIndex != INVALID_HARDWARE". It is currently unknown how
to consistently replicate the error.
- Glide mode displays incorrectly when the maximize button is pressed.

## SGD2FreeRes 3.0.0.1 (Feb 26, 2021)
- Support usage of CnC-DDraw as the DDraw wrapper.
- Reduce file size through optimization and the removal of code bloat.
- Fix incompatibility with PlugY.
- Fix improper resolution selection when largest resolution is set,
and 640x480 is excluded in resolution definitions.

Known issues (since last patch):
- In 1.09D, Glide mode will sometimes crash from failed ingame
assertion "nIndex != INVALID_HARDWARE". It is currently unknown how
to consistently replicate the error.

## SGD2FreeRes 3.0.0.0 (Dec 12, 2020)
- Rename the project to SGD2FreeRes, as the project can provide more
than just HD. Also sorts out confusion from folks who conflate HD
with higher quality graphics.
- Rewrite from the ground up, replacing D2Template with SGD2MAPI as
its core.
- Supports 1.09D, support for the other version need to be
ported back in at a later time.
- Use JSON format for config file.
- Uncap single player resolution. Resolutions can be added in the
config file.
- Cap multiplayer resolution is depending on the gateway.
- Support usage of nGlide as the Glide wrapper.
- Fix video option selection crash that would occur when Lighting
Quality is selected under certain circumstances.
- Fix Windows 10 error on game exit, when Sven's Glide Wrapper is
present, but the video mode was not Glide.

## D2HD 2.0.1.1 (Approx. Mar 2018 - Nov 2018)
- Add support for 1.12.
- Fix window resize issue upon game exit.
- Fix crash when using a non-standard resolution in DirectDraw or
Direct3D video mode.

## D2HD 2.0.1.0 (Approx. Mar 2018 - Nov 2018)
- Set resolution to 1068x600, as Slash wants to maintain consistency
with Resurgence.

## D2HD 2.0.1.0 Internal Release Candidate (Approx. Mar 2018 - Nov 2018)
- Set resolution to 1344x700, in case Slash wants to go with the
higher resolution.

## D2HD 2.0.0.1 (Approx. Dec 2017 - Mar 2018)
- Fix resolution reload on first game created. Would lag the game,
especially in Chaos Sanctuary.

## D2HD 2.0 (Approx. June - July 2017)
- Restore 640x480 resolution. New resolutions are added on top of
existing resolutions.
- (Possibly) added support for 1.13D.

## D2HD 1.0 (Approx. May 2017)
- Replace 640x480 with 1068x600.
- Only supports 1.13C.
Loading
Loading