UI / windowing#
Purpose#
Win32 main window creation, window class registration, the application message loop, pointer/cursor handling, and startup status reporting.
Key entry points#
| Symbol | Retail addr | GoG addr | Role |
|---|---|---|---|
lotr2_winmain |
0x41680b | 0x40e9ab | Application entry from entry(); owns message loop |
lotr2_ui_create_main_window |
0x4cc954 | 0x4b2258 | RegisterClassA / CreateWindowExA |
lotr2_ui_wndproc |
0x40209a | 0x4b29be | Registered WNDPROC pointer (GoG: merged with impl body) |
lotr2_ui_wndproc_impl |
0x4cd0a4 | — | Decompiled window procedure body (retail only; GoG uses lotr2_ui_wndproc) |
lotr2_ui_hwnd_main |
0x50773c | 0x4e5a00 | Global main HWND |
lotr2_ui_show_loading_msg |
0x4ca1fc | 0x4afab9 | Format status string into screen buffer |
lotr2_ui_flush_status_txt |
0x4ca57d | 0x4afe3a | Append formatted text to status.txt |
lotr2_ui_status_timestamp |
0x4cabdf | 0x4b049b | Prefix status lines with _asctime |
lotr2_ui_show_load_phase_msgs |
0x4ccd32 | 0x4b2636 | Multi-line load progress during asset init |
lotr2_ui_resize_scratch_buffer |
0x4cccac | 0x4b25b0 | Realloc PL8/asset read scratch (lotr2_ui_asset_scratch_ptr) |
lotr2_ui_poll_pointer_state |
0x4cc062 | 0x4b191e | GetCursorPos → backbuf coords; button edges |
lotr2_ui_set_cursor_theme |
0x4cc437 | 0x4b1cf3 | SetCursor by UI theme id |
lotr2_ui_hit_test_point |
0x4cc52f | 0x4b1deb | Point-in-rect test for click targets |
lotr2_ui_mouse_x |
0x5042cc | 0x4e65fc | Cursor X in client/backbuf space |
lotr2_ui_mouse_y |
0x5042d0 | 0x4e65f4 | Cursor Y; paired with lotr2_ui_mouse_x |
lotr2_ui_yield_hook |
0x4cc524 | 0x4b1dd5 | Cooperative yield stub (called every frame) |
lotr2_ui_frame_tail_hook |
0x4cc519 | 0x4b21cf | Empty frame-tail callback (GoG alias; see gog-symbol-map) |
lotr2_ui_spin_step_a / _b / _c |
0x4cc8cb–0x4cc8e1 | Busy-wait steps used by lotr2_ui_spin_delay_* |
|
lotr2_game_ui_queue_screen_action |
0x489419 | Queue screen action; sets overlay mode 0x27 | |
lotr2_game_ui_restore_screen_mode |
0x489491 | Pop overlay mode and restore prior screen | |
lotr2_game_ui_input_dispatch |
0x489129 | Route UI actions from slot flags (see game MODULE) |
Palette fade (screen mode 0x23)#
Transition screens use lotr2_gfx_begin_palette_fade, lotr2_gfx_fade_arm,
and lotr2_gfx_fade_step to interpolate DirectDraw palette entries before
restoring the prior lotr2_game_screen_mode. See gfx/MODULE.md.
See ../../docs/scenes/system-dialogs.md
for the scene-catalog entry.
Dependencies#
user32.dll—RegisterClassA,CreateWindowExA,GetMessageA,PeekMessageA,DispatchMessageA,DefWindowProcA,GetCursorPos,SetCursor,PostMessageAgfx/MODULE.md— display init after window createaudio/MODULE.md— initialized fromlotr2_winmainasset/MODULE.md— file reads logged via status.txt
Data files#
| File | Role |
|---|---|
status.txt |
Startup/load progress log (lotr2_ui_flush_status_txt) |
diverged.txt |
Optional multiplayer state dump (lotr2_ui_write_diverge_txt) |
Window title string Lords2, class WinLords2Class.
Open questions#
- Ghidra exports
lotr2_ui_wndproc(0x40209a) asLAB_only; body may be atlotr2_ui_wndproc_impl(0x4cd0a4). Confirm with debugger or re-export. - Purpose of empty
lotr2_ui_yield_hook— present hook removed in retail build?