Eliot's Forum

Full Version: Tokens hard-coded?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am not sure if the values of tokens can be provided through a "native table" since there is no documentation supplied on the format.

My question is, is there any way to supply a table of token values for games with different token tables?


You can use the Native Generator under Tools -> Native Generator, then select all the script packages from said game, give it a name and hit save.
Yes, but this only applies to native functions (not expression tokens). The game that I tested the tool on has different values (non-default) for the expression tokens. In in the future it might be nice if you can provide a way to load a custom table.

I did a bit of digging and it does seem that this is hard coded.
Code:
if (nativeIndex >= 0x70)
{
    item = this.FindNT(nativeIndex);
}
else if (nativeIndex >= 0x60)
{
    byte num3 = this.uobjectStream_0.ReadByte();
    this.method_1(1);
    item = this.FindNT(((nativeIndex - 0x60) << 8) | num3);
}
else
{
    switch (nativeIndex)
    {
        case 0:
            item = new LocalVariableToken();
            goto Label_083A;

        case 1:
            item = new InstanceVariableToken();
            goto Label_083A;

        case 2:
            item = new DefaultVariableToken();
            goto Label_083A;

        case 4:
            item = new ReturnToken();
            goto Label_083A;

        case 5:
            item = new SwitchToken();
            goto Label_083A;

        case 6:
            item = new JumpToken();
            goto Label_083A;

        case 7:
            item = new JumpIfNotToken();
            goto Label_083A;

        case 8:
            item = new StopToken();
            goto Label_083A;

        case 9:
            item = new AssertToken();
            goto Label_083A;

        case 10:
            item = new CaseToken();
            goto Label_083A;

        case 11:
            item = new NothingToken();
            goto Label_083A;

        case 12:
            item = new LabelTableToken();
            goto Label_083A;

        case 13:
            item = new GoToLabelToken();
            goto Label_083A;

        case 14:
            item = new EatStringToken();
            goto Label_083A;

        case 15:
            item = new LetToken();
            goto Label_083A;

        case 0x10:
            item = new DynamicArrayElementToken();
            goto Label_083A;

        case 0x11:
            item = new NewToken();
            goto Label_083A;

        case 0x12:
            item = new ClassContextToken();
            goto Label_083A;

        case 0x13:
            item = new MetaCastToken();
            goto Label_083A;
....
Ah, wasn't sure if you meant the expression tokens. They are defined as enum's which are then compiled to hard-values. They cannot be changed at run-time this way.

What game are you talking about? And what are the tokens?