mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-06 09:58:26 +00:00
Open loaded SWFs during playback feature
This commit is contained in:
@@ -12,17 +12,30 @@
|
||||
private static var first:Boolean = true;
|
||||
private static var inited:Boolean = false;
|
||||
private static var name:String;
|
||||
public static const DEBUG_VERSION_MAJOR = 1;
|
||||
public static const DEBUG_VERSION_MINOR = 1;
|
||||
|
||||
public static const MSG_STRING = 0;
|
||||
public static const MSG_LOADER_URL = 1;
|
||||
public static const MSG_LOADER_BYTES = 2;
|
||||
|
||||
|
||||
|
||||
private static function sendQueue(){
|
||||
var qo = q;
|
||||
q = [];
|
||||
for each(var m in qo){
|
||||
writeMsg(m);
|
||||
writeMsg(m.data,m.type);
|
||||
}
|
||||
}
|
||||
|
||||
private static function writeStringNull(msg){
|
||||
var b:ByteArray = new ByteArray();
|
||||
b.writeUTFBytes(msg);
|
||||
s.writeBytes(b,0,b.length);
|
||||
s.writeByte(0);
|
||||
}
|
||||
|
||||
private static function writeString(msg){
|
||||
var b:ByteArray = new ByteArray();
|
||||
b.writeUTFBytes(msg);
|
||||
@@ -31,6 +44,14 @@
|
||||
s.writeBytes(b,0,b.length);
|
||||
}
|
||||
|
||||
private static function writeBytes(b:ByteArray){
|
||||
s.writeByte((b.length>>24) & 0xff);
|
||||
s.writeByte((b.length>>16) & 0xff);
|
||||
s.writeByte((b.length>>8) & 0xff);
|
||||
s.writeByte(b.length & 0xff);
|
||||
s.writeBytes(b,0,b.length);
|
||||
}
|
||||
|
||||
public static function initClient(sname){
|
||||
if(inited){
|
||||
return;
|
||||
@@ -47,19 +68,43 @@
|
||||
inited = true;
|
||||
}
|
||||
|
||||
public static function writeMsg(msg){
|
||||
|
||||
public static function writeLoaderURL(url){
|
||||
writeMsg(url,MSG_LOADER_URL);
|
||||
}
|
||||
|
||||
|
||||
public static function writeLoaderBytes(data:ByteArray){
|
||||
writeMsg(data,MSG_LOADER_BYTES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function writeMsg(msg,msgType=0){
|
||||
if(!inited){
|
||||
initClient("");
|
||||
}
|
||||
if(s.connected){
|
||||
if(first){
|
||||
s.writeByte(0);
|
||||
//s.writeByte(0);
|
||||
writeStringNull("debug.version.major="+DEBUG_VERSION_MAJOR+";debug.version.minor="+DEBUG_VERSION_MINOR);
|
||||
writeString(name);
|
||||
first = false;
|
||||
}
|
||||
s.writeByte(msgType);
|
||||
switch(msgType){
|
||||
case MSG_STRING:
|
||||
writeString(msg);
|
||||
break;
|
||||
case MSG_LOADER_URL:
|
||||
writeString(msg);
|
||||
break;
|
||||
case MSG_LOADER_BYTES:
|
||||
writeBytes(msg);
|
||||
break;
|
||||
}
|
||||
writeString(msg);
|
||||
}else{
|
||||
q.push(msg);
|
||||
q.push({type:msgType,data:msg});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jpexs.decompiler.flash.debugger {
|
||||
|
||||
import flash.display.Loader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.system.LoaderContext;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class DebugLoader extends Loader {
|
||||
|
||||
|
||||
public override function load(request:URLRequest, context:LoaderContext = null):void {
|
||||
DebugConnection.writeLoaderURL(request.url);
|
||||
super.load(request,context);
|
||||
}
|
||||
|
||||
public override function loadBytes(bytes:ByteArray, context:LoaderContext = null):void {
|
||||
DebugConnection.writeLoaderBytes(bytes);
|
||||
super.loadBytes(bytes,context);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
debugConsole("test console");
|
||||
debugSocket("test proxy");
|
||||
debugTrace("test trace");
|
||||
var loader:DebugLoader = new DebugLoader();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
import flash.external.ExternalInterface;
|
||||
|
||||
public function debugAlert(msg):*{
|
||||
if(ExternalInterface.available)
|
||||
ExternalInterface.call("alert",""+msg);
|
||||
return msg;
|
||||
public function debugAlert(...msg):void{
|
||||
for each(var n in msg){
|
||||
if(ExternalInterface.available)
|
||||
ExternalInterface.call("alert",""+n);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
import flash.external.ExternalInterface;
|
||||
|
||||
public function debugConsole(msg):*{
|
||||
if(ExternalInterface.available)
|
||||
ExternalInterface.call("console.log",""+msg);
|
||||
return msg;
|
||||
public function debugConsole(...msg):*{
|
||||
for each(var n in msg){
|
||||
if(ExternalInterface.available)
|
||||
ExternalInterface.call("console.log",""+n);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.jpexs.decompiler.flash.debugger {
|
||||
import flash.system.Capabilities;
|
||||
|
||||
public function debugSocket(msg):*{
|
||||
//only on webpages or activex
|
||||
if(Capabilities.playerType == 'PlugIn'
|
||||
|| Capabilities.playerType == 'ActiveX'){
|
||||
DebugConnection.writeMsg(msg);
|
||||
public function debugSocket(...msg):*{
|
||||
for each(var n in msg){
|
||||
//only on webpages or activex
|
||||
if(Capabilities.playerType == 'PlugIn'
|
||||
|| Capabilities.playerType == 'ActiveX'){
|
||||
DebugConnection.writeMsg(n);
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.jpexs.decompiler.flash.debugger {
|
||||
|
||||
|
||||
public function debugTrace(name){
|
||||
debugConsole(name);
|
||||
debugSocket(name);
|
||||
public function debugTrace(...msg){
|
||||
for each(var n in msg){
|
||||
debugConsole(n);
|
||||
debugSocket(n);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user