Th12/Binary hacks

From Touhou Patch Center
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Bugs

Score counter bugfix (jumps)
(fix_score_1)
Description Original hack by Nereid. Corrects the score display for scores exceeding 231 points by changing signed jumps and multiplications to unsigned ones.
Address
v1.00b0x401631, 0x40166a, 0x4016ab
Code
73
Score counter bugfix (multiplications)
(fix_score_2)
Description Original hack by Nereid. Corrects the score display for scores exceeding 231 points by changing signed jumps and multiplications to unsigned ones.
Address
v1.00b0x401651, 0x401699, 0x4016cf
Code
e1
Safe sprintf (call #1)
(sprintf_call_1)
Address
v1.00b0x46078d
Code
50
e8 [strings_vsprintf]
8944e4 14
push eax
call [strings_vsprintf]
mov dword ptr ss:[esp+0x14],eax
Safe sprintf (call #2)
(sprintf_call_2)
Address
v1.00b0x460839, 0x460929
Code
50
e8 [strings_vsprintf]
8944e4 1c
push eax
call [strings_vsprintf]
mov dword ptr ss:[esp+0x1c],eax
Safe sprintf (replace pointer)
(sprintf_rep)
Description The safe sprintf pointer is at a different ESP offset in both functions. Thus, we simply leave out the offset from this hack, as it's already at the same position in the original code.
Address
v1.00b0x4608b7, 0x4607d4, 0x46099b
Code
8b5ce4
mov ebx, dword ptr ss:[esp+

Spells

Spell card alignment
(spell_align)
Description Same procedure as always. Don't forget that this one push indeed uses ESP (th12 was compiled with stack frames turned off), calculate the correct stack offset, and you're set.
Address
v1.00b0x460867
Code
8b96 80040000
51
d1ea
83e2 01
52
ffb4e4 a8000000
ffb4e4 a8000000
ff35 54e54c00
53
e8 [GetTextExtentForFont]
83c0 04
50
db04e4
58
85c0
90
mov edx,dword ptr ds:[esi+480]
push ecx
shr edx, 1
and edx, 00000001
push edx
push dword ptr ss:[esp+0xa8]
push dword ptr ss:[esp+0xa8]
push dword ptr ds:[th12.4ce554]
push ebx
call [GetTextExtentForFont]
add eax, 4
push eax
fild dword ptr ss:[esp]
pop eax
test eax, eax
nop

Player data

Remove spell "alignment" in the result screen
(result_spell_align)
Address
v1.00b0x46098a
Code
31c0
xor eax,eax