diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index b2435d62f..b6fb81c47 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -1435,13 +1435,18 @@ public final class SWF implements SWFContainerItem, Timelined { fos.write(Utf8Helper.getBytes("\t" + currentName + "(ctx,ctrans,frames[frame],0,time);\r\n")); fos.write(Utf8Helper.getBytes("\tctx.restore();\r\n")); fos.write(Utf8Helper.getBytes("}\r\n\r\n")); - fos.write(Utf8Helper.getBytes("window.setInterval(function(){nextFrame(ctx,ctrans);}," + (int) (1000.0 / ftim.swf.frameRate) + ");\r\n")); + if (ftim.swf.frameRate > 0) { + fos.write(Utf8Helper.getBytes("window.setInterval(function(){nextFrame(ctx,ctrans);}," + (int) (1000.0 / ftim.swf.frameRate) + ");\r\n")); + } + fos.write(Utf8Helper.getBytes("nextFrame(ctx,ctrans);\r\n")); } + boolean packed = false; if (Configuration.packJavaScripts.get()) { try { JPacker.main(new String[]{"-q", "-b", "62", "-o", fmin.getAbsolutePath(), f.getAbsolutePath()}); f.delete(); + packed = true; } catch (Exception | Error e) { //Something wrong in the packer logger.log(Level.WARNING, "JPacker: Cannot minimize script"); f.renameTo(fmin); @@ -1459,7 +1464,7 @@ public final class SWF implements SWFContainerItem, Timelined { while ((cnt = fis.read(buf)) > 0) { fos.write(buf, 0, cnt); } - if (Configuration.packJavaScripts.get()) { + if (packed) { fos.write(Utf8Helper.getBytes(";")); } fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getJsSuffix())); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java index efe3ff495..0ac2efab0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -781,7 +781,7 @@ public class ActionListReader { } Action a; - Scanner sc = new Scanner(System.in); + Scanner sc = null; loopip: while (((endip == -1) || (endip > ip)) && (a = actions.get(ip)) != null) { if (Thread.currentThread().isInterrupted()) { @@ -854,6 +854,9 @@ public class ActionListReader { if (decideBranch) { System.out.print("newip " + nip + ", "); System.out.print("Action: jump(j),ignore(i),compute(c)?"); + if (sc == null) { + sc = new Scanner(System.in); + } String next = sc.next(); switch (next) { case "j": diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index 056bba71a..2b75b92d5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -143,7 +143,7 @@ public class Timeline { this.id = id; this.swf = swf; this.displayRect = displayRect; - this.frameRate = swf.frameRate < 1 ? 1 : swf.frameRate; + this.frameRate = swf.frameRate; this.timelined = parentTag == null ? swf : (Timelined) parentTag; this.parentTag = parentTag; this.tags = tags; diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 2c5f1851a..a986f6a78 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -689,6 +689,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis pause(); if (timelined != null) { timer = new Timer(); + int frameRate = 1000 / timelined.getTimeline().frameRate; timer.schedule(new TimerTask() { boolean first = true; @@ -704,7 +705,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis nextFrame(); } } - }, 0, 1000 / timelined.getTimeline().frameRate); + }, 0, frameRate == 0 ? Integer.MAX_VALUE : frameRate); } else { drawFrame(); } diff --git a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index bce94b4e4..844ab8a92 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2014 JPEXS - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -74,11 +74,17 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { @Override public synchronized void zoom(double zoom) { int zoomint = (int) Math.round(100 / (zoom / this.zoom)); - if (zoom == 1.0) { + if (zoomint == 0) { + zoomint = 1; + } + if (zoomint > 32767) { + zoomint = 32767; + } + if (zoomint == 100) { zoomint = 0; } + flash.Zoom(0); // hack, but this call is needed otherwise unzoom will fail for larger zoom values flash.Zoom(zoomint); - } public synchronized String getVariable(String name) throws IOException {