Search code examples
actionscript-3flash

Find what _local_x or _arg_x means?


I am working on a large Flash project. I have tried "Goto Declaration" but that doesn't seem help. Btw I am using FlashDevelop. And Yes I can perfectly compile and build TO 100% working source. Here is a code sample. I know you can't do much with this but tell how I can work with this.

public function aim_(_arg_1:Vector3D, _arg_2:Vector3D, _arg_3:ProjectileProperties):Vector3D
        {
            var _local_4:Vector3D;
            var _local_5:GameObject;
            var _local_6:Vector3D;
            var _local_7:Number;
            var _local_8:Number;
            var _local_9:int;
            var _local_10:Boolean;
            var _local_11:int;
            var _local_12:Boolean;
            var _local_13:* = undefined;
            var _local_14:int = Parameters.data_.aimMode;
            var _local_15:Number = (_arg_3.speed_ / 10000);
            var _local_16:Number = ((_local_15 * _arg_3.lifetime_) + ((Parameters.data_.Addone) ? 1 : 0));
            var _local_17:Number = 0;
            var _local_18:Number = int.MAX_VALUE;
            var _local_19:Number = int.MAX_VALUE;
            aimAssistTarget = null;
            for each (_local_5 in map_.goDict_)
            {
                if (_local_5.props_.isEnemy_)
                {
                    _local_10 = false;
                    for each (_local_11 in Parameters.data_.AAException)
                    {
                        if (_local_11 == _local_5.props_.type_)
                        {
                            _local_10 = true;
                            break;
                        };
                    };

Solution

  • What you're trying to achieve is reverse engineering a decompiled code. With "_local" variables you need to investigate what values they are assigned, in what algorithms do they participate, and here you just need to read this single function in its entirety to be able to discern meaning of those local variables. But, you would also need to understand many of the named parameters to get some of those meanings. For example, _local_11 iterates through some Parameters.data_.AAException list of ints, and is compared with current outside loop iterator's props.type_, therefore "AAException" should mean "AA exemption" and _local_10 provides check result, whether current enemy is exempt from AA (whatever is that AA). And so on.

    Same with _arg_X variables, you need to find out what's being passed into a function from wherever it's called, and retrieve the context of those parameters, also taking their type into consideration, like here _arg3 is of type "ProjectileProperties", meaning this function should relate to some projectile which properties affect its outcome somehow. Most likely it's taking two vectors of projectile (or source, this is outside of this code) and target (or speed, same here), and generates another vector of yet unknown purpose.

    When you have investigated every function like this, you'll have quite a bunch of pieces to a single puzzle that you can combine by references, discovering all the algorithms that combine the code of whatever app you've decompiled. Then you will be able to do targeted modifications of whatever kind you wanted initially. But yes, it'll be better if you'd have access to actual sources from whoever created this the first time.

    In short: Think. Think, think and think.