diff --git a/trunk/libsrc/Swf2Exe/uMain.pas b/trunk/libsrc/Swf2Exe/uMain.pas index 03fd73560..fa5a3537a 100644 --- a/trunk/libsrc/Swf2Exe/uMain.pas +++ b/trunk/libsrc/Swf2Exe/uMain.pas @@ -37,13 +37,16 @@ end; procedure TfrmMain.FormCreate(Sender: TObject); const - exeSize = 469504; + exeSize = 470016; var stream: TFileStream; buffer: array of Byte; tempFile: array[0..MAX_PATH - 1] of Char; tempPath: array[0..MAX_PATH - 1] of Char; flashVarData : TVarData; + width: Integer; + height: Integer; + scaleMode: Byte; begin flaPreview := TMySWF.Create(frmMain); flaPreview.Parent := frmMain; @@ -54,16 +57,25 @@ begin raise Exception.Create( 'GetTempFileName API failed. ' + SysErrorMessage(GetLastError) ); - stream := TFileStream.Create(ParamStr(0), fmOpenRead); - stream.Seek(exeSize, soBeginning); - SetLength(buffer, stream.Size - exeSize); try - stream.Read(buffer[0], Length(buffer)); - finally - stream.Free; + stream := TFileStream.Create(ParamStr(0), fmOpenRead); + stream.Seek(exeSize, soBeginning); + stream.Read(width, 4); + stream.Read(height, 4); + stream.Read(scaleMode, 1); + SetLength(buffer, stream.Size - exeSize); + try + stream.Read(buffer[0], Length(buffer)); + finally + stream.Free; + end; + except + width := 12800; + height := 9600; + scaleMode := 3; end; - stream := TFileStream.Create(ParamStr(0), fmOpenRead); - stream.Seek(exeSize, soBeginning); + ClientWidth := width div 20; + ClientHeight := height div 20; stream := TFileStream.Create(tempFile, fmOpenWrite); try stream.Write(buffer[0], Length(buffer)); @@ -71,7 +83,7 @@ begin stream.Free; end; flaPreview.Movie := tempFile; - flaPreview.ScaleMode := 3; + flaPreview.ScaleMode := scaleMode; end; procedure TfrmMain.FormResize(Sender: TObject); diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 321aa001d..9a6e3b7e3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -173,6 +173,8 @@ public class Configuration { public static final ConfigurationItem guiSplitPane1DividerLocation = null; @ConfigurationName("gui.splitPane2.dividerLocation") public static final ConfigurationItem guiSplitPane2DividerLocation = null; + @ConfigurationDefaultInt(3) + public static final ConfigurationItem saveAsExeScaleMode = null; private enum OSId { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 346e0b1c1..581d1eca5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -263,6 +263,17 @@ public class Main { while((bytesRead = exeStream.read(buffer)) != -1) { fos.write(buffer, 0, bytesRead); } + int width = swf.displayRect.Xmax - swf.displayRect.Xmin; + int height = swf.displayRect.Ymax - swf.displayRect.Ymin; + fos.write(width & 0xff); + fos.write((width >> 8) & 0xff); + fos.write((width >> 16) & 0xff); + fos.write((width >> 24) & 0xff); + fos.write(height & 0xff); + fos.write((height >> 8) & 0xff); + fos.write((height >> 16) & 0xff); + fos.write((height >> 24) & 0xff); + fos.write(Configuration.saveAsExeScaleMode.get()); } swf.saveTo(fos); if (tmpFile.exists()) { diff --git a/trunk/src/com/jpexs/helpers/resource/Swf2Exe.bin b/trunk/src/com/jpexs/helpers/resource/Swf2Exe.bin index 7162b05d5..54688ce22 100644 Binary files a/trunk/src/com/jpexs/helpers/resource/Swf2Exe.bin and b/trunk/src/com/jpexs/helpers/resource/Swf2Exe.bin differ