I used JPEXS Free Flash Decompiler to decompile the game code from file “game_v3.1.5SBfolk2.swf.swf”.
I used Fiddler to substitute original SWF with patched SWF using Autoresponder feature.
I used Mozilla Firefox to capture “game_v3.1.5SBfolk2.swf.swf” file.
1. You should know that the game code is obfuscated now. They did it after version 2.2.3. You need to find an old, non obfuscated SWF file with the game, such as game_v2.2.3.swf I got from google search.
http://bit.ly/1DLazaq or http://ujeb.se/XwSgO
2. Open the non-obfuscated SWF file in the “JPEXS Free Flash Decompiler”.
3. The class responsible for drawing guidelines is called VisualGuide and can be found in scripts, pool, components, cue.
I used to enhance the game experience by using drawGuideRecursive and calling it multiple times. This resulted in guidelines for each collision and guidelines for a collision of the collision, etc… At the current version of the game the code is removed. Although, it is possible to fix the current version and draw next level ball collision guidelines.
They left is drawGuideLessSharpAngle function which does not have such capabilities. The drawGuideLessSharpAngle draws the guidelines. The code which calculates its length is in lines 323,324 of the old file.
4. You need to find a corresponding piece of obfuscated code in the latest version of the SWF file.
5. Before setproperty …”length” which sets the guideline length you will want to add some value to it. For example by pushing a big number on the stack and adding it.
6. Edit and save modified p-code.
7. Serve it using Fiddler. Remember to refesh the page in a way that the browser does not fetch from local cache. In Firefox press Ctrl+F5.
JPEXS Free Flash Decompiler – https://www.free-decompiler.com/flash/download.html
Fiddler – http://www.telerik.com/fiddler
More detailed analysis of the code:
I know that I’m looking for VisualGuide class (How do I know that? I guessed that from analysing the whole game code). Then, I open the old “game_v2.2.3.swf” file. I search for “VisualGuide” class. Ctrl+F. Type in “VisualGuide”. I know that I’m looking for “drawGuideLessSharpAngle” because this is what the game uses in “public function updateGuide() : void”. To find coressponding code in obfuscated file I use 2 things. First I know that the “drawGuideLessSharpAngle” is the last method in “VisualGuide” class. Second, I can see some constants in the “drawGuideLessSharpAngle” such as “var loc2:uint = 16777215;” or “var loc3:Number = 0.3;”. They are most likely to repeat in the obfuscated file too. The pattern of variables initialization is a clue as well. Cascaded if structures are clues. Parameters to method calls are clues. Constants passed to methods are clues.
So I look at it and I look at obfuscated code. I search for 16777215 thinking it will be repeated. Lucky me it’s the 4th match in the obfuscated code and this is also the last method of the “VisualGuide” class. Old file now. Look at “if(loc5 != null)”, “var loc5:Collision = this.m_cTable.findFirstCollisionBall(loc4,Number.POSITIVE_INFINITY);” checks if there is a collision with a ball, otherwise it skips the code below. Okay, lets carry on. “_loc4” is a LogicBall object (line 287).
Lets skim read the code. Line 301: loc10 is checking if we have “Bad” contact enables (say a game with no guidelines). and it is a ball-ball collision. If so we want to draw crossed circle (302-307). Otherwise, we want to draw guidelines and a white circle (308-312). If at 313 is also extra checking if there is a ball collision. We are interested in this case so lets carry on. Inside If you can see that it is getting the logical ball (319). Getting some velocities, doing some maths and finally calling “calculateGuideLength” twice at 323 and 324 for 2 rays. That’s it.