Skip to content

Commit

Permalink
[Reverse-engineering] [th02/maine] Identify all remaining global arrays
Browse files Browse the repository at this point in the history
Which is the last step on the way to completely position-independent
code, with no random hex numbers that should have been data pointers,
but weren't automatically turned into data pointers by IDA because
they're only ever addressed in the indirect fashion of

	mov bx, [bp-array_index]
	mov ax, [bx+0D00h] ; 0D00h is obviously an array of some sort

Removing all of these makes it practicable to add or delete code without
breaking the game in the process. Basic "modding", so to speak.

Automatically catching all possible cases where this happens actually
amounts to emulating the entire game, and *even then*, we're not
guaranteed that the *size* of the array just falls out as a byproduct
of this emulation and the tons of heuristics I would have thrown on top
of that. ZUN hates proper bounds checking and the correct size of each
array may simply never be implied anywhere.

So, rather than going through all that trouble of that (and hell, I
haven't even finished *parsing* this nasty MASM assembly format), and
since nothing really has happened in this project for almost two years,
I chose to just turn this into a text manipulation issue and figure out
the rest manually. Yeah, quick and dirty, and it probably won't scale if
I ever end up doing the same for PC-98 Policenauts, but it'd better work
at least for the rest of PC-98 Touhou.

Trying to do one of those per day from now on. Probably won't make it
due to the reverse-engineering effort required for the big main
executables of each game, but it'd sure be cool if I did.
  • Loading branch information
nmlgc committed Jan 4, 2017
1 parent 58e1e14 commit 915f780
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1,395 deletions.
2 changes: 2 additions & 0 deletions th02/th02.asm
Expand Up @@ -34,3 +34,5 @@ mikoconfig_t struc
unused_4 dw ?
score_highest dd ?
mikoconfig_t ends

END_LINE_LEN = 46

0 comments on commit 915f780

Please sign in to comment.