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

Is REX properly loaded on macOS native UI build for every scenario? #130

Open
pguyot opened this issue Jan 9, 2022 · 2 comments
Open

Is REX properly loaded on macOS native UI build for every scenario? #130

pguyot opened this issue Jan 9, 2022 · 2 comments

Comments

@pguyot
Copy link
Owner

pguyot commented Jan 9, 2022

https://github.com/pguyot/Einstein/blob/master/Emulator/ROM/TFlatROMImageWithREX.cpp#L135

#else
	// TODO: we can find the Rex in the MacOS .app resources
	::free(theData);

Apparently, with FLTK binaries, the REX is included in source code, generated at build time from the file.
https://github.com/pguyot/Einstein/blob/master/app/TFLRexImage.fl

If REX is meant to always be included in code (does it really make sense?), should we port this to macOS, too?
Is there any case where the code breaks because loading REX from resources has been lost?

@MatthiasWM MatthiasWM changed the title Is REX properly loaded on macOS native UI buid for every scenario? Is REX properly loaded on macOS native UI build for every scenario? Jan 9, 2022
@MatthiasWM
Copy link
Collaborator

Well, here is my reason for implementing it this way. Most Einstein users are not developers, and asking them to add the ROM is already quite a hurdle. Asking them to also add the Rex is yet another unnecessary bump. The proof is in the question "when did we ask users to install a new Rex file?"

Using FLTK's user interface designer in this case has nothing to do with UI creation, but Fluid has a nice option that converts any binary into C++ that generates the binary again when compiled. If dependencies are set correctly, it will do this every time Einstein.rex is newer than app/TFLRexImage.fl, so the newest Rex will compiled into the app.

It is of course possible to check for the existence of an Einstein.rex in the same directory as the ROM, and use that if its creation date is newer than the App's compilation date (which is hardcoded into Einstein via app/Version.h, and updated automatically via CMake (only)).

For the native macOS build, I would recommend to set Einstein.rex as a resource, so it gets added to the bundle. If the Rex in the bundle is older than an external Rex, you could still load the external one. Otherwise use the internal one as a fallback. No need to compile it into the binary.

BTW: I am rewriting the Version.h logic as we speak and will push a functionally equivalent version in a few minutes.

@MatthiasWM
Copy link
Collaborator

@pguyot How do you propose we continue here? Or is this resolved already?

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

2 participants