Skip to content

Commit

Permalink
Merge pull request #85 from laplamgor/feature/fix_regex
Browse files Browse the repository at this point in the history
Fix regex
  • Loading branch information
antest1 authored Mar 20, 2023
2 parents 103e9c0 + 4393db0 commit 9ac7569
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,8 @@ private String patchMainScript(String main_js, boolean broadcast_mode) {
// Reusing original names will cause a lot of conflict issues
//main_js = main_js.replace("over:n.pointer?\"pointerover\":\"mouseover\"", "over:\"touchover\"");
//main_js = main_js.replace("out:n.pointer?\"pointerout\":\"mouseout\"", "out:\"touchout\"");
main_js = main_js.replaceFirst("'over':\\w+\\[\\w+\\('\\w+'\\)]\\?\\w+\\('\\w+'\\):\\w+\\('\\w+'\\)", "'over':'touchover'");
main_js = main_js.replaceFirst("'out':\\w+\\[\\w+\\('\\w+'\\)]\\?\\w+\\('\\w+'\\):\\w+\\('\\w+'\\)", "'out':'touchout'");
main_js = main_js.replaceFirst("'?over'?:[^,;=\\?:]{0,50}\\?[^,;=\\?:}]{0,50}:[^,;=\\?:}]{0,50}", "'over':'touchover'");
main_js = main_js.replaceFirst("'?out'?:[^,;=\\?:]{0,50}\\?[^,;=\\?:}]{0,50}:[^,;=\\?:}]{0,50}", "'out':'touchout'");

main_js = main_js.concat(MUTE_LISTEN);
main_js = main_js.concat(CAPTURE_LISTEN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static String patchFps(String main_js){

// Change the create.js ticker mode from Timer to to RAF
stringsToReplace.put(
"(createjs(?:\\[\\w+\\('\\w+'\\)\\]){2})\\=createjs(?:\\[\\w+\\('\\w+'\\)\\]){2},",
"(createjs[^,;=]{0,40})(\\=createjs[^,;=]{0,40}),",
"$1=createjs.Ticker.RAF,");

String replaced = main_js;
Expand Down
47 changes: 18 additions & 29 deletions app/src/main/java/com/antest1/gotobrowser/Helpers/K3dPatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ public static String patchKantai3d(String main_js){



stringsToReplace.put("(=.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\(this\\)\\|\\|this;return (.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]=new PIXI\\[\\(.{0,20}\\('.{0,20}'\\)\\)\\]\\(\\),){6}.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]=new .{0,20}\\(\\),.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\(0x4f,0xa4\\),)",
stringsToReplace.put("(=[^,;=]{0,50}\\(this\\)\\|\\|this;return ([^,;=]{0,50}=new PIXI.{0,80},){6}[^,;=]{0,50}=new [^;=]{0,80}\\((0x4f|79),(0xa4|164)\\),)",
"= window.sound_options $1");

stringsToReplace.put("(=new )(.{0,20})(\\(\\),.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\(0x5a,0x18e\\),)",
stringsToReplace.put("(=new )([^,;=]{0,20})(,[^,;=]{0,70}\\((0x5a|90),(0x18e|398)\\),)",
"$1$2$3\n" +
" window.sound_options._toggle3d = new $2(),\n" +
" window.sound_options._toggle3d = new $2,\n" +
" window.sound_options._toggle3d.position.set(-120, 150),\n" +
" window.sound_options._toggle3d_ai = new $2(),\n" +
" window.sound_options._toggle3d_ai = new $2,\n" +
" window.sound_options._toggle3d_ai.position.set(-120, 215),\n" +
" window.sound_options._toggle3d_text = new PIXI.Text('Kantai3D v3.0\\\\n\\\\nExtra Depth Maps', new PIXI.TextStyle({fontFamily: \"Georgia\", fontSize: 28, fill: '#ffffff'})),\n" +
" window.sound_options._toggle3d_text.position.set(-360, 150),\n" +
Expand All @@ -227,47 +227,41 @@ public static String patchKantai3d(String main_js){
" window.sound_options.addChild(window.sound_options._toggle3d_text),\n" +
" window.sound_options.addChild(window.sound_options._toggle3d_ai_text),");

stringsToReplace.put("(\\(0x26,0x18e\\),this\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\(0xc6,0x18e\\),)",
stringsToReplace.put("(\\((0x26|38),(0x18e|398)\\),this[^,;=]{0,60}\\((0xc6|198),(0x18e|398)\\),)",
"$1\n" +
" this._toggle3d.initialize(),\n" +
" this._toggle3d_ai.initialize(),");

stringsToReplace.put("(function\\(\\)\\{this\\[.{0,20}\\('.{0,20}'\\)\\]\\(\\)(,this\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\(\\),this\\[.{0,20}\\('.{0,20}'\\)\\]=null){11};)",
"$1\n" +
stringsToReplace.put("(function\\(\\)\\{[^=]{0,90},([^;=]{0,90}\\(\\),this[^=]{0,90}=null){11})([^,])",
"$1\n ;" +
" this._toggle3d.dispose();\n" +
" this._toggle3d = null;\n" +
" this._toggle3d_ai.dispose();\n" +
" this._toggle3d_ai = null;");
" this._toggle3d_ai = null; $3");

stringsToReplace.put("(,.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\(\\),0x0==this\\[.{0,20}\\('.{0,20}'\\)\\]&&0x0<.{0,20}?.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\(.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\):0x0<this\\[.{0,20}\\('.{0,20}'\\)\\]&&0x0)",
stringsToReplace.put("(,[^,;=]{0,70}\\(\\),0(x0)?==this[^,;=]{0,20}&&0(x0)?<[^,;=]{0,180}:0(x0)?<this[^,;=]{0,20}&&0(x0)?)",
",window.isDepthEnabled = this._sound._toggle3d.value, \n" +
" window.isDepthAiEnabled = this._sound._toggle3d_ai.value\n" +
" $1");

stringsToReplace.put("((null==this\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]&&\\(this\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]=.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\),this\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]=.{0,20}\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\]\\[.{0,20}\\('.{0,20}'\\)\\],){2})",
stringsToReplace.put("((null==this[^,;=]{0,40}&&\\(this[^,;=]{0,40}=[^,;=]{0,70}\\),this[^,;=]{0,40}=[^,;=]{0,70},){2})",
"$1\n" +
" this._toggle3d.value = window.isDepthEnabled != false,\n" +
" this._toggle3d_ai.value = window.isDepthAiEnabled != false,");



stringsToReplace.put("(return .{0,99}\\!\\=.{0,99}\\|\\|null\\!\\=\\(.{0,99}\\=.{0,99}\\(.{0,99}\\)\\)&&\\(.{0,99}\\='_'\\+.{0,99}\\),.{0,99}\\+\\(.{0,99}\\+.{0,99}\\+'\\/'\\+\\(.{0,99}\\+.{0,99}\\(.{0,99},.{0,99}\\)\\)\\+'_'\\+.{0,99}\\+.{0,99}\\+.{0,99}\\+.{0,99}\\(0x0,parseInt\\(.{0,99}\\)\\)\\);)",
stringsToReplace.put("(return[^,;=]{0,20}\\!\\=[^,;=]{0,10}\\|\\|null\\!\\=\\([^,;=]{0,10}\\=[^,;=]{0,100}\\)&&\\([^,;=]{0,10}\\=(\"_\"|'_')\\+[^,;=]{0,30}\\),[^,;=]{0,70}\\+\\([^,;=]{0,70}\\+[^,;=]{0,10}\\+(\"\\/\"|'\\/')\\+\\([^,;=]{0,20}\\+[^,;=]{0,30}\\([^,;=]{0,20},[^,;=]{0,20}\\)\\)\\+(\"_\"|'_')\\+[^,;=]{0,20}\\+[^,;=]{0,20}\\+[^,;=]{0,20}\\+[^,;=]{0,60}\\(0(x0)?,parseInt\\([^,;=]{0,20}\\)\\)\\);?)",
"\n return window.displacementPath = (function () {\n$1\n})();\n");

stringsToReplace.put("(new PIXI\\[.{0,99}\\]\\(.{0,99}\\[.{0,99}\\]\\[.{0,99}\\],.{0,99},.{0,99}\\);document)",
stringsToReplace.put("(new PIXI[^,;=]{0,20}\\([^,;=]{0,70},[^,;=]{0,60},[^,;=]{0,20}\\);document)",
"\n window.pixiApp = $1");

stringsToReplace.put("(\\=[^=]{0,99}\\[[^\\[]{0,99}\\]\\[[^\\[]{0,99}\\]\\([^\\(]{0,99}\\),[^,]{0,99}\\=0x0\\=\\=.{0,99}\\?0x0\\:.{0,99},.{0,99}\\=.{0,99}\\[.{0,99}\\]\\[.{0,99}\\]\\[.{0,99}\\]\\(.{0,99}\\);)",
"\n = window.charar $1");

stringsToReplace.put("(var .{0,99}\\=new PIXI\\[\\(.{0,99}\\)\\]\\(.{0,99}\\);this\\[.{0,99}\\]\\=.{0,99}\\[.{0,99}\\]\\[.{0,99}\\]\\[.{0,99}\\]\\[.{0,99}\\]\\[.{0,99}\\]\\(.{0,99}\\),this\\[.{0,99}\\]\\[.{0,99}]\\[.{0,99}\\]\\(.{0,99},\\-.{0,99}\\);var [^=]{0,99}=)",
"$1 window.charal = \n");

stringsToReplace.put("(\\=[^=]{0,99}\\[[^=]{0,99}\\]\\[[^=]{0,99}\\]\\[.{0,99}\\]\\[.{0,99}\\]\\(.{0,99}\\)\\[.{0,99}\\]\\(.{0,99}\\);this\\[.{0,99}\\]\\[.{0,99}\\]\\[.{0,99}\\]\\(\\-.{0,99}\\+.{0,99}\\['x'\\]\\+.{0,99},\\-.{0,99}\\+.{0,99}\\['y'\\]\\),)",
"\n = window.charah $1");
stringsToReplace.put("(\\=[^,;=]{0,70},[^,;=]{0,20}\\=0(x0)?\\=\\=[^,;=]{0,20}\\?0(x0)?\\:[^,;=]{0,20},[^,;=]{0,20}\\=.{0,500}\\((0x1eb,-0x58|491,-88)\\);var [^=]{0,99}=)",
"\n = window.charar $1 window.charal = \n");

stringsToReplace.put("(\\['y'\\]\\),this\\[.{0,99}\\('.{0,99}'\\)\\]\\[.{0,99}\\('.{0,99}'\\)\\]\\(.{0,99}\\+.{0,99},.{0,99}\\-.{0,99}\\);)",
"$1 " + "\n" +
stringsToReplace.put("(\\=[^,;=]{0,40}\\([^,;=]{0,20}\\)[^,;=]{0,30}\\([^,;=]{0,60}\\);this[^,;=]{0,70}\\-[^,;=]{0,70}\\+[^,;=]{0,20}x[^,;=]{0,20}\\+[^,;=]{0,20},\\-[^,;=]{0,40}y[^,;=]{0,20},this[^,;=]{0,50}\\((0x1eb|491)\\+[^,;=]{0,20},[^,;=]{0,20}\\-(0x58|88)\\);?)",
"\n = window.charah $1 ;" + "\n" +
"window.portOffset = -window.charal + window.charah.x;//-l+h.x\n" +
"window.portOffsetR = window.charar;//r\n" +
"\n" +
Expand Down Expand Up @@ -426,13 +420,8 @@ public static String patchKantai3d(String main_js){
"}");


stringsToReplace.put("(\\=Math\\[.{0,99}\\]\\(.{0,99}\\),.{0,99}\\=0x1\\+0\\.012\\*\\(0\\.5\\+0\\.5\\*.{0,99}\\);this\\[.{0,99}\\]\\[.{0,99}\\]\\(.{0,99}\\),)",
"\n = window.charasin $1");


stringsToReplace.put(
"(this\\['y'\\]=this\\[.{0,99}\\('.{0,99}'\\)]-1.5\\*.{0,99}\\*1.8;)",
"$1\n" +
stringsToReplace.put("(\\=Math[^,;=]{0,40},[^,;=]{0,30}\\=(0x)?1\\+(0)?\\.012[^,;=]{0,10}\\*\\(.{0,29}\\);this[^,;=]{0,90}\\([^,;=]{0,90}\\),this(\\.y|\\['y'\\])=this[^,;=]{0,20}-1.5\\*[^,;=]{0,40}\\*1.8;?)",
"\n = window.charasin $1 ;\n" +
"window.displacementFilter.uniforms.textureScale = this.scale.x;\n" +
"\n");

Expand Down

0 comments on commit 9ac7569

Please sign in to comment.