fallout2-re icon indicating copy to clipboard operation
fallout2-re copied to clipboard

Some thoughts on existing symbols

Open ghost2238 opened this issue 2 years ago • 10 comments

First of all, awesome work! This looks like a very promising approach considering a lot of other successful engine reversing projects with a thriving community. The progress is already great.

I noticed some symbols not being named (random example): https://github.com/alexbatalov/fallout2-re/blob/main/src/game_dialog.c#L1806 which is known already as gdProcessChoice_

There's an IDA DB here: https://www.dropbox.com/s/tm0nyx0lnk4yui0/Fallout_1_and_2_IDA68.rar which contains a lot of info (from https://github.com/phobos2077/sfall), not sure if you've looked at it already.

Also, a collection of reversing docs: https://fodev.net/files/fo2 Call structure: https://rotators.fodev.net/atom/F2_function_structure.txt Symbol (functions/globals) dump: https://fodev.net/files/fo2/symbols.html

I could take a look at writing some code to automatically rename/refactor most raw memory addresses to the already known names, at least as a first pass and contribute as pull requests.

ghost2238 avatar May 04 '22 20:05 ghost2238

Hey, thanks for this info. I was not aware of how much work has already been done before I even started. I've only checked falltergeist and sfall for their interpretation of some struct fields early in the process.

I've checked your renamed stuff. This is indeed a great start. What I don't like is that these names are not uniform and does not match the style of the remaining codebase. Can you prefix all your renamed symbols with underscore, so we know it's a subject for review?

alexbatalov avatar May 07 '22 07:05 alexbatalov

I've checked your renamed stuff. This is indeed a great start. What I don't like is that these names are not uniform and does not match the style of the remaining codebase. Can you prefix all your renamed symbols with underscore, so we know it's a subject for review?

Sure, I totally understand wanting to fix the naming style mismatch. Could definitely do that, since it's been done by some code I've written, it's a quick change.

I also generated a table like this: https://fodev.net/files/fo2/fallout2_re.html - I guess it's obsolete now with the renaming, but maybe it's a useful reference for review?

Note that the "Matched function" column is just what's defined here: https://fodev.net/files/fo2/fallout2.sym - the arguments and return types are more incomplete (some of it from sfall) than what you've already implemented and can thus be mostly ignored. In fact I'm working on updating it (automatically) based on fallout2-re.

ghost2238 avatar May 07 '22 08:05 ghost2238

@ghost2238 Can you provide a map of renamed symbols?

alexbatalov avatar May 11 '22 17:05 alexbatalov

@ghost2238 Can you provide a map of renamed symbols?

Map? In what format, something different than in the links in first post?

ghost2238 avatar May 11 '22 18:05 ghost2238

Simple text file will be enough:

dword_123 _something_pretty
sub_321 _do_something

alexbatalov avatar May 11 '22 19:05 alexbatalov

renamed.txt

ghost2238 avatar May 11 '22 20:05 ghost2238

Thanks, with this fantastic bulk rename stuff we'll finish reference edition much sooner than I expected.

alexbatalov avatar May 11 '22 22:05 alexbatalov

Hello,

maybe it was already pointed out, but the original Macintosh releases came with full symbol tables in the elf executables. If function names are not all known yet, it is a good source. Fallout2's mapper2.exe contains full dwarf debug information which can be extracted using Open Watcom. Mapper2 integrates a lot of functionality from the game executable as well as GNW95 down to local variables level, structures, type defs, etc.

The M.A.X. Port project's GNW reimplementation is also based mostly on Mapper2. You can check it out too, maybe there are some still to be done overlaps.

klei1984 avatar Jul 28 '22 21:07 klei1984

I also tried to do some reverse engineering of Fallout 2 last year (wanted to make a source port, ha-ha), however kinda ditched the idea after about a month of work. Not that I'm very familiar with RE myself, but I'll still check if I can find something useful to contribute.

Iniquitatis avatar Jul 29 '22 05:07 Iniquitatis

Hey, this is definitely worth checking, thanks. I was wondering where those symbols came from, now it's perfectly clear.

alexbatalov avatar Aug 03 '22 06:08 alexbatalov