Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Decompiling Switch statments
#1
Hi.

I'm trying to decompiling some switchstatments, and are hitting a brick wall, most of them are decompiled correctly, but some don't.

I'm using UTPT and UE Explorer to check my results.
I also has an almost complete original source of the game as well.



The original Code:

Code:
static event string GetDescriptionText(string PropName)
{
    switch (PropName)
    {
        case "ServerName":    
            return default.GRIPropDescText[0];
        case "AdminName":    
            return default.GRIPropDescText[1];
        case "AdminEmail":    
            return default.GRIPropDescText[2];
        case "MessageOfTheDay":    
            return default.GRIPropDescText[3];
    }

    return Super.GetDescriptionText(PropName);
}

UE Explorer

Code:
static event string GetDescriptionText(string PropName)
{
   switch(PropName)
   {
       case "ServerName":
           return default.GRIPropDescText[0];
       case "AdminName":
           return default.GRIPropDescText[1];
       case "AdminEmail":
           return default.GRIPropDescText[2];
       case "MessageOfTheDay":
           return default.GRIPropDescText[3];
       default:
           return super(Info).GetDescriptionText(PropName);
   }
   //return;    
}

UTPT
Code:
function string GetDescriptionText(string PropName)
{

    switch (PropName)
    {
        case "ServerName":
        return Default.GRIPropDescText[0];
        case "AdminName":
        return Default.GRIPropDescText[1];
        case "AdminEmail":
        return Default.GRIPropDescText[2];
        case "MessageOfTheDay":
        return Default.GRIPropDescText[3];
        default:
    }
    return Super.GetDescriptionText(PropName);
    return;
}


The problem is "return Super.GetDescriptionText(PropName);" witch in the original code is after the switch code, UTPT places it correctly, but UE explorer places it in default:
My code is even worse, and that is why I was looking into why.

Here is the raw hex:
[Image: j60vhs.png]

I suspect that the problem occurs because the default: is empty in the switch

This is from Unreal Tournament Package File Format(v1.6).pdf by Antonio Cordero.

Quote:Size is the size of the Condition

expression. The end of the switch
is unknown except maybe for
some hints inside it.


It might also be just this game that has the issue(America's Army 2.5), but I hope that you have an idea how to detect the end of the switch in this cases.
Reply


Messages In This Thread
Decompiling Switch statments - by ELiZ - 03-22-2015, 01:46 AM
RE: Decompiling Switch statments - by eliot - 03-24-2015, 05:07 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)