SDL port for Android SDK/NDK 1.6

Quickly share your Android Code Snippets here...

Re: SDL port for Android SDK/NDK 1.6

Postby Jug6ernaut » Tue Aug 31, 2010 11:52 pm

Why not make it where when onPause or onResume is called it calls a native function that sends a User Message that the user can handle?

Then in hte Main onPause and OnResue will handle the windows creating/destroying as needed.
Jug6ernaut
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Jun 17, 2010 7:00 pm

Top

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Wed Sep 01, 2010 4:36 pm

Finally I've fixed the crash when changing screen orientation or opening keyboard (thanks Kurosu!).
Next change will be to fix the crash when pressing Menu key (basically integrate the changes by renpytom).
Also Ultimate Droid theme now has auto-fire mode (looks ugly, eh?).
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby SBS » Wed Sep 01, 2010 6:02 pm

pelya:

I noticed a bug in the new version of OpenTyrian that you published to the market. Steering the ship with your finger works great, but I can no longer save any games if I don't use the on-screen keyboard. Because the screen is no longer a button (it used to be the return-button), you just can't save. Maybe if you assigned the trackball to "Space" instead of "Return" that would solve the problem?

Great work btw!
SBS
Freshman
Freshman
 
Posts: 3
Joined: Sat Aug 28, 2010 11:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby kurosu » Thu Sep 02, 2010 7:59 am

I noticed you removed the WakeLock permission. I've removed vibrate permission from wormux', because it is misleading, but from this code, it seems quite feasible.

Now, the more troublesome part is integration:
  • Under sdl 1.3, there's haptic functionalities, but this sounds troublesome; a question is still whether such code should go in the sdl, as the vm pointeris already needed etc
  • It needs to be called by the application whenever it wishes (from multiple threads? concurrently with a vibration in progress?)
  • I see it as a JNI callback, and the application might do more JNI calls (Wormux does, for file downloading in game), so there should be a centralized OnLoad/OnUnload to store the vm pointer
kurosu
Experienced Developer
Experienced Developer
 
Posts: 94
Joined: Sat Jun 12, 2010 1:56 pm

Re: SDL port for Android SDK/NDK 1.6

Postby DangerMouse » Wed Sep 08, 2010 3:57 am

Hey Pelya, what's your status with Star Control II with the 3DO audio and Music Remixes?

Oh and was it possible to attain the 3DO videos or is that under copyright? I have the Star Control II 3DO Rom since I've bought the game. Perhaps we could load it from that or rip them from it for use?
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby kurosu » Wed Sep 08, 2010 9:17 am

I've started translating strings in the java part. I find the android i18n support pretty crappy (let's do it differently and not compatible with others!), but I decided to cope with that burden. The changes can't be directly applied to your version, but here are some.
kurosu
Experienced Developer
Experienced Developer
 
Posts: 94
Joined: Sat Jun 12, 2010 1:56 pm

Top

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Wed Sep 08, 2010 9:33 am

kurosu wrote:I've started translating strings in the java part. I find the android i18n support pretty crappy (let's do it differently and not compatible with others!), but I decided to cope with that burden. The changes can't be directly applied to your version, but here are some.

Thanks, I'll merge that.
If you wish I can give you write access to my repository on Github (but you then have to use latest version of my sources in your build environment :wink: )
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby kurosu » Wed Sep 08, 2010 1:21 pm

Actually, I think I need to slow down a lot on what I'm doing with Wormux, so I probably shouldn't disperse myself and starts something else. Thanks for the proposal though.
kurosu
Experienced Developer
Experienced Developer
 
Posts: 94
Joined: Sat Jun 12, 2010 1:56 pm

Re: SDL port for Android SDK/NDK 1.6

Postby bobrules » Fri Sep 10, 2010 1:26 am

Looking good. I just started with android dev but can I use multiple Activity's with one of the activity being the main sdl program?

Also how do I remove it from debug build?
Also whenever I initialize the SDL_audio i get this in logcat
Code: Select all
ANDROIDAUD_OpenAudio(): app requested audio bytespersample 0 freq 8000 channels 1 samples 256
I/libSDL  (  237): ANDROIDAUD_OpenAudio(): app opened audio bytespersample 2 freq 8000 channels 1 bufsize 1137753840

which causes a crash. Is there a way to fix this?
Thanks a bunch.
bobrules
Freshman
Freshman
 
Posts: 5
Joined: Thu Sep 09, 2010 10:26 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Fri Sep 10, 2010 9:05 am

bobrules wrote:Also whenever I initialize the SDL_audio i get this in logcat
Code: Select all
ANDROIDAUD_OpenAudio(): app requested audio bytespersample 0 freq 8000 channels 1 samples 256
I/libSDL  (  237): ANDROIDAUD_OpenAudio(): app opened audio bytespersample 2 freq 8000 channels 1 bufsize 1137753840

which causes a crash. Is there a way to fix this?

Mmm, once I've seen something like that, usually means you have to clean up files from project/bin and recompile.
If that fails try to add debug output to project/src/Audio.java to function initAudio()

bobrules wrote:Looking good. I just started with android dev but can I use multiple Activity's with one of the activity being the main sdl program?

Also how do I remove it from debug build?

Theoretically yes, but I never tried that, so cannot really help you. Also I don't know how to remove something from Java in debug build, Java does not have a preprocessor - there should be some way, ask ppl around the forum (there should be lot of Java coders around).
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby bobrules » Sat Sep 11, 2010 3:05 am

Ahh ok. THanks very much for your hard work.
bobrules
Freshman
Freshman
 
Posts: 5
Joined: Thu Sep 09, 2010 10:26 am

Re: SDL port for Android SDK/NDK 1.6

Postby Shofixti Solider » Tue Sep 14, 2010 3:27 am

Pelya thank you very much for the star control 2 port! 1 of my all time favorite games. I remember when I had to configure my 486sx 100mhz to run this game. Not the correct spot to bring this up but i have seen you come here frequently. For UrQuan Masters please add blue tooth controller support and hdmi output. I saw you have the EVO so this would benefit you,think or playing your port on a HD TV with a wiimote. Also any way of adding voice addon and 3do movies?My next request is HUGE I saw in one of your earlier post about SCUM-V :mrgreen: M emulator for all the great games. Please space quest would great.
Shofixti Solider
Freshman
Freshman
 
Posts: 4
Joined: Tue Sep 14, 2010 3:06 am

Re: SDL port for Android SDK/NDK 1.6

Postby DangerMouse » Tue Sep 14, 2010 9:40 am

I so agree Shofixti Solider. Definitely would be sweet. It can already be played on the Amiga Emulator if you're dying to relive the past while going conveniently portable. It runs a little slow, and it's annoying as hell having a non-slide away virtual keyboard since I'm using Droid X. That or a keyboard the occludes the whole entire screen while inputing... definitely annoying... but I have been able to play all the kings quests, space quests and monkey islands till my hearts content. Haven't seen Heroes quest on that emu yet, but the list of titles is insanely large. I've been dying for the ScummVM emu to be released so that that droid 2.1+ is supported, and specifically a non-keyboard widescreen supported version so I could enjoy all my old favorites on my smart phone. :)
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Tue Sep 14, 2010 10:02 am

Just use Wiimote Controller app and redefine action keys in UQM game config menu (Setup->Configure controls->Edit controls) - people reported it's possible for OpenTyrian, should be equally possible for UQM, though I've never tried that - someone please test and report back, I don't have WiiMote. Oh wait, I DO have it, in our corporative gaming room :) however Wiimote Controller won't work with HTC Sense UI, screw that HTC why didn't they use vanilla Android release? So anyway, waitinh for test reports.

HDMI output will be tricky - I've read the doc here: https://docs.google.com/View?id=dhtsnvs ... ort_338048
It says that in order to output something to HDMI you need to have a VideoView class visible on screen: http://developer.android.com/reference/ ... oView.html .
This class does not have any method like "showMyOwnCustomImage()", it just plays the video from the given path, so obvious solution is to create special FIFO file or open a socket, point the VideoView to play this FIFO or socket, and then write raw uncompressed video frames to that FIFO with some small header so that VideoView will recognize it as a proper video format.
UQM gives 5 FPS without such hacks, if I'll implement that FPS will drop to 1-2 (maybe not that bad, I have to actually try that), because you'll have to do huge memcpy(), plus VideoView will contain some buffer to ensure the playback is smooth, so the data on your TV will lag halfsecond behind the data on the device screen.

So the conclusion: I'll implement this, but no earlier that 2 months from now. I've added that as a bug to my readme, so I won't forget.

I'll add voice and 3DO movies support next week - they are working in PC version, I just have no time currently to do that. However to play 3DO movies you'll need to own a 3DO game CD, and copy the movie files form it to your SDcard, because the movies cannot be redistributed for legal reasons.

To play Space Quest games you'll need ScummVM emulator + original game copied to your SDcard, there is already a port of ScummVM to Android: http://sites.google.com/site/scummvmandroid/ , but it contains some bugs, I think I'll make my own version of it.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Shofixti Solider » Tue Sep 14, 2010 6:22 pm

That is great news. Thanks again, I really appreciate this. I work for one of the top two cellphone companies here in the USA and when I show them how to use Android market I will be showing you apps, you should set up a donation link. I know we can't pay you directly for the awesome work. But I would love to donate and I am sure many others would do the same to continue your work. Thanks for bringing back some of my fondest childhood memories.
Shofixti Solider
Freshman
Freshman
 
Posts: 4
Joined: Tue Sep 14, 2010 3:06 am

Top
PreviousNext

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 2 guests