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

Support Mac for Unity / Mono #53

Closed
wants to merge 8 commits into from
Closed

Conversation

AlexKnauth
Copy link
Contributor

@AlexKnauth AlexKnauth commented Sep 13, 2023

This adds Mac support to asr::game_engine::unity::SceneManager and asr::game_engine::unity::mono.

The SceneManager support does not rely on std, but the mono support does need std, which can be activated with the std feature.

During development at Image classes table detect cycles, I got cycles in the classes iterator, which I had to detect and break. But at Offsets for 64-bit MachO V2, I found the cause of those cycles was the wrong offset for monoclassdef_next_class_cache. It should have been using 0x100 as the offset to that, but had been incorrectly using 0x108 as the offset.

@AlexKnauth AlexKnauth changed the title WIP: Attempt to support Mac for Unity / Mono Support Mac for Unity / Mono Sep 16, 2023
@AlexKnauth AlexKnauth marked this pull request as ready for review September 16, 2023 06:11
@CryZe CryZe self-requested a review September 17, 2023 21:21
@AlexKnauth
Copy link
Contributor Author

AlexKnauth commented Sep 22, 2023

If I can reduce the size and complexity of asr/src/game_engine/unity/mono.rs by moving some of the PE-specific code there into asr/src/file_format/pe.rs, should I include that in this PR to add Mac support?

In this PR, I'm already trying to put the MachO-specific code that mono.rs needs into a macho.rs file next to pe.rs, so it seems related. Or should I submit a separate PR now, submit a separate PR later to avoid potential merge conflicts, or just leave it as-is, not broken don't fix?

Edit: After #67, the pe::symbols iterator greatly reduces the amount of PE-specific code there.

@AlexKnauth
Copy link
Contributor Author

I have a version of this ready to rebase on top of #63 if/when that gets merged. It just requires another commit analogous to Fix assemblies_pointer vs assemblies, but to fix SceneManager base_address vs address instead, here: AlexKnauth@ff298b7

@AlexKnauth
Copy link
Contributor Author

I have a version of this ready to rebase on top of #71 if/when that gets merged.

@AlexKnauth AlexKnauth marked this pull request as draft January 27, 2024 19:06
@AlexKnauth
Copy link
Contributor Author

AlexKnauth commented Jan 27, 2024

Marking as a draft for now until the cattrs stuff is figured out.

My hope is that some of the differences in offsets I found might turn out to turn out to melt away into differences between cattrs and no-cattrs. If that's the case then it could simplify what's needed for Mac support by a lot.

(Edit: it didn't melt it away, or at least didn't melt most of it)

@AlexKnauth
Copy link
Contributor Author

Closing in favor of #93

@AlexKnauth AlexKnauth closed this Feb 2, 2024
@AlexKnauth AlexKnauth deleted the mono-3 branch February 5, 2024 17:04
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

Successfully merging this pull request may close these issues.

1 participant