Issue #612: show color in hex format

This commit is contained in:
honfika
2014-08-16 16:09:03 +02:00
parent 40771b85c2
commit bc81826648
8 changed files with 194 additions and 173 deletions
+2
View File
@@ -253,6 +253,7 @@ public final class SWF implements TreeItem, Timelined {
*/ */
public byte[] lzmaProperties; public byte[] lzmaProperties;
public byte[] uncompressedData; public byte[] uncompressedData;
public byte[] originalUncompressedData;
public FileAttributesTag fileAttributes; public FileAttributesTag fileAttributes;
/** /**
* ScaleForm GFx * ScaleForm GFx
@@ -537,6 +538,7 @@ public final class SWF implements TreeItem, Timelined {
compression = header.compression; compression = header.compression;
lzmaProperties = header.lzmaProperties; lzmaProperties = header.lzmaProperties;
uncompressedData = baos.toByteArray(); uncompressedData = baos.toByteArray();
originalUncompressedData = uncompressedData;
SWFInputStream sis = new SWFInputStream(this, uncompressedData); SWFInputStream sis = new SWFInputStream(this, uncompressedData);
dumpInfo = new DumpInfoSwfNode(this, "rootswf", "", null, 0, 0); dumpInfo = new DumpInfoSwfNode(this, "rootswf", "", null, 0, 0);
@@ -96,6 +96,10 @@ public class Configuration {
@ConfigurationCategory("display") @ConfigurationCategory("display")
public static final ConfigurationItem<Boolean> dumpView = null; public static final ConfigurationItem<Boolean> dumpView = null;
@ConfigurationDefaultBoolean(false)
@ConfigurationCategory("display")
public static final ConfigurationItem<Boolean> useHexColorFormat = null;
@ConfigurationDefaultBoolean(false) @ConfigurationDefaultBoolean(false)
@ConfigurationCategory("ui") @ConfigurationCategory("ui")
public static final ConfigurationItem<Boolean> gotoMainClassOnStartup = null; public static final ConfigurationItem<Boolean> gotoMainClassOnStartup = null;
@@ -2170,7 +2170,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
return; return;
} }
dumpViewPanel.setData(DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().uncompressedData, dumpInfo); dumpViewPanel.setData(DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().originalUncompressedData, dumpInfo);
dumpViewPanel.revalidate(); dumpViewPanel.revalidate();
showCard(CARDDUMPVIEW); showCard(CARDDUMPVIEW);
} }
@@ -228,7 +228,7 @@ public class DumpTree extends JTree implements ActionListener {
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
File sf = Helper.fixDialogFile(fc.getSelectedFile()); File sf = Helper.fixDialogFile(fc.getSelectedFile());
try (FileOutputStream fos = new FileOutputStream(sf)) { try (FileOutputStream fos = new FileOutputStream(sf)) {
byte[] data = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().uncompressedData; byte[] data = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().originalUncompressedData;
fos.write(data, (int) dumpInfo.startByte, (int) (dumpInfo.getEndByte() - dumpInfo.startByte + 1)); fos.write(data, (int) dumpInfo.startByte, (int) (dumpInfo.getEndByte() - dumpInfo.startByte + 1));
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(DumpTree.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(DumpTree.class.getName()).log(Level.SEVERE, null, ex);
@@ -240,7 +240,7 @@ public class DumpTree extends JTree implements ActionListener {
TreePath[] paths = getSelectionPaths(); TreePath[] paths = getSelectionPaths();
DumpInfo dumpInfo = (DumpInfo) paths[0].getLastPathComponent(); DumpInfo dumpInfo = (DumpInfo) paths[0].getLastPathComponent();
SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf(); SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf();
byte[] data = swf.uncompressedData; byte[] data = swf.originalUncompressedData;
int prevLength = (int) dumpInfo.startByte; int prevLength = (int) dumpInfo.startByte;
try { try {
SWFInputStream rri = new SWFInputStream(swf, data); SWFInputStream rri = new SWFInputStream(swf, data);
@@ -266,7 +266,7 @@ public class DumpTree extends JTree implements ActionListener {
TreePath[] paths = getSelectionPaths(); TreePath[] paths = getSelectionPaths();
DumpInfo dumpInfo = (DumpInfo) paths[0].getLastPathComponent(); DumpInfo dumpInfo = (DumpInfo) paths[0].getLastPathComponent();
SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf(); SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf();
byte[] data = swf.uncompressedData; byte[] data = swf.originalUncompressedData;
int prevLength = (int) dumpInfo.startByte; int prevLength = (int) dumpInfo.startByte;
try { try {
ABCInputStream ais = new ABCInputStream(new MemoryInputStream(data, 0, prevLength + (int) dumpInfo.lengthBytes)); ABCInputStream ais = new ABCInputStream(new MemoryInputStream(data, 0, prevLength + (int) dumpInfo.lengthBytes));
@@ -283,7 +283,7 @@ public class DumpTree extends JTree implements ActionListener {
TreePath[] paths = getSelectionPaths(); TreePath[] paths = getSelectionPaths();
DumpInfo dumpInfo = (DumpInfo) paths[0].getLastPathComponent(); DumpInfo dumpInfo = (DumpInfo) paths[0].getLastPathComponent();
SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf(); SWF swf = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf();
byte[] data = swf.uncompressedData; byte[] data = swf.originalUncompressedData;
int prevLength = (int) dumpInfo.startByte; int prevLength = (int) dumpInfo.startByte;
try { try {
ABCInputStream ais = new ABCInputStream(new MemoryInputStream(data, 0, prevLength + (int) dumpInfo.lengthBytes)); ABCInputStream ais = new ABCInputStream(new MemoryInputStream(data, 0, prevLength + (int) dumpInfo.lengthBytes));
@@ -50,7 +50,6 @@ config.group.description.decompilation = Global decompilation related functions
config.group.name.other = Other config.group.name.other = Other
config.group.description.other = Other uncategorized configs config.group.description.other = Other uncategorized configs
config.name.openMultipleFiles = Open multiple files config.name.openMultipleFiles = Open multiple files
config.description.openMultipleFiles = Allows opening multiple files at once in one window config.description.openMultipleFiles = Allows opening multiple files at once in one window
@@ -60,6 +59,9 @@ config.description.decompile = You can disable AS decompilation, then only P-cod
config.name.dumpView = Dump View config.name.dumpView = Dump View
config.description.dumpView = View raw data dump config.description.dumpView = View raw data dump
config.name.useHexColorFormat = Hex color format
config.description.useHexColorFormat = Show the colors in hex format
config.name.parallelSpeedUp = Parallel SpeedUp config.name.parallelSpeedUp = Parallel SpeedUp
config.description.parallelSpeedUp = Parallelism can speed up decompilation config.description.parallelSpeedUp = Parallelism can speed up decompilation
@@ -60,6 +60,9 @@ config.description.decompile = Kikapcsolhatja az AS visszaford\u00edt\u00e1s\u00
config.name.dumpView = Dump N\u00e9zet config.name.dumpView = Dump N\u00e9zet
config.description.dumpView = Nyers adatok mutat\u00e1sa config.description.dumpView = Nyers adatok mutat\u00e1sa
config.name.useHexColorFormat = Hexa sz\u00edn form\u00e1tum
config.description.useHexColorFormat = A sz\u00ednek hexa form\u00e1tum\u00fa mutat\u00e1sa
config.name.parallelSpeedUp = P\u00e1rhuzamos gyors\u00edt\u00e1s config.name.parallelSpeedUp = P\u00e1rhuzamos gyors\u00edt\u00e1s
config.description.parallelSpeedUp = P\u00e1rhuzamos\u00edt\u00e1s fel tudja gyors\u00edtani a visszaford\u00edt\u00e1st config.description.parallelSpeedUp = P\u00e1rhuzamos\u00edt\u00e1s fel tudja gyors\u00edtani a visszaford\u00edt\u00e1st
@@ -16,6 +16,7 @@
*/ */
package com.jpexs.decompiler.flash.types; package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Color; import java.awt.Color;
import java.io.Serializable; import java.io.Serializable;
@@ -80,6 +81,10 @@ public class RGB implements Serializable {
@Override @Override
public String toString() { public String toString() {
if (Configuration.useHexColorFormat.get()) {
return "[RGB " + toHexRGB() + "]";
} else {
return "[RGB red:" + red + ", green:" + green + ", blue:" + blue + "]"; return "[RGB red:" + red + ", green:" + green + ", blue:" + blue + "]";
} }
}
} }
@@ -16,6 +16,7 @@
*/ */
package com.jpexs.decompiler.flash.types; package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Color; import java.awt.Color;
import java.io.Serializable; import java.io.Serializable;
@@ -77,6 +78,10 @@ public class RGBA extends RGB implements Serializable {
@Override @Override
public String toString() { public String toString() {
if (Configuration.useHexColorFormat.get()) {
return "[RGB " + toHexRGB() + "]";
} else {
return "[RGB red:" + red + ", green:" + green + ", blue:" + blue + ", alpha:" + alpha + "]"; return "[RGB red:" + red + ", green:" + green + ", blue:" + blue + ", alpha:" + alpha + "]";
} }
}
} }