List of issues
: WARNING - support of the decompiler is now VERY LIMITED. There are no active developers. This means waiting times in the issue tracker are very long and mostly depend on community. Sorry for the inconvenience.
#1198 Making small modifications to script causes game to crash
Labels: AS3Direct Editation
> What steps will reproduce the problem? Open SWF file, find a script. Change a boolean value, string, or delete a small block of code. Save SWF. When modifying a byte or string, the SWF file size increases by approximately one KB. Attempt to launch the game by its EXE (Adobe AIR launcher?), game crashes before main window opens. > What is the expected output? What do you see instead? The game to run like normal, without crashing. > What version of the product are you using? Is it "nightly build"? Which operating system do you have? Both 8.0.1 stable and 8.0.1 nightly build 1340. Windows 10 64 bit. > Please provide any additional information below. If the problem is related to a SWF file, attach it here, otherwise we can't help you. The game is called "RPG Tycoon", available for free on Steam as a demo. I'm attempting to play around with some of the build in scripts. The SWF is over 92MB, I'm not sure it can be attached here.
Please specify what do you edit exactly. I can see here another file, which is 60MB, so probably you can attach 92MB also.
Server is having issues, this is a test...
Ok, looks like the server is not having issues anymore! I kept getting server errors whenever I tried to make a post. Anyways, to answer your request: > Please specify what do you edit exactly. So I open up the SWF (see the links, it will not upload here). I open the script \scripts\GV, and go to line 36. I change the variable from "1" to "2". I hit the small save button, then the large button. I launch the game, and it crashes before it can load. Here are the links: Original: https://mega.nz/#!bMpUhJBb!hZ51vECiMrI_mLG3dKps9Jcg7Bw5zWm3qMYKIaY80PQ Modified: https://mega.nz/#!jRJEnRCB!N0J_2TeH9CkCK_qBULxJXjdisAXE3dj-msz8CqIFC3g Note that the file size has changed by approximately one kilobyte, even though I'm only changing the value of a string.
"I'm only changing the value of a string": It doesn't matter what do you change, the whole ActionScript (all methods in the current class) should be compiled. If there is a bug in the compiler the result will be wrong.. (as it is wrong now) If you add only a space, then remove it, so tries to compile exactly the same script, the result will be also wrong... Thanks for the bug report, it will be fixed sooner or later:) But if you want to change only a small thing, i suggest you to use p-code editing. It doesn't need script compiling, only parsing, so it is much more reliable (not experimental) and it modifies only 1 method body, not all in the current class.
> It doesn't matter what do you change, the whole ActionScript (all methods in the current class) should be compiled. I guess I'm confused as to why you said "Please specify what do you edit exactly" when it didn't matter anyways? None the less, thank you for the responses! Please let me know how I can help with getting this fixed, if you need me to run more tests or provide additional feedback. I'm not quite sure what you mean when you tell me to edit the P-Code... Is this via the Slot/Const Trait editing window?
Ad "please specify" There can be two cases: A) You added new code which has wrong game logic or B) It does not matter what you change and the script is incorrectly compiled back We do not know which case so we ask you what changes you did. If the problem occurs even if you press space and delete it and click save then it is problem on our side, if you added incorrect code then it is your fault. So please specify whether it is case B or not. In both cases the script is compiled back and the SWF will have different size even if you did not add any line of code. It is different compiler than original so different bytecode. And yes, P-code is on right side. There is no title "P-code", it would be better if we add it. Editing code on right side is not marked as experimental, which should be more reliable.
And it does matter which script/class, so "\scripts\GV" was also a useful information. This information was missing from the first comment.
OK, I think I understand. No new code was being added as far as I know, all I had to do was change a byte, boolean, or string value to cause the crash to occur. It may be worthwhile to note that the changes I made were in statically declared variables, outside of the constructor for the class. It also seems that attempting to modify these values via P-Code simply does not work (the changes are reverted when I save) even though the variables are never changed anywhere else in the code.
I think you changed the value in the trait editor, not the pcode. Here: trait Qname(PackageNamespace(""),"VERSION") slot slotid 0 type Qname(PackageNamespace(""),"String") value Utf8("1") <=== "1" to "2" Right? Ok, it is similar, and it is in the same location, the only difference that the dialog title is "Slot/Const trait" Sorry, there was a bug saving this trait. I fixed it in the latest nightly (1368 or newer) Please try it. Now you should be able to change the (simple) value here. There is a warning: "Static fields and consts are often initialized in initializers. Editing value here is usually not enough!" This means that sometimes (for example when the value is a complex object, array, but i think it can occur for simple values, too) you should find the initialization in the left bottom window (Traits and Consts), Traits panel. Select scripts or class initializer. Then change the pcode in the ritht window. Some info/question for/to JPEXS: As i understood the problem is that the trait value comes from ConvertData.assignedValues, right? The warning message could be more accurate. Show it only when the value really comes from this map. I haven't changed the direct edit problem, so it is still wrong, will be fixed by JPEXS later.
Try using the p-code deobfus button. It can work miracles. :)