acdream/docs/research
Erik 1e1d3875f7 sky(phase-3g): fix LCG multiplier — 360 (DaysPerYear), not 7620
Ran a live memory probe against retail acclient.exe (new tool:
tools/RetailTimeProbe/) to read the TimeOfDay struct at
DAT_008ee9c8 and compare against our computed values. The decompile
agent's identification of TimeOfDay+0x10 as "SecondsPerDay (int
copy)" turned out to be WRONG — the live value is **360**, which is
GameTime.DaysPerYear.

The retail FUN_00501990 LCG seed is:
  seed = Year × (*+0x10) + DayOfYear
       = Year × DaysPerYear + DayOfYear
       = flat "total days since epoch" day-index

Our previous Phase 3c port passed 7620 (DayLength in ticks) as the
multiplier, producing seed=883,967 against retail's seed=41,807 —
completely different LCG outputs, completely different DayGroup
picks. That's why the user's retail kept showing stormy/rainy while
acdream showed sunny/clear (or vice versa) even after Phases 3c.1
and 3f aligned Year and DayOfYear.

Also confirmed by the probe:
  - EpochBase / ZeroTimeOfYear = 3600   ✓ Phase 3f already correct
  - BaseYear / ZeroYear = 10            ✓ DerethDateTime.ZeroYear
  - Year=116, DayOfYear=47              ✓ our AbsoluteYear / DayOfYear
  - SecondsPerDay float (+0x0C) = 7620  ✓ DayTicks
  - SecondsPerYear = 2,743,200          ✓ YearTicks

One "finding that's not a fix": retail's +0x48 DayFraction is a
sub-period fraction (fraction through current day/night window)
NOT a full-day fraction. CurDayEnd - CurDayStart = 2857.5 = 0.375
of a day = 6 Dereth hours = night duration. Not relevant for our
keyframe bracket interpolation, which correctly uses a full-day
0..1 scale matching the SkyTime.Begin values. Documented in the
probe research doc so future work doesn't trip on it.

Changes:
- tools/RetailTimeProbe/ — new P/Invoke tool. Forced x86 target to
  match retail's bitness so hardcoded DAT_xxxxxxxx addresses are
  pointer-width-correct. Handles ASLR relocation via
  Process.MainModule.BaseAddress.
- src/AcDream.App/Rendering/GameWindow.cs: RefreshSkyForCurrentDay
  passes 360 (DaysInAMonth × MonthsInAYear) not 7620.
- src/AcDream.Core/World/SkyDescLoader.cs: ActiveDayGroup(ticks)
  and DefaultDayGroup same.
- docs/research/2026-04-23-retail-memory-probe.md — full probe
  results + decompile-agent correction.
- AcDream.slnx — add tools/ folder.

Build + 733 tests green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 10:17:38 +02:00
..
decompiled research: full acclient.exe decompilation — 22,225 functions, 688K lines 2026-04-12 23:25:51 +02:00
deepdives docs+feat: 13 retail-AC deep-dives (R1-R13) + C# port scaffolds + roadmap E-H 2026-04-18 10:32:44 +02:00
retail-ui docs+feat(ui): retail UI deep-dive research + C# port scaffold 2026-04-17 19:13:02 +02:00
2026-04-12-movement-deep-dive.md docs: movement deep dive — AC2D + holtburger cross-reference 2026-04-12 21:52:12 +02:00
2026-04-21-animation-audit.md docs(research): animation-pipeline decompile audit — no real gaps 2026-04-21 21:18:45 +02:00
2026-04-21-sky-deep-audit.md fix(sky): scale keyframe Luminosity/Transparent/MaxBright from percent → fraction 2026-04-22 17:38:44 +02:00
2026-04-22-sky-lighting-decompile.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
2026-04-23-daygroup-selection.md sky(phase-3c): port retail FUN_00501990 DayGroup picker (uniform LCG) 2026-04-24 08:45:34 +02:00
2026-04-23-retail-memory-probe.md sky(phase-3g): fix LCG multiplier — 360 (DaysPerYear), not 7620 2026-04-24 10:17:38 +02:00
2026-04-23-sky-dat-schema.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
2026-04-23-sky-decompile-hunt-A.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
2026-04-23-sky-decompile-hunt-B.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
2026-04-23-sky-decompile-hunt-C.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
2026-04-23-sky-references-crossref.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
2026-04-23-sky-retail-verbatim.md sky(phase-1): revert speculative tint, add ACDREAM_DUMP_SKY diagnostic 2026-04-23 18:06:52 +02:00
acclient_animation_map.md fix(anim): implement adjust_motion — TurnLeft/SideStepLeft play backward 2026-04-13 12:17:26 +02:00
acclient_animation_pseudocode.md research: full animation pseudocode from decompiled acclient.exe 2026-04-13 12:43:44 +02:00
acclient_architecture_map.md docs: comprehensive architecture plan for acdream 2026-04-13 14:23:50 +02:00
acclient_decompiled.c research: decompile acclient.exe terrain/physics via Ghidra headless 2026-04-12 23:18:27 +02:00
acclient_function_map.md research: complete acclient.exe function map — 70+ identified functions 2026-04-12 23:46:22 +02:00
acclient_indoor_transitions_pseudocode.md research: indoor transition pseudocode from ACE + decompiled analysis 2026-04-13 13:56:16 +02:00
transition_pseudocode.md docs(research): collision transition system pseudocode from decompiled + ACE 2026-04-13 23:41:13 +02:00