From c9e20ecc1e1bfb02c245a85418f2a2e2f77913ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Thu, 8 May 2014 22:48:35 +0200 Subject: [PATCH] Issue #576 AS1/2 direct editation: DefineFunction2 fix AS1/2 property fix --- .../decompiler/flash/action/model/FunctionActionItem.java | 2 +- .../jpexs/decompiler/flash/action/swf4/ActionGetProperty.java | 4 ++++ .../jpexs/decompiler/flash/action/swf4/ActionSetProperty.java | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index 2123f32d0..ccd61fecf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -279,7 +279,7 @@ public class FunctionActionItem extends ActionItem { suppressThisFlag, preloadThisFlag, preloadGlobalFlag, - registerNames.size() - 1, len, SWF.DEFAULT_VERSION, paramNames, paramRegs)); + registerNames.size(), len, SWF.DEFAULT_VERSION, paramNames, paramRegs)); } return ret; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java index 77d6faabd..fa2d11642 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java @@ -43,6 +43,10 @@ public class ActionGetProperty extends Action { if (index instanceof DirectValueActionItem) { if (((DirectValueActionItem) index).value instanceof Long) { indexInt = (int) (long) (Long) ((DirectValueActionItem) index).value; + } else if (((DirectValueActionItem) index).value instanceof Double) { + indexInt = (int) Math.round((Double) ((DirectValueActionItem) index).value); + } else if (((DirectValueActionItem) index).value instanceof Float) { + indexInt = (int) Math.round((Float) ((DirectValueActionItem) index).value); } } stack.push(new GetPropertyActionItem(this, target, indexInt)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java index 5e73e9d18..288d85107 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java @@ -53,6 +53,10 @@ public class ActionSetProperty extends Action { if (index instanceof DirectValueActionItem) { if (((DirectValueActionItem) index).value instanceof Long) { indexInt = (int) (long) (Long) ((DirectValueActionItem) index).value; + } else if (((DirectValueActionItem) index).value instanceof Double) { + indexInt = (int) Math.round((Double) ((DirectValueActionItem) index).value); + } else if (((DirectValueActionItem) index).value instanceof Float) { + indexInt = (int) Math.round((Float) ((DirectValueActionItem) index).value); } } if (value.getThroughDuplicate() instanceof IncrementActionItem) {