Skip to content

Fix character progression extraction in PLRSAVE2_CheckPlayerFlags - #238

Merged
Lectem merged 1 commit into
ThePhrozenKeep:masterfrom
devtejasx:fix/progression-bit-shift-200
Sep 15, 2026
Merged

Lectem merged 1 commit into
ThePhrozenKeep:masterfrom
devtejasx:fix/progression-bit-shift-200

Conversation

@devtejasx

Copy link
Copy Markdown
Contributor

Fixes #200.

CLIENTSAVEFLAG_CHARACTER_PROGRESSION_MASK is already shifted (0x1F << CLIENTSAVEFLAG_CHARACTER_PROGRESSION_BIT), so PLRSAVE2_CheckPlayerFlags masking after the shift selects bits 16-20, and the uint8_t truncation then drops them. nProgression is 0 for every character, so the difficulty gates below it always return PLRSAVE2ERROR_NIGHTMARE_NOT_UNLOCKED / PLRSAVE2ERROR_HELL_NOT_UNLOCKED.

Mask first, then shift - the first form suggested in the issue, and what sub_6FC8A780 in PlrSave.cpp (line 840) already does for the same field. One line.

Checked with a standalone probe over progressions 0-15: before, the extracted value is 0 for all of them; after, it tracks the field and the Nightmare gate opens at 5 for an expansion character.

CLIENTSAVEFLAG_CHARACTER_PROGRESSION_MASK is already shifted
((0x1F) << CLIENTSAVEFLAG_CHARACTER_PROGRESSION_BIT), so masking after the
shift instead of before it looks at the wrong five bits: the expression
selects bits 16-20 of the flags and then truncates to uint8_t, which drops
them. nProgression is therefore 0 for every character, whatever their real
progression, and the difficulty gates below always report
PLRSAVE2ERROR_NIGHTMARE_NOT_UNLOCKED / PLRSAVE2ERROR_HELL_NOT_UNLOCKED.

Mask first, then shift, matching sub_6FC8A780 in
PlrSave.cpp, which reads the same field correctly.

Verified with a standalone probe over progressions 0-15: before the change
the extracted value is 0 for all of them and an expansion character is never
allowed into Nightmare; after it, the value tracks the field and the gate
opens at 5 (expansion) as the flag comment describes.

Fixes ThePhrozenKeep#200
@Lectem
Lectem merged commit ccb4130 into ThePhrozenKeep:master Sep 15, 2026
4 checks passed
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.

progression bit check mistake

3 participants