Fixed Show in Resource command from Hex dump not working for tags inside DefineSprite

This commit is contained in:
Jindra Petřík
2022-11-06 21:44:39 +01:00
parent 6c964899fb
commit 20b11e3763
2 changed files with 19 additions and 7 deletions
@@ -78,6 +78,7 @@ import com.jpexs.decompiler.flash.tags.SoundStreamHead2Tag;
import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.MemoryInputStream;
import java.awt.Color;
@@ -489,19 +490,29 @@ public class DumpTree extends JTree {
repaint();
}
private Tag searchTimelinedForTag(Timelined timelined, long address) {
for (Tag tag : timelined.getTags()) {
if (tag.getOriginalRange().getPos() == address) {
return tag;
}
if (tag instanceof DefineSpriteTag) {
Tag subSpriteFound = searchTimelinedForTag(((DefineSpriteTag)tag), address);
if (subSpriteFound != null) {
return subSpriteFound;
}
}
}
return null;
}
private void gotoTagButtonActionPerformed(ActionEvent evt) {
TreePath[] paths = getSelectionPaths();
DumpInfoSpecial dumpInfo = (DumpInfoSpecial) paths[0].getLastPathComponent();
SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf();
long address = (long) (Long) dumpInfo.specialValue;
Tag foundTag = null;
for (Tag tag : swf.getTags()) {
if (tag.getOriginalRange().getPos() == address) {
foundTag = tag;
break;
}
}
Tag foundTag = searchTimelinedForTag(swf, address);
if (foundTag != null) {
mainPanel.getMainFrame().getMenu().showResourcesView();