Fireboyd78 / native-gen

Tool for generating IDA scripts to aid in reverse-engineering of GTA 5.
10 stars 4 forks source link

Native Generator

Tool for generating IDA scripts to aid in reverse-engineering of GTA 5.

Requirements

Usage

This tool requires a dump file that is usually generated by the reverse engineer. It is not meant to read from an EXE or any game files. See below for how your dump file should be structured.

NOTE: I haven't implemented native hash translation yet, so it's likely you won't be able to generate for now. If you would like to help, please submit a pull request.

Options

File Format

ASCII

NOTE: The ASCII format is currently not implemented. The format below may be subject to change.

# NativeDump                        ; Magic (MUST be exactly as shown!)
.version <dump_version>             ; Dump version (as an integer)
[                                   ; Beginning of natives list
    <native_hash> <func_offset> ;   Native list entry (format may vary depending on version)
    <...>                           ;   MUST NOT be separated by commas or anything else besides a space.
]                                   ; End of natives list

Unlike the binary format, you don't need to follow a strict, sequential format. For example, you could do something like this:

# NativeDump
.version 191
.gta_build 323
[
    0xDEADBEEFF000BAA2 0xBADC0DE2
]
# Looks like Joe screwed up the exporter again...
.native_count 0

ASCII is much more flexible, but the filesize will definitely increase! Pick your poison wisely!

Binary

Binary dumps are simple files that must be in little-endian. For most purposes, version 1 dumps should suffice.

struct NativeDumpFile
{
    int32 magic = 0x5654414E; // 'NATV'
    int32 version;            // version of dump
    int32 native_count;       // number of dumped natives (MUST NOT include failed ones during native dump!)
    /*
        Depending on which version dump you are using, the natives list
        may or may not follow directly after the native count.

        For version 1 dumps, the list is directly after the count.
    */
    struct NativeEntry
    {
        int64 hash; // native hash
        int64 func_offset; // function offset in the EXE
    } natives[native_count]; // Native list size will be (native_count * sizeof(NativeTableEntry))
    /!*
        This space should NOT be used to store extra data.
    *!/
}

Contributing

Want to contribute to the project? Submit a pull request!

Please keep the following guidelines in mind:

Special Thanks