Skip to content

fix: update the embedded SGD2FreeRes to 3.0.3.1 (extended tile culling) - #29

Merged
jackrayner merged 6 commits into
mainfrom
build/sgd2freeres-3.0.3.1
Oct 24, 2026
Merged

jackrayner merged 6 commits into
mainfrom
build/sgd2freeres-3.0.3.1

Conversation

@jackrayner

@jackrayner jackrayner commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Replaces the embedded SGD2FreeRes 3.0.2.0 with the official 3.0.3.1 release from the original repository, mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution (tag 3.0.3.1, published by the repo owner on 2022-10-27, asset SGD2FreeRes.3.0.3.1.-.Vanilla.zip, SHA-256 4469a1f8d5299e9af935d088324504be5eed948f49c26aa568797a77d1c28463), plus one 23-byte change (below).

Why: at large custom resolutions (seen at 1128x752 on 1.14d under Wine) black, tile-shaped patches appear at the top-right screen edge. Tests narrowed it down: still there with motion prediction off, mostly gone at the vanilla 800x600 view. The official changelog says 3.0.3.0 extends the tile culling limit and 3.0.3.1 extends it further "to lessen the tile culling problem in D2DX with motion prediction enabled". Both are newer than the 3.0.2.0 we embed. It also carries other fixes (a crash after Act transition cutscenes, a Windows 7 load fix). The official notes say rooms beyond the adjacent ones can still be left unrendered, so some edge artifacts may remain.

The one change (and why the first attempt crashed): the official DLL hard-codes its config file name, SGD2FreeResolution.json. D2DX writes its own d2dx_sgd2freeres.json so it never overwrites a player's own SGD2FreeRes files. An in-game test of the unmodified official DLL ignored D2DX's config, wrote defaults pointing at a non-existent SGD2FreeRes.mpq, and crashed in the menus. The 3.0.2.0 DLL we embed today turns out to be the official 3.0.2.0 DLL with exactly this string changed (checked byte for byte: 23 bytes differ, nothing else; the MPQ is identical to official). So the same change is applied to 3.0.3.1: SGD2FreeResolution.json becomes d2dx_sgd2freeres.json in place, nothing else touched. tools/patch_sgd2freeres.py applies and verifies it (it checks the official hash first and that the string occurs exactly once); thirdparty/sgd2freeres/MODIFICATIONS.md is the modification notice and reproduction steps, and ships in the release zip. Patched DLL SHA-256 408b1b5e0fd53295273a0c3af1745f4cac2554d73cf2e44f57337527c1c8bfa7.

Other changes

  • SGD2FreeRes.mpq unchanged (byte-identical to before and to the official file).
  • Embedded .lzma resources regenerated with a new tools/pack_lzma.cpp, validated first: it unpacks the old resources to the old files exactly and reproduces the old .lzma byte for byte. Must be built 32-bit and unoptimised (PocketLzma has undefined behaviour otherwise); AGENTS.md has the commands.
  • Licence files updated (AGPLv3-or-later, new LICENSE.md adds a D2DX section), RapidJSON licence added and shipped in the zip, README credits updated, and the stale 5 MB SGD2FreeRes.pdb removed.
  • AGENTS.md records the official source, the modification, and the update procedure, including checking the file names the DLL reads (strings in the binary, not just the changelog).

Verified in the game: the CI build of this branch (run 40114730108) was played on 1.14d under Wine/Proton (Lutris) at 1128x752 on a 2256x1504 screen. It starts and runs, the black tile patches seen with 3.0.2.0 at the top-right screen edge are completely gone (reported by the player), the DLL written out at startup has the expected patched hash, and no SGD2FreeResolution.json is created (so the patched DLL reads D2DX's config). The unpatched official DLL crashed in the menus, which is why the one-string patch is needed. Still untested: other game versions and native Windows.

Follow-up (not in this PR): this SGD2FreeRes version also supports 1.10 and 1.12A, but BuiltinResMod still only enables the resolution mod on 1.09d, 1.13c, 1.13d and 1.14d.

🤖 Generated with Claude Code

jackrayner and others added 6 commits October 24, 2026 17:43
Replaces SGD2FreeRes 3.0.2.0 (May 2021) with release 3.0.3.1 (published
2022-10-27) from the original repository,
mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution, asset
"SGD2FreeRes.3.0.3.1.-.Vanilla.zip". This is the official release, not a
fork's build.

Zip SHA-256:
4469a1f8d5299e9af935d088324504be5eed948f49c26aa568797a77d1c28463

3.0.3.0 and 3.0.3.1 extend the tile culling, which should reduce the black
tile-shaped patches at the screen edge at large resolutions. They also add
1.10 and 1.12A support to the mod.

Also: the .mpq is unchanged from 3.0.2.0; the .lzma files are regenerated
(the .mpq one is byte-identical); licence and readme files updated;
Changelog.txt replaced by CHANGELOG.md; RapidJSON licence added; the 5 MB
SGD2FreeRes.pdb, which belonged to the old DLL, is removed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A small program that packs and unpacks the .lzma files embedded by d2dx.rc,
using the bundled PocketLzma. With its BestCompression preset, built 32-bit
and unoptimised, it reproduces the existing SGD2FreeRes .lzma files byte for
byte.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SGD2FreeRes 3.0.3.1 bundles RapidJSON, so its licence file goes into the
licenses folder with the other third-party licences.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
README credits now name SGD2FreeRes 3.0.3.1 (official release) and RapidJSON.
AGENTS.md points at tools/pack_lzma.cpp for regenerating the embedded .lzma
files, and records the source, tag and zip SHA-256 of the embedded
SGD2FreeRes build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The official 3.0.3.1 DLL only reads SGD2FreeResolution.json, so it ignored the
config D2DX generates, wrote defaults pointing at an MPQ that does not exist, and
crashed in the menus. Change that one file-name string in the official DLL to
d2dx_sgd2freeres.json (23 bytes, in place). The 3.0.2.0 DLL embedded before was
the official one with the same change. tools/patch_sgd2freeres.py applies and
verifies it; MODIFICATIONS.md is the modification notice and reproduction steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Credit line, release zip (the modification notice goes into licenses/) and the
AGENTS.md update procedure, which now says to read the DLL's strings and not
only the changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jackrayner
jackrayner merged commit 4bb1089 into main Oct 24, 2026
4 checks passed
@jackrayner
jackrayner deleted the build/sgd2freeres-3.0.3.1 branch October 24, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant