diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 376adcb4f..993e1edba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -2186,10 +2186,10 @@ public final class SWF implements TreeItem, Timelined { sb.append("\tvar frame_cnt = ").append(timeline.getFrameCount()).append(";\r\n"); sb.append("\tframe = frame % frame_cnt;\r\n"); sb.append("\tswitch(frame){\r\n"); + int maxDepth = timeline.getMaxDepth(); for (int frame = 0; frame < frames.size(); frame++) { sb.append("\t\tcase ").append(frame).append(":\r\n"); Frame frameObj = timeline.frames.get(frame); - int maxDepth = timeline.getMaxDepth(); for (int i = 1; i <= maxDepth; i++) { if (!frameObj.layers.containsKey(i)) { continue; @@ -2246,7 +2246,8 @@ public final class SWF implements TreeItem, Timelined { List clips = new ArrayList<>(); List prevClips = new ArrayList<>(); - for (int i = 1; i <= timeline.getMaxDepth(); i++) { + int maxDepth = timeline.getMaxDepth(); + for (int i = 1; i <= maxDepth; i++) { for (int c = 0; c < clips.size(); c++) { if (clips.get(c).depth == i) { exporter.setClip(prevClips.get(c)); @@ -2386,7 +2387,8 @@ public final class SWF implements TreeItem, Timelined { List clips = new ArrayList<>(); List prevClips = new ArrayList<>(); - for (int i = 1; i <= timeline.getMaxDepth(); i++) { + int maxDepth = timeline.getMaxDepth(); + for (int i = 1; i <= maxDepth; i++) { for (int c = 0; c < clips.size(); c++) { if (clips.get(c).depth == i) { g.setClip(prevClips.get(c)); @@ -2424,7 +2426,7 @@ public final class SWF implements TreeItem, Timelined { Matrix drawMatrix = new Matrix(); int drawableFrameCount = drawable.getNumFrames(); if (drawableFrameCount == 0) { - continue; + drawableFrameCount = 1; } int dframe = (time + layer.time) % drawableFrameCount; if (character instanceof ButtonTag) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index a713b8547..4362b1cde 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -465,7 +465,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { return Kernel32.INSTANCE.GetLastError(); } int readNow = ibr.getValue(); - System.arraycopy(data, readNow, res, read, readNow); + System.arraycopy(data, 0, res, read, readNow); read += readNow; } return 0; @@ -475,7 +475,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { // ignore } if (result != 0) { - if (result == Kernel32.ERROR_BROKEN_PIPE) { + if (result == Kernel32.ERROR_BROKEN_PIPE || result == -1) { restartFlashPlayer(); throw new IOException("Pipe read error."); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java index f4e806f82..1aeb0f642 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java @@ -248,8 +248,9 @@ public class TimelineBodyPanel extends JPanel implements MouseListener { if (p.x >= timeLine.getFrameCount()) { p.x = timeLine.getFrameCount() - 1; } - if (p.y > timeLine.getMaxDepth()) { - p.y = timeLine.getMaxDepth(); + int maxDepth = timeLine.getMaxDepth(); + if (p.y > maxDepth) { + p.y = maxDepth; } frameSelect(p.x, p.y); } diff --git a/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java index 6d8f16640..063c12515 100644 --- a/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -178,7 +178,8 @@ public class Timeline { Frame fr = this.frames.get(frame); sounds.addAll(fr.sounds); soundClasses.addAll(fr.soundClasses); - for (int d = this.getMaxDepth(); d >= 0; d--) { + int maxDepth = this.getMaxDepth(); + for (int d = maxDepth; d >= 0; d--) { DepthState ds = fr.layers.get(d); if (ds != null) { CharacterTag c = swf.characters.get(ds.characterId); @@ -208,7 +209,8 @@ public class Timeline { public void getObjectsOutlines(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, Matrix transformation, List objs, List outlines) { Frame fr = this.frames.get(frame); Stack clips = new Stack<>(); - for (int d = this.getMaxDepth(); d >= 0; d--) { + int maxDepth = this.getMaxDepth(); + for (int d = maxDepth; d >= 0; d--) { Clip currentClip = null; for (int i = clips.size() - 1; i >= 0; i--) { Clip cl = clips.get(i); @@ -277,7 +279,8 @@ public class Timeline { Frame fr = this.frames.get(frame); Area area = new Area(); Stack clips = new Stack<>(); - for (int d = this.getMaxDepth(); d >= 0; d--) { + int maxDepth = this.getMaxDepth(); + for (int d = maxDepth; d >= 0; d--) { Clip currentClip = null; for (int i = clips.size() - 1; i >= 0; i--) { Clip cl = clips.get(i); @@ -345,7 +348,8 @@ public class Timeline { private boolean isSingleFrame(int frame) { Frame frameObj = frames.get(frame); - for (int i = 1; i <= getMaxDepth(); i++) { + int maxDepth = this.getMaxDepth(); + for (int i = 1; i <= maxDepth; i++) { if (!frameObj.layers.containsKey(i)) { continue; }