The following warnings occurred:
Warning [2] Undefined array key "previewpost" - Line: 164 - File: inc/plugins/htmlposts.php PHP 8.3.13 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/htmlposts.php 164 errorHandler->error_callback
/inc/class_plugins.php 142 htmlposts_parse
/inc/class_parser.php 153 pluginSystem->run_hooks
/inc/functions_post.php 829 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "previewpost" - Line: 164 - File: inc/plugins/htmlposts.php PHP 8.3.13 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/htmlposts.php 164 errorHandler->error_callback
/inc/class_plugins.php 142 htmlposts_parse
/inc/class_parser.php 153 pluginSystem->run_hooks
/inc/functions_post.php 829 postParser->parse_message
/showthread.php 1121 build_postbit




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
#2
Hey, I am aware of this issue but could never resolve it, because from the perspective of the decompiler they are both identical and there is no clear indication in the bytecode as to where the default block ends. Nonethless if you were to compile the decompiled code the logic would still be identical to the Unreal Engine, thus it's not exactly a problem in this case Wink
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)