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

Fix for '_enumerateFacets' in 10.15+ #62

Open
jslegendre opened this issue Aug 18, 2020 · 3 comments
Open

Fix for '_enumerateFacets' in 10.15+ #62

jslegendre opened this issue Aug 18, 2020 · 3 comments

Comments

@jslegendre
Copy link

jslegendre commented Aug 18, 2020

Turns out CoreUI.framework has its own implementation of the BOM* functions which are NOT exported.

% nm -a /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI | grep BOM  
...
00007fff4228e697 t _BOMTreeIteratorFree
00007fff4228dcf1 t _BOMTreeIteratorIsAtEnd
00007fff4228dd45 t _BOMTreeIteratorKey
00007fff42290791 t _BOMTreeIteratorKeySize
00007fff4228d819 t _BOMTreeIteratorNew
...

In order to get _enumerateFacets working, we only need the CoreUI variants of BOMTreeIteratorNew and BOMTreeIteratorFree.

With these functions being not visible to the linker or dlsym, they have to be resolved manually during runtime. I was able to do this with my libSymRez project like so:

symrez_t sr_coreui = symrez_new("CoreUI");
BOMTreeIteratorRef (*CUIBOMTreeIteratorNew)(BOMTreeRef, int, int, int) = sr_resolve_symbol(sr_coreui, "_BOMTreeIteratorNew");
void (*CUIBOMTreeIteratorFree)(BOMTreeIteratorRef) = sr_resolve_symbol(sr_coreui, "_BOMTreeIteratorFree");

Then replace the functions:

--  BOMTreeIteratorRef iterator = BOMTreeIteratorNew(facet_tree, 0, 0, 0);
++ BOMTreeIteratorRef iterator = CUIBOMTreeIteratorNew(facet_tree, 0, 0, 0);

...

--  BOMTreeIteratorFree(iterator);
++ CUIBOMTreeIteratorFree(iterator);

And we are back in business. It would probably be best to replace all BOM related functions with their CoreUI counterparts but this gets us going.

No idea why _enumerateColors works but _enumerateFacets doesn't.

@ghost
Copy link

ghost commented Aug 20, 2020

While this is fixed with current code* it's fascinating still. I'm more curious if this does anything for allowing ThemeEngine to open .car files on Big Sur..

*although perhaps a slightly more aggressive approach?!

@jslegendre
Copy link
Author

jslegendre commented Aug 20, 2020

The current code isn't "fixing" the issue, its skipping over the issue. But yes, it's a fairly aggressive approach which is why I did not submit a PR for it. Mainly opened this issue to have a discussion about implementation, if it should be done, etc...

@jslegendre
Copy link
Author

@alexzielenski Any ideas?

jslegendre added a commit to jslegendre/ThemeEngine that referenced this issue Sep 6, 2020
For more information see: alexzielenski#62
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

1 participant