Skip to content

Commit

Permalink
Forcing swf-preloader-frame put ShowFrame tag in the beginning even w…
Browse files Browse the repository at this point in the history
…hen libraries loaded via -swf-lib don't have empty frame first.
  • Loading branch information
Antriel committed Aug 23, 2014
1 parent dcbbace commit c2cd1dd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions genswf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1172,26 +1172,31 @@ let generate com swf_header =
})]
) in
let fattr = if Common.defined com Define.AdvancedTelemetry then fattr @ [tag (TUnknown (0x5D,"\x00\x00"))] else fattr in
let preframe, header =
if Common.defined com Define.SwfPreloaderFrame then
[tag TShowFrame], {h_version=header.h_version; h_size=header.h_size; h_frame_count=header.h_frame_count+1; h_fps=header.h_fps; h_compressed=header.h_compressed; }
else
[], header in
let swf_script_limits = try
let s = Common.defined_value com Define.SwfScriptTimeout in
let i = try int_of_string s with _ -> error "Argument to swf_script_timeout must be an integer" Ast.null_pos in
[tag(TScriptLimits (256, if i < 0 then 0 else if i > 65535 then 65535 else i))]
with Not_found ->
[]
in
let swf = header, fattr @ meta_data @ bg :: debug @ swf_script_limits @ preframe @ tags @ [tag TShowFrame] in
let swf = header, fattr @ meta_data @ bg :: debug @ swf_script_limits @ tags @ [tag TShowFrame] in
(* merge swf libraries *)
let priority = ref (swf_header = None) in
let swf = List.fold_left (fun swf (file,lib,cl) ->
let swf = merge com file !priority swf (remove_classes toremove lib cl) in
priority := false;
swf
) swf com.swf_libs in
let swf = match swf with
| header,tags when Common.defined com Define.SwfPreloaderFrame ->
let rec loop l =
match l with
| ({tdata = TFilesAttributes _ | TUnknown (0x5D,"\x00\x00") | TMetaData _ | TSetBgColor _ | TEnableDebugger2 _ | TScriptLimits _} as t) :: l -> t :: loop l
| t :: l -> tag TShowFrame :: t :: l
| [] -> []
in
{header with h_frame_count = header.h_frame_count + 1},loop tags
| _ -> swf in
t();
(* write swf/swc *)
let t = Common.timer "write swf" in
Expand Down

0 comments on commit c2cd1dd

Please sign in to comment.