Skip to content

Instantly share code, notes, and snippets.

@grzhan
Created March 16, 2016 08:42
Show Gist options
  • Save grzhan/ffd3a30b7fe10406907b to your computer and use it in GitHub Desktop.
Save grzhan/ffd3a30b7fe10406907b to your computer and use it in GitHub Desktop.
用于导出Core.swf的mainD2文件Hack版
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.utils.ByteArray;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;
import flash.display.LoaderInfo;
import flash.net.FileReference;
import flash.events.IOErrorEvent;
public class mainD2 extends Sprite
{
private var _core:Loader;
public function mainD2()
{
super();
this._core = new Loader();
addChild(this._core);
var _loc1_:Sprite = new Sprite();
_loc1_.graphics.beginFill(0);
_loc1_.graphics.drawRect(-800,-480,800,1440);
_loc1_.graphics.drawRect(0,-480,800,480);
_loc1_.graphics.drawRect(800,-480,800,1440);
_loc1_.graphics.drawRect(0,480,800,480);
_loc1_.graphics.endFill();
addChild(_loc1_);
this._handleAddToStage();
}
protected function _handleFurnitureShowEnd(param1:Event) : void
{
this._core.content.removeEventListener("Core:FurnitureShowEnd",this._handleFurnitureShowEnd);
}
private function _handleAddToStage() : void
{
var req:URLRequest = new URLRequest("./Core.swf");
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = "binary";
urlLoader.addEventListener("complete",this._handleLoadComplete);
urlLoader.load(req);
}
private function _handleLoadComplete(param1:Event) : void
{
var _loc2_:URLLoader = URLLoader(param1.target);
_loc2_.removeEventListener("complete",this._handleLoadComplete);
var _loc4_:ByteArray = _loc2_.data;
var _loc3_:ByteArray = new ByteArray();
var _loc6_:Object = this._createKey();
this._core.contentLoaderInfo.addEventListener("complete",this._handleLoadComplete2);
this._core.contentLoaderInfo.addEventListener("ioError",this._handleLoadError);
var _loc5_:LoaderContext = new LoaderContext();
_loc5_.applicationDomain = ApplicationDomain.currentDomain;
this.___(_loc4_,_loc3_,_loc6_);
this._core.loadBytes(_loc3_,_loc5_);
}
private function _handleLoadComplete2(param1:Event) : void
{
var customLoaderInfo:LoaderInfo = null;
var saveFile:FileReference = null;
trace("Trigger!");
this._core.contentLoaderInfo.removeEventListener("complete",this._handleLoadComplete2);
this._core.contentLoaderInfo.removeEventListener("ioError",this._handleLoadError);
try
{
this._core.content["setSWFVer"](this.getSWFVersionsObject());
this._core.content["startApp"](loaderInfo.parameters);
this._core.content.addEventListener("Core:FurnitureShowEnd",this._handleFurnitureShowEnd);
customLoaderInfo = LoaderInfo(param1.target);
saveFile = new FileReference();
saveFile.save(customLoaderInfo.bytes,"result.swf");
}
catch(e:ReferenceError)
{
trace(e);
}
catch(e:Error)
{
trace(e);
}
}
private function _handleLoadError(param1:IOErrorEvent) : void
{
this._core.contentLoaderInfo.removeEventListener("complete",this._handleLoadComplete);
this._core.contentLoaderInfo.removeEventListener("ioError",this._handleLoadError);
}
private function _createKey() : Object
{
var key:Object = {};
key.a = function(param1:int, param2:int):int
{
return param1 + param2;
};
key.s = function(param1:int, param2:int):int
{
return param1 - param2;
};
key.t = function(param1:int, param2:int):int
{
return param1 * param2;
};
key.d = function(param1:int, param2:int):int
{
return param1 / param2;
};
key.m = function(param1:int, param2:int):int
{
return param1 % param2;
};
key.f = function(param1:Number):int
{
return Math.floor(param1);
};
key.r = function():int
{
return Math.random();
};
key.j = function(... rest):String
{
return rest.join("");
};
key.n = function():Number
{
return new Date().getTime();
};
return key;
}
private function ___(param1:ByteArray, param2:ByteArray, param3:Object) : void
{
var _loc4_:* = this;
param3[param3[/.$/(/..../(param3))](_loc4_,"")] = param3[/.$/(/ .../({}))](/./(/.. /({})),/.$/(/../({})),/./(/./([])),/./(/..$/(!{})),/.../(!!{}),/../(/.. /({})),/.$/(/../({})),/.$/(/../(!!{})));
param3[~_loc4_] = ~_loc4_ >>> ~_loc4_;
param3[param3[/./(/.....$/(param3))]("",param3)] = ""[param3[_loc4_]];
param3[/./(param3)] = ~_loc4_ / ~_loc4_ << ~_loc4_ / ~_loc4_ << ~_loc4_ / ~_loc4_;
var _loc5_:* = param3[/./(param3)] << ~_loc4_ / ~_loc4_ << ~_loc4_ / ~_loc4_ | ~_loc4_ / ~_loc4_;
param3[/ ./((~~_loc4_)[param3[_loc4_]])] = _loc5_;
param3[/./({})] = _loc5_;
param3[/../([][{}])] = param3[/./(param3)][param3[/.$/(/..../({}))](/./(!!{}),/.$/(/../({})),/ (.*)]$/(param3[param3])[~_loc4_ / ~_loc4_])](~(~_loc4_ << (/./(/..$/(~_loc4_ << ~_loc4_)) | ~_loc4_ << ~_loc4_ >>> ~_loc4_)));
param3[/.$/(!!{})] = param3[/.$/(/ .../({}))](/.$/(/./([])),/.$/(!{}),/./(/./([])),/./(/.....$/(/./[param3[_loc4_]])),/./(!!{}),param3[/../([][{}])]);
param3[/./({})] = param3[/./(/.....$/({}))](/./(!{}),/.$/(/../(!!{})),/.$/(/../(param3)),/.$/(/ .../((~_loc4_)[param3[_loc4_]])),/.$/(/ ./([][param3[_loc4_]][param3[_loc4_]])),param3[/../([][{}])],/.$/(/../(!{})),/.$/(/../(!!{})),/.$/(/ ./(param3[param3[_loc4_]][param3[_loc4_]])),/.$/(/../(param3)),/.$/([][{}]),/.$/(!{}));
param3[/./({})] = param3[param3][param3[/./(param3)]];
param3[/..$/(this.___)] = param3[/.$/(/..../({}))](param3[param3](param3[_loc4_])[param3[/.$/(!!{})]],/./(/..$/(~_loc4_ >>> _loc4_)));
param3[/..$/(this.___)] = param3[/./(param3[param3])](param3[/..$/(param3[/./(param3[param3])])]);
param3[~~_loc4_] = param3[/.$/(/../(!{}))](param3[~_loc4_],param3[~_loc4_]);
param3[/ ./({})] = param3[/./(/.....$/(param3))](param3[/./({})](param3[/ ./((~~_loc4_)[param3[_loc4_]])] * (param3[~_loc4_] << param3[~_loc4_] << param3[~_loc4_])),param3[/.$/(/..../(""[param3[_loc4_]]))](param3[~~_loc4_] | param3[~_loc4_],~_loc4_),/./("."),/./(/. /([][param3[_loc4_]][param3[_loc4_]])),param3[/..$/(param3[/./(param3[param3])])],/./(!{}));
param3[{}] = param3[/.$/(/ .../({}))](param3[/..$/(this.___)],/.$/(/../(!!{})),/./(/... /(this.___)),/./(!!{}),/.$/(!{}),/.$/(/ ./(param2[param3[_loc4_]])),/./(/..$/([][param3[_loc4_]])),/./(!!{}),/.$/(!{}),/./(/. /([][param3[_loc4_]])));
param3[/.$/(this.___)] = param3[~_loc4_] << (param3[/.$/(/../(!{}))]("."[param3[_loc4_]](!{})[param3[/.$/(!!{})]],param3[/./(!!{})](~_loc4_,"_"[param3[_loc4_]](!!{})[param3[/.$/(!!{})]])) | param3[~~_loc4_] | param3[~_loc4_] << param3[~~_loc4_]);
param3[/./(/..$/(this.___))] = param3[~~~_loc4_] << (param3[~_loc4_] | param3[param3[/.$/(/../(!{}))](~_loc4_,param3[/./(!!{})](~_loc4_,~_loc4_))]);
param3[/ ./([][param3[_loc4_]])] = param3[/./(/..$/(!{}))](param1[param3[/.$/(!!{})]],param3[/.$/(param3[/.$/(/../(!{}))])]);
param3[/ ./([][param3[_loc4_]][param3[_loc4_]])] = param3[/.$/([][{}])](param3[/ ./([""][param3[_loc4_]])],param3[/./(/..$/(param3[/./(/..$/(!{}))]))]);
param3[/./([][{}])] = param3[/.$/(this.___)];
param3[/.$/[param3[_loc4_]]] = /./(/....$/(!{}));
param3[/../((!{})[param3[_loc4_]])] = /./(!!{});
param2[param3[param3]](param1,~~_loc4_,param3[/./([][{}])]);
param2[param3[param3]](param1,param3[/./(/..$/(!!{}))],param3[/ ./([][param3[_loc4_]][param3[_loc4_]])]);
param2[param3[param3]](param1,param3[param3[/_/[param3[_loc4_]]]](param3[/./(/..$/(!!{}))],param3[param3[/../([][param3[_loc4_]])]](param3[/ ./([][param3[_loc4_]][param3[_loc4_]])],param3[~_loc4_] << param3[~~_loc4_] | param3[~~_loc4_] | param3[~_loc4_])),param3[/ ./({}[param3[_loc4_]][param3[_loc4_]])]);
param2[param3[param3]](param1,param3[param3[/../[param3[_loc4_]]]](param3[/./([][{}])],param3[param3[/../(""[param3[_loc4_]])]](param3[/ ./([][param3[_loc4_]][param3[_loc4_]])],param3[~~_loc4_])),param3[/ ./({}[param3[_loc4_]][param3[_loc4_]])]);
param3[/..$/(/./([]))] = param3[/.$/(/..../(param3))](/.$/(/.../(""[param3[_loc4_]])),/.$/(/../({})),/.$/(/../(!{})),/.$/(/.../([][{}])),/.$/(!!{}),/.$/(/ ../([][param3[_loc4_]])),param3[/./({})](param3[param3[/./[param3[_loc4_]]]](param3[param3[/../(/./[param3[_loc4_]])]](param3[/ ./((~~_loc4_)[param3[_loc4_]])],""[param3[_loc4_]](!!{})[param3[/.$/(!!{})]]),""[param3[_loc4_]](!{})[param3[/.$/(!!{})]])),/./(/./([])),/./(!{}),/.$/(/../({})));
if(_loc4_[param3[/..$/(/_/([]))]][param3[/.$/(/..../({}))](/./([][{}]),/./(/....$/([][param3[_loc4_]])),/./(/...$/(!{})))][param3[/.$/(/..../({}))](/..$/(!{}),/.$/(/../(!{})),/.$/(/../(!!{})),/.$/(/../([][param3[_loc4_]])),param3[/../([][{}])])](param3[/ ./(param3)]) > 0)
{
param2[param3[param3]](param1,param3[param3[/./[param3[_loc4_]]]](param3[/./([][{}])],param3[param3[/../(""[param3[_loc4_]])]](param3[/ ./({}[param3[_loc4_]][param3[_loc4_]])],param3[~~_loc4_] << param3[~_loc4_] | param3[~_loc4_])),param3[/ ./({}[param3[_loc4_]][param3[_loc4_]])]);
}
else
{
param2[param3[param3]](param1,param3[param3[/|/[param3[_loc4_]]]](0,param3[param3[/../((~_loc4_)[param3[_loc4_]])]](param3[/ ./([][param3[_loc4_]][param3[_loc4_]])],param3[""[param3[/.$/(!!{})]]] << param3[~_loc4_] | param3[~_loc4_])),param3[/ ./([][param3[_loc4_]][param3[_loc4_]])]);
}
param2[param3[param3]](param1,param3[param3[/$/[param3[_loc4_]]]](param3[/./([][{}])],param3[param3[/../([][param3[_loc4_]])]](param3[/ ./([][param3[_loc4_]][param3[_loc4_]])],param3[/./(/..$/(this.___))] >> param3[~_loc4_])),param3[/ ./(""[param3[_loc4_]][param3[_loc4_]])]);
param2[param3[param3]](param1,param3[param3[/$/[param3[_loc4_]]]](param3[/./(/..$/(!!{}))],param3[param3[/../([][param3[_loc4_]])]](param3[/ ./(""[param3[_loc4_]][param3[_loc4_]])],param3[~_loc4_] | param3[~~_loc4_])),param3[/ ./({}[param3[_loc4_]][param3[_loc4_]])]);
param2[param3[param3]](param1,param3[param3[/..$/[param3[_loc4_]]]](param3[/.$/(/ ../((~_loc4_)[param3[_loc4_]]))],param3[param3[/../((~_loc4_)[param3[_loc4_]])]](param3[/ ./("."[param3[_loc4_]][param3[_loc4_]])],param3[/.$/(/ ../((~_loc4_)[param3[_loc4_]]))] >> (param3[~_loc4_] << param3[~~_loc4_] | param3[~_loc4_]) | param3[~~_loc4_])),param3[/ ./("|"[param3[_loc4_]][param3[_loc4_]])]);
param2[param3[param3]](param1,param3[param3[/__/[param3[_loc4_]]]](param3[/./([][{}])],param3[param3[/../(""[param3[_loc4_]])]](param3[/ ./("."[param3[_loc4_]][param3[_loc4_]])],param3[~_loc4_])),param3[/ ./({}[param3[_loc4_]][param3[_loc4_]])]);
}
private function getSWFVersionsObject() : Object
{
return {
"mm_core":"syrrbygrimvl",
"mm_title":"2.7.2",
"mm_tutorial":"2.0.0",
"mm_common":"2.7.1",
"mm_port":"2.7.2",
"rm_font":"2.3",
"rm_icon":"2.5",
"rm_sound_bgm":"2.1.7",
"rm_sound_se":"2.7.1",
"rm_itemicon":"2.6.9",
"rm_stype":"2.6.4",
"rm_bgm_p":{},
"rm_battlebgm":["2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.6","2.0.12","2.0.19","2.1.0","2.1.0","2.1.0","2.1.0","2.1.7","2.1.7","2.1.9","2.2","2.2","2.2","2.2","2.2","2.2","2.2","2.2","2.2.4","2.2"],
"um_record":"2.3.8",
"um_album":"2.7.1",
"um_itemlist":"2.7.2",
"um_interior":"2.3",
"um_duty":"2.7.2",
"lm_organize":"2.7.2",
"lm_supply":"2.6.5",
"lm_remodel":"2.7.1",
"lm_repair":"2.3.5",
"lm_arsenal":"2.6.0",
"lm_sally":"2.7.2",
"mm_battle":"2.7.2",
"mm_battleresult":"2.7.1",
"xm_wedding":"2.0.10",
"xm_revamp":"2.7.1",
"maps":{"32_01":"2.6.5.1"}
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment