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)
#2260 Looking for a way to customize tag reading and writing
Author:
dolepeck
![user user](/flash/images/user.png)
Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: GFXImages
State: closed ![Help](/flash/images/help.png)
![Help](/flash/images/help.png)
I'm decompiling a .gfx file that was used as a game asset so I guess they took some
liberties with the format.
For example, they didn't include a filename in the image data, so the decompiler can't
load it.
The missing filename can be reconstructed using the exportName.
I want to add some code to modify the serialization and deserialization of such elements,
so I can save the resource back after I edit it.
Is there any way of doing so without forking the whole decompiler? Can I achieve it by
writing some sort of plugin?
![Download](/flash/images/disk.png)
![Download](/flash/images/disk.png)
Hello, that file format change is odd. Could you please attach the GFX file where this
happens? (I can make this issue private, if you do not want to publish it to everybody)
I'd like to have it to do some tests with it. I think this speciality of the
DefineExternalImage should be integrated into the decompiler. I don't believe that they
have it only for this particular game.
To the plugins option: We have some small of plugins support, but that does not contain
tag reading changes.
State: new→opened
Here are the files. I'm looking at metamap_mainmenu.gfx, but all .gfx files there probably
have the same format quirks.
![Download](/flash/images/disk.png)
Please try ffdec nightly 2807,
I fixed the reading of such GFX files and its DefineExternalImages.
It is probably caused by older GFX format used (The ExporterInfo tag says it is from
version 1.02).
Besides the missing image filenames, the files also have incorrect filesize in header - it
includes header size in newer GFX formats of in the SWF.
State: opened→upgraded
Type: question→bug
Type: question→bug
Amazing. Everything looks much better now.
I've tested export back after some minor tweaks to panel positions and it looks like
everything works in the game.
Some files still log some font errors, for example rewardslossesscreen.gfx:
Jul 29, 2024 11:27:18 PM com.jpexs.decompiler.flash.SWF getFont
SEVERE: CharacterTag should be a FontTag. characterId: 3
And selectdifficultyscreen.gfx has a suspicious warning, but maybe it's okay.
I also managed to hang the application while fiddling with a preview, but I'm not sure
how.
Here is the traceback:
WARNING: Exception on Toolkit thread
java.lang.NullPointerException: Cannot invoke
"sun.awt.X11.XComponentPeer.pSetCursor(java.awt.Cursor)" because the return value of
"sun.awt.AWTAccessor$ComponentAccessor.getPeer(java.awt.Component)" is null
at java.desktop/sun.awt.X11.XWindow.handleXCrossingEvent(XWindow.java:952)
at java.desktop/sun.awt.X11.XComponentPeer.handleXCrossingEvent(XComponentPeer.java:74)
at java.desktop/sun.awt.X11.XBaseWindow.dispatchEvent(XBaseWindow.java:1158)
at java.desktop/sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:1116)
at java.desktop/sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:616)
at java.desktop/sun.awt.X11.XToolkit.run(XToolkit.java:731)
at java.desktop/sun.awt.X11.XToolkit.run(XToolkit.java:647)
at java.base/java.lang.Thread.run(Thread.java:840)
![Download](/flash/images/disk.png)
Please try nightly 2808,
I did some changes regarding importing assets, and also fixed some bugs in texts - now it
should also display proper fonts.
Fantastic! I can't find any obvious issues.
Although I got a random error once I opened one of the files I couldn't reproduce it
again:
Jul 31, 2024 12:27:32 AM com.jpexs.decompiler.flash.gui.View execInEventDispatch
SEVERE: null
java.lang.reflect.InvocationTargetException
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
at com.jpexs.decompiler.flash.gui.View.execInEventDispatch(View.java:556)
at com.jpexs.decompiler.flash.gui.Main$OpenFileWorker.doInBackground(Main.java:1620)
at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke
"com.jpexs.decompiler.flash.timeline.Timelined.getRect()" because "drawable" is null
at com.jpexs.decompiler.flash.gui.ImagePanel.setTimelined(ImagePanel.java:2725)
at com.jpexs.decompiler.flash.gui.PreviewPanel.showImagePanel(PreviewPanel.java:1530)
at com.jpexs.decompiler.flash.gui.MainPanel.showPreview(MainPanel.java:5569)
at com.jpexs.decompiler.flash.gui.MainPanel.valueChanged(MainPanel.java:5134)
at com.jpexs.decompiler.flash.gui.MainPanel.valueChanged(MainPanel.java:5141)
at java.desktop/javax.swing.JTree.fireValueChanged(JTree.java:3019)
at java.desktop/javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:3520)
at
java.desktop/javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelect
ionModel.java:650)
at
java.desktop/javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelect
ionModel.java:1120)
at
java.desktop/javax.swing.tree.DefaultTreeSelectionModel.removeSelectionPaths(DefaultTreeSe
lectionModel.java:514)
at java.desktop/javax.swing.JTree.removeDescendantSelectedPaths(JTree.java:3868)
at java.desktop/javax.swing.JTree$TreeModelHandler.treeStructureChanged(JTree.java:3981)
at
com.jpexs.decompiler.flash.gui.dumpview.DumpTreeModel.fireTreeStructureChanged(DumpTreeMod
el.java:65)
at
com.jpexs.decompiler.flash.gui.dumpview.DumpTreeModel.updateSwfs(DumpTreeModel.java:60)
at com.jpexs.decompiler.flash.gui.MainPanel.lambda$new$0(MainPanel.java:1387)
at
com.jpexs.decompiler.flash.gui.helpers.ObservableList.fireCollectionChanged(ObservableList
.java:215)
at com.jpexs.decompiler.flash.gui.helpers.ObservableList.add(ObservableList.java:160)
at com.jpexs.decompiler.flash.gui.MainPanel.load(MainPanel.java:1497)
at
com.jpexs.decompiler.flash.gui.Main$OpenFileWorker.lambda$doInBackground$0(Main.java:1629)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Pr
otectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
203)
at
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124
)
at
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Sorry to draw out this issue for so long but I have more examples of quirky .gfx files.
I'm looking at the file DATA/ui/movies/front_end/army_painter.gfx
Here DefineExternalImage uses filenames like
"data:UI\textures\space_marines\thumb_top.dds" and the decompiler cannot find it.
![Download](/flash/images/disk.png)
![Download](/flash/images/disk.png)
I don't know where to look for "data:" directory.
I may look for a directory named "DATA" in parent directories of the GFX file.
I tried it, but there are still many red squares
- are you sure the DDS files (the "DATA" contents") in this ZIP file are everything you
got?
It probably needs to be combined with other DATA from other sources.
For example, I did not find
"data:UI\textures\generic\fe\game_setup\heroes\race_tyranid_on.dds" in this ZIPfile, it is
referenced from character 36.
Of course you are correct. There are a bunch of game archives and I only unpacked one.
I hope added all the missing textures now.
I'm not sure about general rules for such paths. Maybe it's worth adding a configurable
list of mappings from prefix to directory for resolving this kind of paths?
![Download](/flash/images/disk.png)
In nightly2815, you can right click main GFX file node and select "Configure path
resolving".
Then you can enter desired prefixes and paths they should resolve into (1 per line).
Example:
data:|C:\directory\DATA
The setting is per GFX file so you need to configure it again for other GFX files...
I don't want to make a global setting for this, it would be complicated.
I think I'm doing something wrong. I've tried restarting ffdec, reopening gfx, setting the
path with/without trailing slash, trailing newline, and whitespaces and all of it doesn't
seem to work.
![Download](/flash/images/disk.png)
Please try nightly 2816.
If still not working, then try using "data:UI" as prefix and map it to the "ui" folder
since the directory is "ui", not "UI" - that may be casing problem.
Great job! Everything seems to be working.
I think this issue can be closed now.
I plan to tinker with these gfx and try exporting them back. If I face any hiccups I'll
create a new ticket.
Okay, great news.
State: upgraded→closed