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

Problem with passing value type to function #498

Open
soletsabuse opened this issue Mar 29, 2024 · 6 comments
Open

Problem with passing value type to function #498

soletsabuse opened this issue Mar 29, 2024 · 6 comments

Comments

@soletsabuse
Copy link

soletsabuse commented Mar 29, 2024

Il2Cpp.perform(() => {
const List = Il2Cpp.corlib.class("System.Collections.Generic.List1");
const Int32List = List.inflate(Il2Cpp.corlib.class("System.Int32"));

const list = Int32List.new();
list.method("Add").invoke(1);
});

Error: access violation at 0x1 ...

Seems like it treats argument as address. Need some workaraounds asap

@soletsabuse
Copy link
Author

Seems like in my game there is no implementation for List<System.Int32>.Add
In other project that works.

If somebody has any workarounds how to create this object please tell me.

@soletsabuse
Copy link
Author

Maybe some methods from mscorelib.dll were stripped? Can I create this object directly in the memory and pass it to the function as a parameter after that?

Any help is apreciated <3

@thinhbuzz
Copy link
Contributor

Call list.method('.ctor').invoke() after new

@soletsabuse
Copy link
Author

I did it. I tried different ways. There is no problem in different game. Looks like there are not such method in compiled il2cpp code. So I need to recreate the whole structure somehow.

@soletsabuse
Copy link
Author

Still have such problem

@commonuserlol
Copy link

still not solved?
try

const list = Int32List.alloc();
list.method(".ctor").invoke();
list.add(1337);

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