MCPcopy Create free account
hub / github.com/axhlzy/Il2CppHookScripts / attachMethodInfo

Method attachMethodInfo

Il2cppHook/_Ufunc.js:612–705  ·  view source on GitHub ↗
(method, detailLog = false)

Source from the content-addressed store, hash-verified

610 }
611 static callTimesInline = 0;
612 static attachMethodInfo(method, detailLog = false) {
613 if (method.virtualAddress.isNull()) {
614 LOGE((0, il2cppM_1.methodToString)(method));
615 return;
616 }
617 if (Breaker.map_attachedMethodInfos.has(method))
618 return;
619 try {
620 let handleFunc = Interceptor.attach(method.virtualAddress, {
621 onEnter: function (args) {
622 if (!Breaker.needShowLOG(method, "onEnter"))
623 return;
624 if (!detailLog) {
625 let cacheID = `[${++Breaker.callTimesInline}|${new Date().toLocaleTimeString().split(" ")[0]}]`;
626 this.passValue = new valueResolve_1.default(cacheID, method).setArgs(args);
627 return LOGD(this.passValue.toString());
628 }
629 else {
630 let tmp_content = [];
631 if (!method.isStatic) {
632 tmp_content[0] = ` inst\t| \t\t\t\t${args[0]}\t\t[ ${valueResolve_1.default.fakeValue(args[0], new Il2Cpp.Type(ptr(1)), method)} ] ( ${method.class.handle} )`;
633 for (let index = 1; index < method.parameterCount + 1; ++index) {
634 let start = ` arg${index} | `;
635 let parameterName = formart_1.formartClass.alignStr(`${method.parameters[index - 1].name}`, 10);
636 let mid = `${parameterName}\t--->\t\t${formart_1.formartClass.getPtrFormart(args[index])}\t\t`;
637 let end = `${method.parameters[index - 1].type.name} (${method.parameters[index - 1].type.class.handle})`;
638 let res = `\t ${valueResolve_1.default.fakeValue(args[index], method.parameters[index - 1].type, method)}`;
639 tmp_content[tmp_content.length] = `${start}${mid}${end}${res}`;
640 }
641 }
642 else {
643 for (let index = 0; index < method.parameterCount; ++index) {
644 let start = ` arg${index} | `;
645 let parameterName = formart_1.formartClass.alignStr(`${method.parameters[index - 1].name}`, 10);
646 let mid = `${parameterName}\t--->\t\t${formart_1.formartClass.getPtrFormart(args[index])}\t\t`;
647 let end = `${method.parameters[index].type.name} (${method.parameters[index].type.class.handle})\t `;
648 let res = `${valueResolve_1.default.fakeValue(args[index], method.parameters[index].type, method)}`;
649 tmp_content[tmp_content.length] = `${start}${mid}${end}${res}`;
650 }
651 }
652 this.content = tmp_content;
653 let classTitle = `${method.class.namespace}.${method.class.name}`;
654 let disptitle = `${classTitle} | ${(0, il2cppM_1.methodToString)(method, true)}\t [${method.handle} -> ${method.virtualAddress} -> ${method.relativeVirtualAddress}] | ${new Date().toLocaleTimeString().split(" ")[0]}`;
655 this.disp_title = disptitle;
656 }
657 },
658 onLeave: function (retval) {
659 if (!Breaker.needShowLOG(method, "onLeave"))
660 return;
661 if (!detailLog && this.passValue != undefined)
662 Breaker.array_methodValue_cache.push(this.passValue.setRetval(retval));
663 if (this.content == null || this.disp_title == null)
664 return;
665 let start = ` ret\t| `;
666 let mid = `\t\t\t\t${formart_1.formartClass.getPtrFormart(retval)}\t\t`;
667 let end = `${method.returnType.name} (${method.returnType.class.handle})\t `;
668 let res = `${new valueResolve_1.default("", method).setRetval(retval).resolve(-1)}`;
669 this.content[this.content.length] = `${start}${mid}${end}${res}`;

Callers 2

attachMethodInnerMethod · 0.45
_Ufunc.jsFile · 0.45

Calls 13

isNullMethod · 0.80
LOGEFunction · 0.70
LOGDFunction · 0.70
LOGOFunction · 0.70
getLineFunction · 0.70
toStringMethod · 0.65
attachMethod · 0.45
setArgsMethod · 0.45
alignStrMethod · 0.45
setRetvalMethod · 0.45
resolveMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected