Jump to content

Photo

NativeTables for UE Explorer


  • Please log in to reply
12 replies to this topic

#1
twinj

twinj

    Enthusiast

  • Members
  • PipPip
  • 113 posts
Attached File  NativesTableList_XCOM_1.zip   1.51KB   45 downloads

These can be found in Core.upk, Engine.upk.

And in these classes:

Object.class, Actor.class, Controller.class,

I checked other main upks and there are no native functions in them (XComGame, Stratgey, Framework)

I could not find location of last 3 or native functions on the list. XCOM adds natives that are not in the 2011UDK. The extra natives are in the Object.class

For those who wish to understand the format of the list

//--------------------------------------
//--- 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;

Edited by twinj, 09 January 2013 - 05:38 PM.


#2
EliotVU

EliotVU

    Regular

  • Members
  • PipPip
  • 61 posts
I'm quite surprised there's interest for this :dance:

I might as well release the source code for NTL files: https://gist.github....bfdb650b45708b8

#3
twinj

twinj

    Enthusiast

  • Members
  • PipPip
  • 113 posts
Lol. Thanks Eliot. Looks like I reversed correctly. :biggrin:

#4
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

This Native Table List really needs to be added to the standard tools list on the wiki. It's really quite essential!

 

With this I was able to correctly decompile XGAIBehavior -- without it, the virtual sizes were calculated incorrectly, so the if/else conditional brackets were all messed up.

 

All these mods I've done have been without this -- I can't believe it! @[email protected]

 

EDIT:

It decompiled CLOSER to correct. There are still a few glitches with the calculation of the virtual size -- I'm guessing it has to do with the 3 natives that twinj coudn't find?


Edited by Amineri, 30 April 2013 - 09:35 PM.


#5
dubiousintent

dubiousintent

    Resident poster

  • Premium Member
  • 8,878 posts

Added to Wiki tools list 'here'. 

 

Need a separate subject article explaining what these tables are and how they are used.  Anyone interested in contributing, there is a template 'here' and guidelines 'here'.

 

Edit: the bare bones start of an article is now 'here'.

 

-Dubious-


Edited by dubiousintent, 09 May 2013 - 06:33 AM.


#6
bokauk

bokauk

    Fan

  • Members
  • PipPipPip
  • 483 posts

Can someone please explain what this Natives Table List does exactly, and how it might be useful?

To test it out, I saw a reference to LineOfSight so I opened Engine.upk > Controller. LineOfSightTo first with the XCOM NTL, then closed it and loaded it again with the UDK-2012-05 NTL, but I saw no difference at all.

I know the native functions are inside the .exe, so I'm quite lost what this NTL does :blink:



#7
johnnylump

johnnylump

    Resident poster

  • Supporter
  • PipPipPipPipPip
  • 7,425 posts

I think they're just the interpretation guidelines for bytecodes into decompiled code. I was using an old one on XGStrategyAI, AddLateMission, and it didn't decompile the modulo function correctly, but switching to the most recent (2012-5) did the trick.



#8
EliotVU

EliotVU

    Regular

  • Members
  • PipPip
  • 61 posts

The NativeTables are necessary for UE Explorer to detect if a bytecode is for a specific Native function. Here's an example:

 

// Export UObject::execSaveConfig(FFrame&, void* const)
native(536) final function SaveConfig();

 

as you can see this function is native and has this number 536 which is the bytecode that will represent the call to this function, so whenever UE Explorer sees a bytecode with a high number it'll assume there's another one, so a 2 bytes bytecode and then it'll scan the NativesTableList for this number which has the name of each function and its number, and so this way UE Explorer knows the name, format and anything else necessary.

 

UE Explorer includes a tool that can automatically generate these tables by simply loading every package suspicious of having such native function declarations(note only those with the numbers matter). These numbers may vary from game to game so NTLs are needed to solve this issue.




#9
dubiousintent

dubiousintent

    Resident poster

  • Premium Member
  • 8,878 posts

Thanks, Eliot.  This explanation has been added to the Wiki page on NativeTables.

 

-Dubious-



#10
bokauk

bokauk

    Fan

  • Members
  • PipPipPip
  • 483 posts

Thanks for the explanation; it makes a whole lot more sense to me now :smile:

 

I suspect it's not likely, but is there any way to find the native function's address within the .exe by using it's bytecode id/number, or by any other method?

 

For example, I can see the string "UObjectexecSaveConfig" grouped with all of the other native function names in the exe, but how does the game then know where that function is in the exe file?

 

No worries if you're not sure, but I thought I'd ask just in case anyway :smile:






IPB skins by Skinbox
Page loaded in: 0.967 seconds