From c48e59313c1c4a68d00db02d02fe9d4a982016bc Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 7 Aug 2018 19:56:25 +0300 Subject: [PATCH] Update unity.js --- scripts/unity.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/unity.js b/scripts/unity.js index f20cbd3..c7da9d3 100644 --- a/scripts/unity.js +++ b/scripts/unity.js @@ -25,11 +25,11 @@ function cb(funcName) { } } -function hookMethod(dll, klass, method, extra) { +function hookMethod(dll, name_space, klass, method, num_params, extra) { // var monoImage = mono_image_loaded(dll); // monoImage will be the same as this.extra.image - var monoClass = mono_class_from_name(extra.image, "", klass); - var monoMethod = mono_class_get_method_from_name(monoClass, method, -1); + var monoClass = mono_class_from_name(extra.image, name_space, klass); + var monoMethod = mono_class_get_method_from_name(monoClass, method, num_params); // = mono_class_get_method_from_name(monoClass, "lastRecivedGameId", -1); // mono_class_get_field var compiledMethod = mono_compile_method(monoMethod); @@ -58,10 +58,25 @@ function hook() { onLeave: function(retval) { if (this.extra.fname.endsWith("Assembly-CSharp.dll")) { this.extra.retval = retval; - hookMethod(this.extra.fname, "NetworkDriver", "AskForQuestion", this.extra); + hookMethod(this.extra.fname, "", "NetworkDriver", "AskForQuestion", -1, this.extra); } } }); + /* + Interceptor.attach(Module.findExportByName(null, "mono_class_from_name"), { + onEnter: function(args) { + this.extra = { + name_space: Memory.readUtf8String(args[1]), + name: Memory.readUtf8String(args[2]) + }; + }, + onLeave: function(retval) { + if (this.extra.name_space.indexOf("UnityEngine.UI") != -1) { + console.log(JSON.stringify(this.extra, null, 2)); + } + } + }); + */ } /** @@ -152,7 +167,6 @@ Java.perform(awaitForCondition(hook)); - /*