If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#2334 Export P-code is exporting invalid code
Author:
Jishh_

Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: upgraded 

> What steps will reproduce the problem?
1. Have a .swf with a Button2 defined
2. Ensure the Button2 has a BUTTONCONDITION script attached
3. Export the p-code for the .swf file
> What is the expected output? What do you see instead?
I expect the exported p-code to exactly match what is shown in the GUI.
GUI:
ConstantPool "https://github.com/jindrapetrik/jpexs-decompiler", ""
Push constant0, constant1
GetURL2 false, false, 0
Exported P-code:
on(release){
ConstantPool "https://github.com/jindrapetrik/jpexs-decompiler", ""
Push "https://github.com/jindrapetrik/jpexs-decompiler", ""
GetURL2 false, false, 0
}
It looks like the CLI export is firstly resolving the constants, but then also wrapping
the P-code in the relevant condition. As expected, -importScripts then cannot import
because "on(release){" is not valid P-code. If I remote the "on(release){}", then
-importScripts can work fine.
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
v.21.1.0, Windows 11.
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
I've attached an example .swf to reproduce this. I'm trying to automate patching of the
AS2 code, with the below commands which caused me to notice this issue:
ffdec.bat -format script:pcode -export script .\source input.swf
.\scripts\modify-pcode.ps1 .\source
ffdec.bat -importScript input.swf input_modified.swf .\source

In nightly 2942 the header "on(release)" is removed from P-code export.
To the resolving constants:
I tried to set not resolving constants in GUI and the export worked as expected.
Remember that if you set to not resolve constants in GUI, you need to exit the GUI first
so the settings get saved. After the settings are saved, then you can use commandline and
have the same settings as in GUI.
If you want to override the settings in CLI, you can do it with option -config. Like this
way:
ffdec.bat -config resolveConstants=0 -format script:pcode -export script .\source Test.swf
State: new→upgraded