REDIVIVUS

Proposals / #1132

AUTOMAP_DrawTextCentered's wide-text buffer holds 23 wchars, not 26

applied · by Nugwa628 · submitted 2026-11-04, applied 2026-11-04

Ghidra v1897 · 8222e32

The original sizes the buffer as 23 WCHARs by both constants it is used with, and its frame has no room for 26: 0045a763 SUB ESP,0x34 (one 4-byte slot at [EBP-4] plus 0x30 for the buffer at [EBP-0x34]); 0045a78f PUSH 0x2e / 0045a793 LEA EAX,[EBP-0x34] / 0045a796 PUSH 0 / 0045a799 CALL 00681ef0 (memset, 0x2e = 23*2 = sizeof); 0045a7a1 PUSH 0x17 / 0045a7a5 LEA ECX,[EBP-0x34] / 0045a7a8 CALL 00526320 (UTF8_ConvertToWideChar, 0x17 = 23 = element count); 0045a7ba and 0045a7cc LEA ECX,[EBP-0x34] pass it to DRAW_text0 00501820 and DRAW_text 00502320. A 26-element (52-byte) buffer needs SUB ESP,0x38. Same storage (Stack[-0x38] = EBP-0x34), no other local overlaps. Called from AUTOMAP_DrawPartyMember 0045ac84.

Changes 1, applied together

  1. Retype variable win 0x0045a760 Stack[-0x38]

    typeWCHAR[26]→WCHAR[23]