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

ME3 Enum Data

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

ME3 Enum Data

Postby FemShep » 03 Feb 2016, 04:09

I believe I have figured out enums in ME3. It's not exactly hard but ME3Explorer doesn't do it. I don't really feel like fleshing this out (or making a GUI) for it, but I'll document what I found and post my code which should be fairly easy for someone to put in ME3Explorer if they want.

Enum, which means enumeration, is essentially a map of a name to a number or vice versa... kind of? I've never really understood enums. But it defines a closed set of values that are accepted when coding, and no other values are valid, where a map of names => numbers or vice versa can be an open set. It is a standard data structure in many programming languages.

In enum export data, the integer at byte 20 (0x14) is the number of items in the enum. Following this at 0x18 (byte 24) is a list of 8 byte items that represent nameindexes, with 4 bytes name index, 4 bytes 0.

I am unsure what all the stuff at the start indicate, and I don't know how to figure out what the value the names map to.
Here's an example.
Image

When this data is dumped you would get the following list.
Code: Select all
[CB: 0x09]SFXGame.BioPlayerController.ETutorialHooks(Enum) (Superclass: Class) (Data Offset: 0x 3E1DC)
TUT_Storm
TUT_Cover
TUT_Mantle
TUT_MeleeHeavy
TUT_MeleeLight
TUT_AmmoPickup
TUT_Reload
TUT_WeaponSwapWheel
TUT_WeaponSwapButton
TUT_CastPowerWheel
TUT_CastPowerButton
TUT_AssignedPower
TUT_MeleeFromCover
TUT_CoverSlip
TUT_SWATRoll
TUT_TurnCoverCorner
TUT_SquadCommand
TUT_ClimbUp
TUT_ObjectiveCheck
TUT_MAX


Here's a class that can represent an enum.. kinda ugly, but it seems to work
Code: Select all
using System;
using System.Collections.Generic;

namespace TransplanterLib
{
    class SFXEnum
    {
        public static readonly int enumCountOffset = 21;
        private byte[] data;
        List<String> names = new List<String>();
        int numItems = 0;
        private PCCObject pcc;


        public SFXEnum(PCCObject pcc, byte[] data)
        {
            this.pcc = pcc;
            this.data = data;
            numItems = BitConverter.ToInt32(data, 20);

            int i = 0;
            while (i < numItems)
            {
                int nameindex = BitConverter.ToInt32(data, i * 8 + 24);
                i++;
                names.Add(pcc.Names[nameindex]);
            }
        }


        public override string ToString()
        {
            String str = "";
            foreach (string name in names)
            {
                str += name + "\n";
            }
            return str;
        }
    }
}
Image
ME3Tweaks has modding guides, tools, forums for mods, a modding wiki, and ModMaker, an online mod creation tool.
ME3 Mod Manager, the civilized way of installing and managing ME3 mods.
ME3Tweaks Facebook Page
User avatar
FemShep
Modder
 
Posts: 1101
Joined: 18 Oct 2012, 20:48
Has thanked: 42 time
Have thanks: 76 time

Return to Technical Research

Who is online

Users browsing this forum: No registered users and 1 guest

suspicion-preferred