isledecomp / isle

A work-in-progress decompilation of LEGO Island (1997)
1.79k stars 89 forks source link

Handle duplicate thunks in BETA10 #1113

Closed disinvite closed 1 month ago

disinvite commented 1 month ago

Debug builds put their thunk functions right at the start of .text. To match these up, we just scan the list in orig and recomp and look for cases where each points to the same real function that has already been matched.

I had assumed each thunk would only appear once, but there are duplicates in BETA10. (I would guess that only one ends up being used in most/all cases.)

This changes match_thunks() so that we detect any duplicates and match in order of the thunk's virtual address. This is probably a naive way to do it, but it works fine for the code in its current state. (Open question: does thunk order depend on module order?)