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.

#2043 Adobe AIR SWF from iOS Game can't be loaded.
Author:
HomeStarRunnerTron

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

Hi-hi! First off, just want to thank the JPEXS team for creating this incredible
open-source tool. Runs insanely well on my Mac, whereas Eltima won't even put out a 64-bit
Intel build. Before this, the only SWF I encountered that wouldn't open was encrypted by
some proprietary tool, which makes complete sense. This is the first time beyond that
where an SWF hasn't opened!
> What steps will reproduce the problem?
I grabbed an iOS game that I knew was made in Adobe AIR because I really wanted to
decompile the game and check out everything inside. But when I open the SWF file inside of
the game (of which there is only one-- so all of the assets are contained in a single SWF
file), it brings up an error message--
> What is the expected output? What do you see instead?
The error message reads:
"Cannot load SWF file: java.lang.ClassCastException: class
com.jpexs.decompiler.flash.tags.StartSound2Tag cannot be cast to class
com.jpexs.decompiler.flash.tags.StartSoundTag
(com.jpexs.decompiler.flash.tags.StartSound2Tag and
com.jpexs.decompiler.flash.tags.StartSoundTag are in unnamed module of loader 'app')". I
don't know if some aspect of how modern Adobe AIR works is just not compatible with the
decompiler currently-- and I'm guessing all of it just scripting stuff. When I use a
program like Eltima to try to snag other assets like Sound, I'm able to do so, but I can't
access the scripts at all.
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
I'm currently using version 18.5.0, on my macOS on Monterey 12.5! Attaching the SWF in
question below.
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.

Hi-haw!
Please try nightly 2541.
I fixed the StartSound2 tag problem.
This SWF also has unusual structure of DoABC2 tag (the tag which usually contains
scripts),
which is pretty short and contains invalid data.
I don't think this SWF has any scripts inside - they must be somehow bundled separately.
State: new→upgraded
Wow, CLOSER to opening -- now the error for me says "Cannot load SWF file:
java.lang.OutOfMemoryError: Java heap space". And NO WAY, no scripts?! The game works
perfectly through PlayCover, so I know it's functional... I wonder if they somehow put all
the scripts into the Unix executable, that'd be crazy. It doesn't open in FFDec, because,
of course, it's not an SWF, but I wonder if the scripts are hiding in there. I can't think
of many other places. Would there be some way to confirm where the scripts are hiding in
the rest of the game's directory by looking in a hex editor or something like that?
Ah-- this next time I tried, I got an additional message-- *attaches*... not sure how much
more memory I would need, or if I should even modify that parameter yet, hahaha.

> now the error for me says "Cannot load SWF file: java.lang.OutOfMemoryError: Java heap
space".
Which release of JPEXS are you using as I just discovered a OOM issue in JPEXS latest
release (v18.5.0) that seems to be related to the old config files from earlier releases,
after moving `~/.FFDec` to `~/.FFDec.old` and letting the latest release regenerate the
files, I was able to open SWFs without running out of memory (this might be the same issue
for you)
Thank you so much for replying! I'm using 18.5.0 nightly build 2541 on a macOS. I can't
find a .FFDec folder, but I've deleted other FFDec folders in Application Support, but it
doesn't seem to be making any difference about this error. Can you successfully open the
SWF I attached on this topic with the fix on 18.5.0 nightly build 2541?
With 18.5.0. nightly 2541 I get the following in the errors log:
SEVERE Error during tag reading. SWF: init.swf ID: 82 name: Unresolved pos: 52491771
com.jpexs.decompiler.flash.abc.ABCOpenException: Invalid ABC file.
at com.jpexs.decompiler.flash.abc.ABC.<init>(ABC.java:572)
at com.jpexs.decompiler.flash.abc.ABC.<init>(ABC.java:558)
at com.jpexs.decompiler.flash.tags.DoABC2Tag.readData(DoABC2Tag.java:99)
at com.jpexs.decompiler.flash.tags.DoABC2Tag.<init>(DoABC2Tag.java:87)
at com.jpexs.decompiler.flash.SWFInputStream.resolveTag(SWFInputStream.java:1488)
at
com.jpexs.decompiler.flash.SWFInputStream$TagResolutionTask.call(SWFInputStream.java:1163)
at
com.jpexs.decompiler.flash.SWFInputStream$TagResolutionTask.call(SWFInputStream.java:1136)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.jpexs.decompiler.flash.EndOfStreamException: Premature end of the stream
reached
at com.jpexs.decompiler.flash.abc.ABCInputStream.readInternal(ABCInputStream.java:134)
at com.jpexs.decompiler.flash.abc.ABCInputStream.readS32(ABCInputStream.java:248)
at com.jpexs.decompiler.flash.abc.ABC.read(ABC.java:595)
at com.jpexs.decompiler.flash.abc.ABC.<init>(ABC.java:570)
... 10 more
I also started it with the debugger flash projector, and got this:
VerifyError: Error #1042: Not an ABC file. major_version=0 minor_version=0.
Looks like a corrupted file to me.
Hm, interesting! Like, the actual game that's sourcing the SWF runs perfectly fine. I've
also been able to use Trillix to grab assets like sounds and graphics from it... JPEXS DID
mention it appeared to have no scripts inside of it, although there are no other SWFs or
textfiles with script inside of the game directory. I wonder if the SWF somehow sources
secret stuff from inside the Unix executable for the game to complete the SWF structure.
I forgot to mention that FFDec shows everything except the script, and as Jpexs mentioned,
there is no script inside. I finaly managed to open the file with a low level editor and
sure enough the ABC tag was only 31 bytes long.
Thank you for the information-- What would I have to do to be able to open the file,
myself, sans scripts? : )
Make sure your Java can use more than 1 or 2 GB RAM. In my case it was using exactly 3GB
when I opened this file.
I know nothing of MacOS and can't be of further help.
SUCCESS! Yes, all I had to do was going into the Package Contents of FFDec and edit
ffdec.sh to read, "MEMORY=3000m" instead of "MEMORY=1024m". Tremendously appreciated.
State: upgraded→closed