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.
![List of issues](/flash/images/issue_list.png)
#2206 Some values in Hex dump mode have wrong data type
Author:
Mikhail
![user user](/flash/images/user.png)
Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: GUI
State: upgraded ![Help](/flash/images/help.png)
![Help](/flash/images/help.png)
> What steps will reproduce the problem?
Switch to Hex dump mode, unfold any DefineShape tag, select shapes -> fillStyles ->
fillStyle -> bitmapMatrix.
Look at scaleX, scaleY, rotateSkew0, rotateSkew1.
> What is the expected output? What do you see instead?
Values listed above should have fixed-point bit value type. But they are shown as signed
int type - i.e 1310720 instead of 20 or 2551360 instead of 38.93
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
v20.1.0, Win10 22H2 (19045.2364)
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
Try DefineShape (185) from attached file, for example. I think the same applicable to all
objects which use matrices (scaleX/Y for DefineSprite (189) are also show int value).
![Download](/flash/images/disk.png)
You made a great program here, thanks to it I managed to make a script that extracts some
images from gameswf files (like attached above). But still not all of them, I'm still
struggling with some values - can't comprehend what is DeltaX, where is starting drawing
position which moved by moveDeltaX, how exactly rotateSkew works - official "SWF FILE
FORMAT SPECIFICATION" document is kinda vague about these providing only theory without
real examples.
When there is only "scale" and "translate" values at play, there are no problems to match
position of RECT (taking into account provided shapeBounds), but when there is rotation
involved or shape is a complex one (consisting of two or more images) having shapeRecords
in place - I fail miserably. I get any results except for the right ones.
Take for example DefineShape2 (15) from attached file - I even created copy of the source
image in graphics editor (I included it in the file, originally it is a separate image),
scaled it according to scaleX/Y values, drawed RECT at shapeBounds, moved it to
translateX/Y and tried to move it by moveDeltaX/Y - couldn't get proper cutting positions
for neither of parts of that shape. If there is rotateSkew0/1 involved (DefineShape (212)
for example) - things get even more complicated, I'm not even close to a proper result...
Could you help me in this regard by any chance? Maybe provide links to some guides or
something? I can't google anything useful and close to a desperation here.
To the original problem:
in nightly 2772, the FB type values are displayed/edited as floats.
To your second message:
BitmapMatrix field is transformation matrix,
you can find some methods regarding it in our source code:
https://github.com/jindrapetrik/jpexs-decompiler/blob/master/libsrc/ffdec_lib/src/com/jpex
s/decompiler/flash/exporters/commonshape/Matrix.java
(methods transform for example)
moveDeltaX in StyleChangeRecord will move cursor to desired position to stroke or fill
path.
The path is made of shape records.
Converting the whole shape to actual bitmap with all parts correctly filled/stroked is
very complex operation.
I am not sure I can explain it properly.
This is a class we use for it:
https://github.com/jindrapetrik/jpexs-decompiler/blob/master/libsrc/ffdec_lib/src/com/jpex
s/decompiler/flash/exporters/shape/BitmapExporter.java
State: new→upgraded
That's exactly the reason I've asked - I just didn't get it. Yes, it's affine
transformation of 3x3 matrix where third row is basically ignored. OK, there's quite
simple formula for that. But it doesn't work for me somehow. Let's take attached file for
example - it's the same picture which used in the file in initial message above.
There are 15 sets of stars - all of them use RotateSkew. Let's take DefineShape 238 - it's
the topmost of such parts here. I want to cut it out. Should get coordinates which lay
somewhat in ranges: X0(1400,1440), Y0(200,240), X1(1805, 1820), Y1(565, 600) - based on
surrounding objects, right?
What do we have:
shapeBounds
Xmin = -6432, Xmax = 24000
Ymin = -7271, Ymax = 19439
matrix:
sX = 37.15 rs1 = 38.93 tX = -66898
rs0 = -34.17 sY = 32.61 tY = 48262
Transformed coordinate:
X' = X * ScaleX + Y * RotateSkew1 + TranslateX (swf spec. confirms it).
Though we are looking for original coordinate, not for the transformed one. And as such:
X * ScaleX = X' - Y * RotateSkew1 - TranslateX
X = (X' - Y * RotateSkew1 - TranslateX) / ScaleX
We don't know value of Y here, so we can get it from:
Y' = X * RotateSkew0 + Y * ScaleY + TranslateY
And then expand to this monster:
X = (X'sY - Y'rs1 + tYrs1 - tXsY)/(sXsY - rs0rs1)
Or just calculate inverse of the matrix and apply:
X0/1 = Xmin/max * ScaleX_inv + Ymin/max * RotateSkew1_inv + TranslateX_inv
Both methods will return same result.
But here's the thing - result is not what I wanted. X is (1626, 1607), Y is (1, 800) which
is far from boundaries above.
I even tried to pick values by hand - and if one of boundaries will be set in place (for
example, X0 would be 1403) then the other one will certainly be set off (X1 is 2203). Or
vice versa (1550 and 1810) - just from changing one value (RotateSkew1)
When there is no RotateSkew involved (is zero) - all coordinates are pretty much to the
point from Scale and Translate.
Suggested source code didn't help me - basically it contains same math which I found
elsewhere in internet. Did I miss some conversion along the way or I'm just plainly dumb
and can't see something obvious?
![Download](/flash/images/disk.png)