Welcome
Ladies and Gents:

These forums are now closed and registration disabled.

Please join us at our new forum on Proboards. Our hope is that these new forums are more stable, provide more and better features, and allow continuation of the project forums in a safer, more secure, long term environment.

me3explorer.proboards.com

--The ME3Explorer Team

Class object structure request

Technical research related to the structure of Mass Effect game files.

Class object structure request

Postby WarrantyVoider » 25 Aug 2012, 00:29

Image

now on SVN for those who want to try out. Obviously these class objects are a big list of referenced objects, so this is my quick'n' dirty approach testing it out, (choose scripts as preview) just reading int32 (4bytes) until the end. But also this seems not completely right, maybe someone can help guessing better...

here my code so far (easier than to explain it)
Spoiler:
if (pcc.Exports[n].ClassName == "Class")
{
byte[] raw = pcc.Exports[n].Data;
rtb1.Text = "";
int pos = 46;
int count = 0;
BitConverter.IsLittleEndian = true;
string s = "";
while (pos < raw.Length)
{
int index = BitConverter.ToInt32(raw, pos);
s += count + " : ";
if (index > 0 && index < pcc.ExportCount + 1)
s += pcc.getNameEntry(pcc.Exports[index - 1].idxObjectName);
if (index * -1 > 0 && index * -1 < pcc.ImportCount + 1)
s += pcc.getNameEntry(pcc.Imports[index * -1 - 1].idxObjectName);
s += "(" + index + ")\n";
count++;
pos += 4;
}
rtb1.Text = s;
toolStripStatusLabel1.Text = pcc.Exports[n].ClassName;
}
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: Class object structure request

Postby mnn » 25 Aug 2012, 01:13

Hi, wasn't handling of classes and decompiling bytecode in UnHood? You should base your code on that.
mnn
User
 
Posts: 42
Joined: 22 Aug 2012, 17:10
Has thanked: 1 time
Have thanks: 15 time

Re: Class object structure request

Postby WarrantyVoider » 25 Aug 2012, 12:08

I will explain unhood in another topic, but be assured I read it from UnHood, its just that it doesnt fit everywhere. Also there is no code that would fit in 10 lines, it spreads over several files, which makes understanding harder
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: Class object structure request

Postby Heff » 27 May 2015, 17:26

Been digging through these objects for a little thing I'm working on, so bringing this old thread back up!
If there's any newer information than what was posted here I'd be delighted to get linked to it, otherwise what I could deduce from today is shown below.

So the unreal Class object extends / shares a chain of smaller objects in the engine infrastructure,
therefor the definition below will be annotated to indicate which "structure" the data belongs to.
Each new structure marked with [] can be thought to extend the above ones.

Below is how I currently think we could parse the raw byte data if the Export object is of type 'Class':



[Object]
NetIndex | 4 bytes
DefaultProperties | X bytes | Only present for non-Class objects, so 0 bytes in this case

[Field]
SuperIndex | 4 bytes | Index of super class/struct/etc
NextFieldIndex | 4 bytes | index of the next object in this group (eg. next child, see ChildrenGroupIndex)

[Struct]
ChildrenGroupIndex | 4 bytes | index to the first children in a linked list of children.
ByteScriptSize | 4 bytes | presumably size of included script, seems unused?
DataScriptSize | 4 bytes | something like the above
DataScript | DataScriptSize bytes | some other kind of included bytecode, from newer engine versions.

[State]
Unknown | 4 bytes | unknown byte that I could not see present in the current engine versions
ProbeMask | 4 bytes | bit mask that specifies which probe functions are enabled/disabled (?)
IgnoreMask | 8 bytes | bit mask presumably for function ignoring, not sure exactly how this works.
LabelTableOffset | 2 bytes | offset into table where all state labels for this state are, presumably
StateFlags | 4 bytes | bit flag collection for modifiers/specifiers for this state
FunctionMapCount | 4 bytes | array with function references, seems to be all functions defined in this state/class
FunctionMap | FunctionMapCount * 12 bytes | (NameIndex[8], ObjectIndex[4])

[Class]
ClassFlags | 4 bytes | bit flag collection for class specifiers/modifiers
OuterIndex | 4 bytes | Index of the Outer class of this class. (eg. "classname within outerclassname")
ConfigNameIndex | 4 bytes | presumably an index into a config file name table or sorts
InterfaceCount | 4 bytes | number of interfaces this class implements
InterfaceArray | InterfaceCount * 8(?) bytes | (InterfaceIndex, TypeIndex)
ComponentCount | 4 bytes | number of components
ComponentArray | ComponentCount * 12 bytes | (NameIndex[8], NetIndex?[4])
DLLBindIndex | 4 bytes | index to the DLLBind name for this class (?)
DefaultPropertyIndex | 4 bytes | index of the object containing default properties for this class.
Unknown | 12 bytes |
FunctionRefCount | 4 bytes | count for table storing indexes to functions, maybe all call'able functions in the class?
FunctionRefArray | FunctionRefCount * 4 bytes | contains events as well.




This is by no means final, going to be looking into it more as I need it, hopefully end up coding some decent classes to handle this in the toolset / PCCEditor2.
Also a lot of this differs from other unreal-engine implementations subtly, with things seemingly trading places in the data, weird. (Component/interface maps for example are switched compared to most other versions)


Edit: Updated some info
Edit2: Clarified child list iteration
Edit3: Clarified Name reference/index size
Heff
Coder
 
Posts: 164
Joined: 23 Feb 2015, 20:02
Has thanked: 93 time
Have thanks: 61 time

Re: Class object structure request

Postby WarrantyVoider » 29 May 2015, 14:40

I think I made a tool called classviewer or something for me3, it should contain more information

greetz WV

PS: http://me3explorer.freeforums.org/viewtopic.php?f=26&t=762
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section

WarrantyVoider has been thanked by:
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: Class object structure request

Postby Heff » 29 May 2015, 14:51

Oh, just took a quick look and it seems to align with what I've found so far, thanks for telling me!
I'll double-check all of my structure with that one once I've finished mapping things out as best I can.

While we're at it, any other buried resources on script file structure/bytecode except ByteCode.cs and the research threads?
Heff
Coder
 
Posts: 164
Joined: 23 Feb 2015, 20:02
Has thanked: 93 time
Have thanks: 61 time

Re: Class object structure request

Postby WarrantyVoider » 29 May 2015, 14:54

nope, only unhood and feckless sdk

greetz WV
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section

WarrantyVoider has been thanked by:
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time


Return to Technical Research

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred