-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add awaiter implementation #133
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
I investigated this pull request and what it's attempting to solve. I discovered that the type system improvements I mentioned above will not automatically fix the issue. As I understand it, the issue is that even if proper interface support is implemented with system interface support, only the Il2Cpp For the rewrite, I could see a generic implementation where all Il2Cpp I am willing to review this pull request once it has been ported to AsmResolver. |
Paste from ML plugin, will be changed to remove unnecessary code/comments & improve generic handling
- Use CorLibTypeFactory.Void for void reference - Added a couple more early-outs before LINQ - Use .Single - Use MemberCloner (and define a nested type for that) - Check method signature & forward to methods that may have been wonkily unhollowed
Whenever you're ready for another review, let me know. |
Ah yeah, if you can review again that'd be great |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it another pass. 👍
- Use .Single for action conversion - Match interface using namespace (in addition to name) - Match method using .OriginalMethod.Name - Use SignatureComparer & change comment to reflect that - Make sure method is instanced - Remove nop opcodes
Apologies for the month of absence, it's ready for review again. I'm not too familiar with PRs, so if it needs to be brought up to date with main again, let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! I gave your PR another review. In addition to the changes I wrote comments about, I also noticed that the continuous integration is indicating a code format problem. That'll need resolved too.
Instead of MemberCloner
Ready for review again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more thing to change.
// Used later for MemberCloner, just putting up here as an early exit in case .Module is ever null | ||
if (typeContext.NewType.Module is null) | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
@js6pak Do you have any feedback for this PR before I merge it? |
Adds
Pass61ImplementAwaiters
Looks for types implementing
INotifyCompletion
and generates new methods that allow the interop types to implement that interface, calling the Il2CppSystem.Action -> System.Action implicit conversion before calling the original method.This makes originally-awaitable types (e.g.
UniTask
s, if the game has them) awaitable again.I previously did this in a much less automated way with Cecil in another project, but the runtime didn't like what I was doing, so I figured I'd make it less janky and add it to Il2CppInterop, and sure enough the runtime no longer rejects the type.