Jump to content

NativeTables for UE Explorer


twinj

Recommended Posts

 

 

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
Link to comment
Share on other sites

  • 3 months later...

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! @_@

 

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.


Link to comment
Share on other sites

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:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...