SWF Modification : Change the default Keymapping

Posts 1–4 of 4 · Page 1 of 1
SWF Modification : Change the default Keymapping
Why ? :
* Because i often clear flash cache and i am tired to remap keys each time i had do it
* Also because they changed the default nexus key which was fine for me.
* Because i can

Tools :
* RABDCASM
* Astrogrep
* (Optional) A tool to have a better understanding of the code, FFDEC or As3Sorcerer


Some words :
* This client is a 16.0.
* For the sake of the tutorial, we will only change the default nexus key
* But you can change any game keys
* This wont have any effect until you delete your flash cache or click on "reset to default" on the option panel you have modified a key.


How to :

First you have to open the Parameters.class.asasm file and find what method is runned when you click on the "reset to default" button
Its easy, you will find many string related to game keys like "moveLeft", moveup, moveright, etc...

You should find many sequence of codes looking like this :

Code:
     findpropstrict      QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG")
     pushstring          "moveLeft"
     getlex              QName(PackageNamespace("com.company.util"), "_-9R")
     getproperty         QName(PackageNamespace("", "#0"), "A")
     callpropvoid        QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG"), 2

     findpropstrict      QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG")
     pushstring          "moveRight"
     getlex              QName(PackageNamespace("com.company.util"), "_-9R")
     getproperty         QName(PackageNamespace("", "#0"), "D")
     callpropvoid        QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG"), 2

     findpropstrict      QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG")
     pushstring          "moveUp"
     getlex              QName(PackageNamespace("com.company.util"), "_-9R")
     getproperty         QName(PackageNamespace("", "#0"), "W")
     callpropvoid        QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG"), 2
moveUp is the name of the action. Its self-explanatory.
W is the NAME OF THE KEY assigned to the action ..
("com.company.util"), "_-9R") is the file name where the KEYCODES are DEFINED
> Com/company/util/_-9R.class.asasm

Usually, the name of the key is simple : the number of the key (0..9), "BACKSPACE", "ENTER", the letter "A".."Z".
Guess what? W is the letter W.

If we look into Com/company/util/_-9R.class.asasm

Code:
    findproperty        QName(PackageNamespace("", "#0"), "W")
    pushbyte            87
    initproperty        QName(PackageNamespace("", "#0"), "W")
the "W" name has the value 87, which is the Flash keycode for the "W" keyboard key

Flash ActionScript Key Codes

According to this page, the Flash Keycode for "Insert" is 45..

->To use the Insert key, we need to find in _-9R.class.asasm the name initializated at 45.
It is _-1Dz

Code:
findproperty        QName(PackageNamespace("", "#0"), "_-1Dz")
pushbyte            45
initproperty        QName(PackageNamespace("", "#0"), "_-1Dz")
->Then we must modify Parameters.class.asasm

Code:
     findpropstrict      QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG")
     pushstring          "escapeToNexus"  ; This is the definition of the nexus key
     getlex              QName(PackageNamespace("com.company.util"), "_-9R")
     getproperty       QName(PackageNamespace("", "#0"), "_-1Cw") ; -_9R.1cw = 18, Flash keycode for Alt
     callpropvoid       QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG"), 2
To
Code:
     findpropstrict      QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG")
     pushstring          "escapeToNexus"  ; This is the definition of the nexus key
     getlex              QName(PackageNamespace("com.company.util"), "_-9R")
     getproperty       QName(PackageNamespace("", "#0"), "_-1Dz") ; The "Insert" name we 've just found
     callpropvoid       QName(PrivateNamespace("*", "com.company.assembleegameclient.parameters:Parameters#0"), "_-1gG"), 2
Then recompile, and enjoy.

-> THOU SHALL ONLY MODIFY "PARAMETERS.class.asasm" FILE
Thanks! This is awesome.
I'd also like to make that "Allow rotation" is on by default, tutorial pls
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us