Anti-cheat off, weapon sets 6-7 in hero files

- The game's cheater detection killed the hero ("Hase!") whenever its
  protected stat mirror was stale; the mirror is now refreshed from the hero
  whenever it is unlocked, stream checks never punish, loadHero no longer
  sets the cheater flag (docs/anticheat.md).
- saveHero wrote the items of weapon sets 1-5 only: its loop runs over all 7
  sets, so sets 6-7 survive a world loading the hero from the hero file.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-25 01:33:43 +02:00
1 parent 3978060954
commit 91bbc52cf0
7 files changed
+210

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
# Anti-cheat off
## Request (2026-10-25)
The Gladiator (Character03, level 106) "randomly exploded" fighting an
underleveled dragon on Silber. The user: the cheater detection is not
necessary, remove it.
## Measured
A temporary damage log showed the hero at full health (17200) going to 0 in
one tick, with the game logging `cheat statBonus 0/3`, `cheat SkillLevel 0..7`,
`Hase!` and `cObjectManager::destroy: tried to delete local hero #1!`; the hero
came back with 1199 health and died to the next hit.
- The game mirrors the local hero's fields on a protected page (pointers
`0x182cddc`, second copy `0x182cde0`): +0 hero +0x3b4, +4 hero +0x3ee (gold),
+8 hero +0x3fe (u16), xor-ed with the hero's key byte (+0x38) repeated four
times (the second copy: key << 1); +0xc a raw copy of hero +0x3b0..+0x49d
(attributes, skill levels). Writer: `0x603d9c` and other places after
legitimate changes, all starting with `VirtualProtect(page, 0x1000,
PAGE_READWRITE)` and ending with `0x201`.
- Checks: `cCreature::Think` about once in 101 ticks (`rand() % 101 == 10`,
`0x5389b5`), `VerifyHeroMirror` `0x5905f0` (callers `0x57fc71`,
`0x580001`, `0x580331`, `0x61ce22`), inline copies at `0x4659f6`,
`0x564c6f`, `0x57e09c`, `0x585bd0`, `0x619d33`, and a trap in Think
(`0x5385a6`: a creature whose level exceeds its experience by more than 3
gets fields raised behind the mirror's back). A mismatch resets the field
(attributes 1, skill levels 0); any mismatch, or no hero at all, kills the
hero ("*** Cheater detected! ***", health 0, action dying) and sets the
cheater flag `0x182cdd0`, saved in the hero file (record +0xf3, `0x604409`)
and read back by loadHero (`0x6066eb`).
- Stream checks in the quest manager's hero data (`0x465980`): a marker
`0xfea4fea4` (`0x467782`) and three stored values compared with the hero
(`0x46a60b`, `0x46a64e`, `0x46a696`).
- In the failing log every skill level mismatched: the mirror was stale
(changes outside the game's mirror writers, e.g. the shared hero loaded into
another world).
## Mod (`src/mods/anticheat.cpp`)
- `VirtualProtect` hook: when the mirror page is made writable, the mirror is
rewritten from the current hero first. Checks then compare the hero with
itself; writers overwrite it as before. The game's control flow is
unchanged (skipping the inline checks would not be safe: code after some of
them uses registers they set).
- Patches: the stream checks' jumps past the punishment are unconditional;
loadHero never sets the cheater flag (a flagged character is clean after its
next save).
Confirmed by the user 2026-10-25 (attributes fine, no more exploding).
+10
View File
@@ -189,3 +189,13 @@ only (or disabled in multiplayer).
table for the extra controls), layout, rendering, hit tests, drag & drop.
6. Keys: 0-6 cast art slots (since 2026-10-15; before: 1-7 select and
cast), F1-F7 select weapon sets.
### Hero files: items of sets 6-7 (2026-10-25)
Reported: the Gladiator lost the weapons of sets 6/7 on Silber. saveHero
collects the items it writes (chunk 0xc2) from the weapon sets with
`GetWeaponSetItem` over sets 0..4 (`cmp esi, 5` at `0x605046`), so sets 6-7
kept ids of items that were never in the hero file; a world that takes its
hero from the hero file (Silber without its own hero inventory) had nothing
there. The loop bound is patched to 7 (inventory_save.cpp); loadHero's id
replacement already covers the shadow slots. Confirmed 2026-10-25.
+23
View File
@@ -223,3 +223,26 @@ hero), but both the Spielen screen and the options window still need a lot
of fine-tuning. Details to be collected when we get to it; known so far:
list scrolling beyond 9 characters, larger heading font, the options
window's layout in the width beyond its 1024 frame.
## Quest book: all quests, unknown ones as "???" (2026-10-25)
Request: every quest appears in the quest book; quests not yet activated show
as "???", so a player knows how many quests an area holds without being told
where they are. Notes: the quest table (g_quests 0xaa9e98, 0x124 per quest,
game/engine/quests.h) lists all quests of the campaign, including the generic
repeatable ones (ids 2600..3599, cloned by Quest_End) and DQ_ dynamic quests;
which of them count for an area, and how the book groups by area, is still to
be measured.
## Megamap zoomed view: markers shifted (2026-10-25)
Reported: on the M map, clicking a location to zoom in shows the markers on
the zoomed map wrong / shifted (megamap.cpp).
## Load / save progress screen: rock background (2026-10-25)
Reported: the progress screen shown while loading / saving does not use the
rock-wall background of the other menu screens yet (hud::RenderMenuFrame,
docs/screens.md). The GDI progress screen is DxDriver7_LoadingScreen
0x6469d0 (1024x768, game/addresses.h); pictures PAK\loading0/1.bmp,
loadgame.bmp, savegame.bmp, LoadingUW00/01.bmp.