Native Tables - XCOM:EU 2012

From Nexus Mods Wiki
Jump to: navigation, search

Overview

Native Tables refer to interpretation guidelines for byte-codes into decompiled code. The tables referenced here were developed for use within the UE Explorer tool. Discussion about them may be found on the XCOM Nexus Mods Talk forum.

To quote the author of UE Explorer:
'Native functions are written in C++ which is compiled to the GAME.exe file. UE Explorer outputs a comment above the function's declaration indicating what it might be called in the Export table of the .exe file, though this could be inaccurate in some games.

For example: "// Export UXGGameData::execIsHuman(FFrame&, void* const)"

Say the C++ name is execIsHuman, you could try to look for that with a reverse-engineering tool.'

Occasionally these tables are updated as new conversion guidelines are developed.

Programs and Tools

Details

As explained by the author of UE Explorer:

XCOM Native Tables are found in

and in these classes:

Table list structure

//--------------------------------------
//--- 010 Editor v4.0.3 Binary Template
//
// File:
// Author:
// Revision:
// Purpose:
//--------------------------------------
local int j;

typedef struct {
    BYTE StringLength;
    CHAR Name[StringLength];
    BYTE OperatorPrecedence;
    enum <BYTE> FUNCTION_TYPE { function = 1, operator = 2, preoperator = 3, postoperator = 4} Type;
    DWORD HexCode <format=hex>;
    
} ENTRY <read=ReadENTRY>;

string ReadENTRY(ENTRY &Entry) {
    string s;
    SPrintf(s, "native(%d) %s(%d) %s", Entry.HexCode, EnumToString(Entry.Type), Entry.OperatorPrecedence, Entry.Name);
    return s;
}

typedef struct {
    for (j = 0; j < count; j++) {
        ENTRY Entry;
    }
} ENTRIES <read=ReadENTRIES>;

string ReadENTRIES(ENTRIES &Entries) {
    string s;
    SPrintf(s, "Names: %d", count);
    return s;
}

// Code start here
LittleEndian();
// Check to make sure it's a file
DWORD MagicNumber;
if (MagicNumber != 0x2C8D14F1) {
    Warning("Not a valid native table file");
    return 1;
}

//Read number
DWORD count;

ENTRIES Entries;


References

Referred to by this article:

That refer to this article: