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
[WIP] Android build #88
Conversation
…f0cbde4cb3802d87fa (as advised for "complex projects" here https://github.com/libsdl-org/SDL/blob/release-2.26.4/docs/README-android.md)
(this is needed for Android build)
we now build SDL twice: once under rust-sdl2 and second time for Android from source
- switch to rust-sdl2 version where hidapi wasn't removed - remove CmakeFiles
- Cherry pick 981e206 with small modification to work on both Android and macOS - Remove unused code
Congratulations on getting this in a good enough state to open a pull request? And thanks for your efforts on this, I know it's been a lot of work! To others: please do not comment on this PR asking when this will be merged, thanks in advance. |
Thanks and sorry, in case it wasn't clear, I think it's ready to be reviewed. It would be great to receive at least high level feedback, like which parts are absolutely necessary to be reworked and which are ok to merge in the current state. |
src/frameworks/opengles/eagl.rs
Outdated
/// Variant of present_renderbuffer but for Android | ||
/// Instead of blitting between framebuffers, we use CopyTexImage2D to copy renderbuffers to a texture | ||
/// TODO: refactor common parts with present_renderbuffer | ||
#[cfg(target_os = "android")] |
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'm not sure how realistic this is, but can we share most of the code rather than duplicating the whole function?
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.
Well, I see 2 possibilities:
- use present_renderbuffer's platform specific versions
- have single function filled with platform specific branching inside function body
I opted for first one for the sake of readability, but can try to implement second option if you think it's preferable
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.
Oh wait I forgot that it bypasses the API abstraction, so it is actually API-specific right now :(
I guess this conflicts with what I said above about wanting GLES1Native to be available on desktop. Okay, I guess we'll leave it as-is for now and we can clean it up later.
android/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java
Outdated
Show resolved
Hide resolved
This re-uses the fullscreen mode to fix the positioning and scaling issues, and adds Android-specific code to handle rotation.
I reworked things a bit when merging to minimize the diff from trunk.
This might save some compilation time?
This is derived from ciciplusplus's commit a768067 but has a number of changes.
I refuse to commit huge scripts and binaries I didn't write, and which don't have license headers, to git. That gradle is hard to use without them is gradle's problem.
What is this all about?
This is a WIP Android build, supporting aarch64 devices
What was tested?
Super Monkey Ball 1.02 on Google Pixel 3a (playable, but tilt controls not working, so not that playable)All supported apps (fully playable!)I've not tested Windows version after the changes
How to use
Refer to BUILDING.md in android folder for building instruction.
IMPORTANT: in the current state Android app expects a particular setup for file folder to work.
In particular,
/data/data/org.touchhle.android/files
folder on your device should contain:aSuper Monkey Ball v1.02 .ipa
(legally obtained and owned; note 2 spaces between Ball and v1.02)touchHLE_apps
folder with your appstouchHLE_fonts
andtouchHLE_dylibs
folders from touchHLE source or binary distributionImportant changes
main.rs is split now to lib.rs (android build) and main.rs (desktop build)introducing OpenGL ES 1.1 native implementationorg.touchhle.android
bundleKnown issues
No mechanism for app/ipa selection/loadingTilt controls are not implementedApp scale/orientation is hardcodedSDL is built twice: once with rust-sdl2 and once specifically for AndroidSome GL functions in update_renderbuffers do not have equivalents in Gles 1.1, so i just commented them out. While I've not observed any visible glitches, the cleaning/restoring of gl context may not work perfectly here.Logging with println!() is not working. Normally, with android_log it should be redirected to logcat, but, firstly,log
dependency of it conflicts with internal log module and, secondly, even if fixed, it's still not working. At the brighter side, sdl2::log works, so all log!() calls using it insteadReferences
P.S.
Hope that my monkey patching (pun intended) it's not too big to review 😸