Th14/Binary hacks
From Touhou Patch Center
< Th14
|
This page is locked for editing because it contains crucial data required for the basic operation of the patch engine. Please discuss possible improvements or additions on the Talk page; after review, these may then be added to the main page here. |
Contents
Bugs
Fix buffer overflow in spell name rendering (replace pointer)(buffer_overflow_spell ) |
||
---|---|---|
Description | The strcpy is replaced by spell_align; this replaces the pointer accordingly. | |
Address |
|
|
Code |
|
Safe sprintf (short, call)(sprintf_call ) |
||
---|---|---|
Address |
|
|
Code |
|
Safe sprintf (long, call)(sprintf_long_call ) |
||
---|---|---|
Address |
|
|
Code |
|
Safe sprintf (short, replace pointer)(sprintf_rep ) |
||
---|---|---|
Address |
|
|
Code |
|
Safe sprintf (long, replace pointer)(sprintf_long_rep ) |
||
---|---|---|
Address |
|
|
Code |
|
Logging
Restore the game's built-in logging(log_restore ) |
||
---|---|---|
Description | Very useful for debugging. | |
Address |
|
|
Code |
|
Textbox size
Correct text length calculation for the DDC variety of Fairy Wars-style text boxes(ddc_textbox_size ) |
||
---|---|---|
Description | In theory, this is the same hack as for th128..
However, th14 starts to use MMX instructions to calculate the size of the text box... and for some reason, thcrap's GetTextExtent clears out the xmm2 register containing the multiplication factor, resulting a box with "length zero". After removing that unnecessary strlen(), we end up with plenty of space to read the value for xmm2 back from the original, constant position in memory. This also leaves space for another fix. In case the text length calculation results in a width smaller than 28 pixels (this happens for example with Hime's "You!"), the original code would create an infinitely long text box, due to the width being treated as unsigned. Thus, we clear out eax in this case. |
|
Address |
|
|
Code |
|
Correct text length calculation for the DDC variety of Fairy Wars-style text boxes(ddc_textbox_size_full ) |
||
---|---|---|
Description | Same hack as for the trial, just using xmm1 instead. | |
Address |
|
|
Code |
|
Spells
Prepare deferred spell name fetching(spell_name_fetch ) |
||
---|---|---|
Address |
|
|
Code |
|
Spell card alignment(spell_align ) |
||
---|---|---|
Description | Kill the strcpy (buffer overflow) and strlen, shift up/optimize part of the original code (because less code is always better), and fudge around so that it looks nice. Fairly straightforward. | |
Address |
|
|
Code |
|
Player data
Remove spell "alignment" in the result screen(result_spell_align ) |
||
---|---|---|
Description | For some reason, ZUN feels the need to do some alignment calculations based on the string length. Why. | |
Address |
|
|
Code |
|
Music Room
Prepare music room title fetching(music_title_prepare ) |
||
---|---|---|
Description | Oh no, a constant memory address. -.- | |
Address |
|
|
Code |
|
Workaround for the broken update notification functionality in 2014-01-03
Update notification for 2014-01-03 (jump)(thcrap_migrate_jump ) |
||
---|---|---|
Address |
|
|
Code |
|
Update notification for 2014-01-03 (check and message)(thcrap_migrate_msg ) |
||
---|---|---|
Address |
|
|
Code |
|