Răsfoiți Sursa

added support for -D swf_preloader_frame and -D swf_script_timeout=Int

Simon Krajewski 12 ani în urmă
părinte
comite
69558cad35
2 a modificat fișierele cu 17 adăugiri și 1 ștergeri
  1. 4 0
      common.ml
  2. 13 1
      genswf.ml

+ 4 - 0
common.ml

@@ -182,6 +182,8 @@ module Define = struct
 		| DumpDependencies
 		| Dce
 		| FormatWarning
+		| SwfPreloaderFrame
+		| SwfScriptTimeout
 
 		| Last (* must be last *)
 
@@ -210,6 +212,8 @@ module Define = struct
 		| Fdb -> ("fdb","Enable full flash debug infos for FDB interactive debugging")
 		| Swc -> ("swc","Output a SWC instead of a SWF")
 		| SwfProtected -> ("swf_protected","Compile Haxe private as protected in the SWF instead of public")
+		| SwfPreloaderFrame -> ("swf_preloader_frame", "Insert empty first frame in swf")
+		| SwfScriptTimeout -> ("swf_script_timeout", "Maximum ActionScript processing time before script stuck dialog box displays (in seconds)")
 		| JsModern -> ("js_modern","Use function wrapper and strict mode in JS output")
 		| JsClassic -> ("js_classic","Don't use a function wrapper and strict mode in JS output")
 		| FlashStrict -> ("flash_strict","More strict typing for flash target")

+ 13 - 1
genswf.ml

@@ -1097,7 +1097,19 @@ 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 swf = header, fattr @ bg :: debug @ tags @ [tag TShowFrame] 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 @ bg :: debug @ swf_script_limits @ preframe @ tags @ [tag TShowFrame] in
   (* merge swf libraries *)
 	let priority = ref (swf_header = None) in
 	let swf = List.fold_left (fun swf (file,lib,cl) ->