Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interceptor Example Not Work. #506

Open
AsukaWhite opened this issue Apr 19, 2024 · 4 comments
Open

Interceptor Example Not Work. #506

AsukaWhite opened this issue Apr 19, 2024 · 4 comments

Comments

@AsukaWhite
Copy link

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.

@commonuserlol
Copy link

no idea how to deal, i have workaround as npm uninstall @types/frida-gum or smth

@commonuserlol
Copy link

or you can use esbuild aswell

@UPON-2021
Copy link

UPON-2021 commented May 5, 2024

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.

@commonuserlol
Copy link

you won't have editor hints and stuff in that case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants