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

Function forModule

Il2cppHook/_Ufunc.js:13109–13134  ·  view source on GitHub ↗

@internal

(...moduleNames)

Source from the content-addressed store, hash-verified

13107], Target, "targets", null);
13108/** @internal */
13109function forModule(...moduleNames) {
13110 return new Promise(resolve => {
13111 for (const moduleName of moduleNames) {
13112 const module = Process.findModuleByName(moduleName);
13113 if (module != null) {
13114 resolve(moduleName);
13115 return;
13116 }
13117 }
13118 const interceptors = Target.targets.map(target => Interceptor.attach(target.address, {
13119 onEnter(args) {
13120 this.modulePath = target.readString(args[0]) ?? "";
13121 },
13122 onLeave(returnValue) {
13123 if (returnValue.isNull())
13124 return;
13125 for (const moduleName of moduleNames) {
13126 if (!this.modulePath.endsWith(moduleName))
13127 continue;
13128 setImmediate(() => interceptors.forEach(i => i.detach()));
13129 resolve(moduleName);
13130 }
13131 }
13132 }));
13133 });
13134}
13135exports.forModule = forModule;
13136
13137}).call(this)}).call(this,require("timers").setImmediate)

Callers

nothing calls this directly

Calls 2

mapMethod · 0.45
attachMethod · 0.45

Tested by

no test coverage detected