nfsu2-re

https://github.com/yugecin/nfsu2-re

Prologue #

This is just me documenting while I have fun attempting to reverse-engineer the game Need For Speed Underground 2, otherwise knows as nfsu2.

This normally belongs to https://github.com/yugecin/nfsu2-re.

How this site is structured #

Injected code #

The code for all injected things I did can be found in nfsu2-re-hooks/*.c. It's configured as a VC2005 project in a VC2005 solution. The project emits a compiled file to ..\NeedForSpeed U2\scripts\nfsu2-re-hooks.asi. I'm using the Ultimate ASI Loader by ThirteenAG, which loads the library nicely for me (download the ZIP and place the dll in the game folder, name it dinput8.dll).

Symbol generation notes #

Symbol information (functions, structs, enums, vars) is generated from the SPEED2.idc file which can be found on the idc branch of the repository. This file is generated by IDA - The Interactive Disassembler from the IDA database that I'm making (this database is not shared, but the idc file has nearly everything). I'm using IDA freeware 7.7.220118.

Global variables are missing types #

The generated idc file does not contain type information of global variables when that type is a pointer. One example is smsDatas, which has type struct SmsData*, but this information is missing from the idc and thus in these docs it shows up as int with /*unconfirmed type*/.

The same counts for some primitive types like int, for example numSmsDatas.

Some other types do show up correctly, like when the type is a struct or float or double, for example twoPi.

There is some code to manually set the type by using the following format on the first line of the (non-repeating) comment of the symbol: @docgen:type:struct MyStruct *, but this is rarely used (most likely only when it's actually used in written docs) and this comment could be out of date.

Unconfirmed struct member types #

In IDA, the difference between a struct member that has a type set and a struct member that has no type set is not very visible. Because of that, some struct members might be missing an explicit type, because it is simply forgotten to set their type correctly. The type shown will still most likely be correct, as the struct member's size may be translated into char or short or int, but it will have an /*unconfirmed type*/ tag.

(old single-page documentation, obsolete)