Emulator(Native Android)

The Uzebox now have a fully functional emulator! Download and discuss it here.
Halamix2
Posts: 16
Joined: Mon Jun 06, 2016 10:04 pm

Re: Emulator(Native Android)

Post by Halamix2 » Sun Sep 24, 2017 6:54 pm


User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Emulator(Native Android)

Post by Artcfox » Sun Sep 24, 2017 11:21 pm

Halamix2 wrote:
Sun Sep 24, 2017 6:54 pm
Can be done: https://github.com/artcfox/cuzebox-android/pull/2
Awesome, I'll test this out tonight. I don't know if i have any pre-6.0 devices to make sure that it reverts back to asking for the permissions at install time for those though.

User avatar
nicksen782
Posts: 667
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Emulator(Native Android)

Post by nicksen782 » Sun Sep 24, 2017 11:34 pm

Doesn't the Android emulator that comes with their dev studio allow for you to chose the API level? I know it wouldn't be as good as an actual device but would it be good enough?

User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Emulator(Native Android)

Post by Artcfox » Sun Sep 24, 2017 11:46 pm

nicksen782 wrote:
Sun Sep 24, 2017 11:34 pm
Doesn't the Android emulator that comes with their dev studio allow for you to chose the API level? I know it wouldn't be as good as an actual device but would it be good enough?
Oh, I haven't tried provisioning an emulator yet. It looks like if I do it this way I need to over ride even more methods that do different things depending on the results of that dialog, and that is where that user defined constant that Halamix2 put 13 in for. It seems like it would be easier to just deny the app install completely if the user doesn't grant those permissions at install time. I'm not really seeing any advantages of making it overly complicated when you can just declare a lower targetSdkVersion. It just means that I have to test out all of the combinations of privileges that someone may choose to deny to the app, and special case the result of each denial, when I'd rather just say "Okay, if you don't want it to work, then don't install the app."

shockdesign
Posts: 26
Joined: Mon Jan 06, 2014 12:20 pm

Re: Emulator(Native Android)

Post by shockdesign » Mon Sep 25, 2017 4:47 am

I've spun it up in the emulator and it was a bit flaky, tbh you should be able to drop the minimum supported version down to 15 or something and that should cover most devices..

User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Emulator(Native Android)

Post by Artcfox » Mon Sep 25, 2017 6:02 am

shockdesign wrote:
Mon Sep 25, 2017 4:47 am
I've spun it up in the emulator and it was a bit flaky, tbh you should be able to drop the minimum supported version down to 15 or something and that should cover most devices..
Yep. The minimum supported was 12, but then SDL had that #define set to 14, so I bumped the minimum in the app up to 14 to match and no more redefinition warnings when compiling.

User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Emulator(Native Android)

Post by Artcfox » Mon Sep 25, 2017 5:36 pm

Halamix2 wrote:
Sun Sep 24, 2017 6:54 pm
Can be done: https://github.com/artcfox/cuzebox-android/pull/2
Thank you very much for the pull request, though when I tried it it still crashed because the runtime permissions request happens asynchronously, and the native SDL code started in the background. The end result was a crash dialog on top of the permissions request dialog.

I was able to rework what you provided so it waits until the permissions request is granted before it launches the activity containing the native code. On phones running an OS version that doesn't support runtime permissions, it should just immediately launch the activity containing the native code. I couldn't get AVD to start a virtual device on Linux, even after installing the 32-bit libraries it supposedly needs, so this hasn't been tested on really old devices.

Thanks for making me fix this the correct way. I pushed the changes to the master branch, so I'll close your pull request now.

I've resigned myself to the fact that some of this is going to need to be done in Java, though I have to admit that Android Studio is pretty awesome. :P

Halamix2
Posts: 16
Joined: Mon Jun 06, 2016 10:04 pm

Re: Emulator(Native Android)

Post by Halamix2 » Tue Sep 26, 2017 12:14 am

About AVDs: make sure you have kvm installed (help for Ubuntu), it is necessary since AS 2.0

User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Emulator(Native Android)

Post by Artcfox » Tue Sep 26, 2017 2:18 am

Halamix2 wrote:
Tue Sep 26, 2017 12:14 am
About AVDs: make sure you have kvm installed (help for Ubuntu), it is necessary since AS 2.0
The problem was I didn't have the 32-bit versions of some libraries installed:

On Debian:

Code: Select all

sudo apt-get install lib32stdc++6 lib32z1 lib32ncurses5
solved it, but it didn't look like it ran any of the native code stuff. At least it was enough for me to install the app and see that it automatically got the required permissions, which was what I wanted to see.

Edit: Actually it was a combination of installing the above libraries, and selecting Software Rendering before the emulator would run for me.

User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Emulator(Native Android)

Post by Artcfox » Wed Sep 27, 2017 12:23 pm

This build should just work on your Android device; no manual configuration, or pre-enabling of permissions required (it'll ask you for permissions after you run it).

I optimized the touch-n-tilt support to make it faster, added runtime permissions checking, it automatically creates the cuzebox directory for you (it queries your external storage path, so it's no longer hardcoded), it extracts a Bootloader.hex file and an empty eeprom.bin file that has the "always boot to menu" configuration bit enabled, and I tossed in a few games known to work well with touch-n-tilt support that will automatically get extracted into the cuzebox folder if they don't already exist there.

If you want to add more games, just copy them into the "cuzebox" directory that's located wherever your external storage is. (On my phone it is "/storage/emulated/0/cuzebox" but it might be different on yours. It should be a sibling directory of your Downloads or DCIM folder, so if you can get there, just go up a level. I recommend using Total Commander for copying the files there.) In a future version, I'm planning on having the app display this path right from inside the app so you can find it easier, along with instructions on where the touch zones for the buttons are.

The touch zones for the buttons are as follows:

Code: Select all

 _________________________________________________________
|____________LSH_____________|____________RSH_____________|
+                            |                            |
|           SELECT           |           START            |
+----------------------------+----------------------------+
|             Y              |             X              |
+----------------------------+----------------------------+
|             B              |             A              |
+----------------------------+----------------------------+
This version also works with a keyboard and a USB-OTG connector, but not game controllers yet.
Attachments
cuzebox-tilt-n-touch.zip
CUzeBox for Android with faster touch support, no pre-setup necessary, it should just work, includes a few games known to work well with touch-n-tilt interface.
(2.94 MiB) Downloaded 102 times

Post Reply

Who is online

Users browsing this forum: nicksen782 and 1 guest