Interceptor Example Not Work.
AsukaWhite opened this issue · comments
Copied the full example in Snippet/Interceptor . but can't compile success.
/playground/index.ts:19:5 - error TS2322: Type '(this: Class | ValueType | Object, value: String) => boolean' is not assignable to type '(this: Class | ValueType | Object, ...parameters: Type[]) => boolean'. Types of parameters 'value' and 'parameters' are incompatible. Type 'Type' is not assignable to type 'String'. Type 'number' is not assignable to type 'String'. Compiled index.ts (1221 ms)
Another Question: it works if interpetor function without parameter, how to interceptor function with multiple parameters.
no idea how to deal, i have workaround as npm uninstall @types/frida-gum
or smth
or you can use esbuild aswell
I got same situation, and I found a way to address this problem.
For a example, here are some code in my project.
Before
PlayVoice.implementation = function (key: Il2Cpp.String, channel: Il2Cpp.String, volum: any, crossfadeDuration: any, delay: any, loop: boolean) {
Logger.logDebug(`PlayVoice in ${key}`)
key = Il2Cpp.string(audioArray[Math.floor(Math.random() * audioArray.length)])
//Logger.logDebug(`PlayVoice out ${key}`)
return this.method('PlayVoice').invoke(key, channel)
// return this.method('PlayVoice').invoke(key, channel, volum, crossfadeDuration, delay, loop)
}
After
PlayVoice.implementation = function (...parameters: any[]) {
const key = parameters[0];
const channel = parameters[1];
Logger.logDebug(`PlayVoice in ${key}`);
const newKey = Il2Cpp.string(audioArray[Math.floor(Math.random() * audioArray.length)]);
//Logger.logDebug(`PlayVoice out ${key}`)
return this.method('PlayVoice').invoke(newKey, channel);
// return this.method('PlayVoice').invoke(key, channel, volum, crossfadeDuration, delay, loop)
};
But this solution also leads to a new problem: we can't specify each type of parameters except Il2Cpp.Parameter.Type
, and other features.
you won't have editor hints and stuff in that case