mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 03:40:55 +00:00
Edit AS 1/2 constant pool
This commit is contained in:
@@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.action.parser.script.ParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.SymbolType;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
@@ -773,7 +774,7 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
if (trimmed.startsWith(Helper.hexData)) {
|
||||
src.setActionBytes(Helper.getBytesFromHexaText(text));
|
||||
} else if (trimmed.startsWith(Helper.constants)) {
|
||||
throw new Error("Saving constants is not supported, yet.");
|
||||
setConstantPools(Helper.getConstantPoolsFromText(text));
|
||||
} else {
|
||||
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false));
|
||||
}
|
||||
@@ -796,6 +797,29 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
}
|
||||
}
|
||||
|
||||
private void setConstantPools(List<List<String>> constantPools) {
|
||||
try {
|
||||
ActionList actions = src.getActions();
|
||||
int poolIdx = 0;
|
||||
for (Action action : actions) {
|
||||
if (action instanceof ActionConstantPool) {
|
||||
ActionConstantPool cPool = (ActionConstantPool) action;
|
||||
List<String> constantPool = constantPools.get(poolIdx);
|
||||
cPool.constantPool = constantPool;
|
||||
|
||||
poolIdx++;
|
||||
if (constantPools.size() <= poolIdx) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
src.setActions(actions);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void editDecompiledButtonActionPerformed(ActionEvent evt) {
|
||||
if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS12Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
|
||||
setDecompiledEditMode(true);
|
||||
|
||||
Reference in New Issue
Block a user