aliens

Author Topic: Android Port (SDL2)  (Read 111447 times)

Offline HappyCat

  • Sergeant
  • **
  • Posts: 24
    • View Profile
Re: Android Port (SDL2)
« Reply #90 on: March 30, 2014, 09:52:34 pm »
There is workaround: bind back button to cancel in options.

Offline sidav

  • Sergeant
  • **
  • Posts: 19
    • View Profile
Re: Android Port (SDL2)
« Reply #91 on: March 30, 2014, 10:51:34 pm »
Yes, there really are the turning glitches.

Offline HappyCat

  • Sergeant
  • **
  • Posts: 24
    • View Profile
Re: Android Port (SDL2)
« Reply #92 on: April 04, 2014, 08:47:37 am »
Overwhelming majority of users (but not everyone) reported that the game crashes sometimes when your soldier/tank/mind-controlled alien is killed. I experience this issue too. It is not persistent and usually doesn't occur again after game re-loading (but the game can crash later after re-loading), and generally seems random without any regularity, also it seems that there is no corellation between device model and this issue.
That's all for now, hope it was helpful
This seems to happen often when current unit dies of reaction fire or first unit ot move next xcom turn dies on alien turn.
Had to modify save game to help hwp survive and make mission completeable(

Offline page

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Re: Android Port (SDL2)
« Reply #93 on: May 15, 2014, 01:22:34 am »
Greetings earthlings!

I've been a bit absent lately because of real life (a little alien has invaded my life ;) ) but I'm semi-back to having some spare time. Long story short, there is a new beta release in place. As always, links and changelog in the wiki, but for the impatient:

As you can see, it is now hosted on openxcom.org, (I'm sure you've all already seen the donation campaign in place to help with the server costs ;) ), as google took down the others from google docs.

One thing I'd like to know: is the crash on mind-controlled units still happening? Does it only happen in android or also pc?

Enjoy!

Offline sidav

  • Sergeant
  • **
  • Posts: 19
    • View Profile
Re: Android Port (SDL2)
« Reply #94 on: May 15, 2014, 10:14:06 am »
Thanks for new version, page! It works, but I already found a bug: when I go to options (changing of parameters doesn't matter) then click "OK", the game causes to exit (or to crash... looks like exit without any messages). Changes on options are saved, though. When i click "Cancel" in the options, everything is normal.
Also, game still complains about unexistence of the ogg files.
« Last Edit: May 15, 2014, 11:07:39 am by sidav »

Offline page

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Re: Android Port (SDL2)
« Reply #95 on: May 15, 2014, 02:11:23 pm »
Thanks for new version, page! It works, but I already found a bug: when I go to options (changing of parameters doesn't matter) then click "OK", the game causes to exit (or to crash... looks like exit without any messages). Changes on options are saved, though. When i click "Cancel" in the options, everything is normal.
Also, game still complains about unexistence of the ogg files.
Good catch :) As for the music, it should work. Are you sure you're not missing the gm.cat file, which was necessary to move or rename with older versions for ogg to work?

Offline sidav

  • Sergeant
  • **
  • Posts: 19
    • View Profile
Re: Android Port (SDL2)
« Reply #96 on: May 15, 2014, 06:45:02 pm »
page,  yes i sure. Maybe, I should change something in audio options?
What about the options bug? It's the most inconvenient thing for now...
« Last Edit: May 15, 2014, 07:44:24 pm by sidav »

Offline sidav

  • Sergeant
  • **
  • Posts: 19
    • View Profile
Re: Android Port (SDL2)
« Reply #97 on: May 16, 2014, 07:45:31 pm »
Another major problem, page. When I command my soldier or tank to shoot, then i can't exit froom shooting mode. Cursor becomes a crosschair and doesn't react on "back" button. It shoots, game doesn't hangs, just can't exit fire mode. In other menus (like soldier stats) the back button works as normal.
Remapping the back button to "Cancel" action in controls options doesn't help.
« Last Edit: May 16, 2014, 08:38:05 pm by sidav »

Offline page

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Re: Android Port (SDL2)
« Reply #98 on: May 17, 2014, 12:51:50 pm »
Another major problem, page. When I command my soldier or tank to shoot, then i can't exit froom shooting mode. Cursor becomes a crosschair and doesn't react on "back" button. It shoots, game doesn't hangs, just can't exit fire mode. In other menus (like soldier stats) the back button works as normal.
Remapping the back button to "Cancel" action in controls options doesn't help.
Luckily Warboy 'fixed' that a while ago. You don't need the back button, but just to press the weapon button a 2nd time to cancel the shooting action. As for you pm question regarding fps and frame drop, it should work as before (to be honest, I'm not sure if fps is in effect or vsync is enabled by default).

Offline sidav

  • Sergeant
  • **
  • Posts: 19
    • View Profile
Re: Android Port (SDL2)
« Reply #99 on: May 17, 2014, 04:01:08 pm »
page, yeah, it works (i think it's even more useful than the back button :)

Offline sfalexrog

  • Captain
  • ***
  • Posts: 56
    • View Profile
Re: Android Port (SDL2)
« Reply #100 on: May 19, 2014, 03:28:09 pm »
After a bit of googling around and fiddling with SDL_gfx (mostly to trick it into compiling with SDL2), I got myself an almost-working OXC-android build from page's source! Well, the debug version, anyway. I've still got a few questions, though:

 - Your Application.mk says to compile for armeabi-v7a, but the .apk you've posted has its libs built for armeabi; is that just an oversight?
 - Which ndk do you use? I'm using r7-crystax-5.beta3, as it's (kinda) supported by Boost. Still, I had to switch to gnustl_static, as it won't compile with stlport.
 - You're trying to load mikmod and smpeg2, but they're not getting built (at least they're not listed in your Android.mk). Is that right? Anyway, I've managed to run the app without them (after commenting out the corresponding loadLibrary() calls). My guess is that they're needed for different types of user data.
 - One thing I'm looking forward to is scaling the graphics. The tablets could really use the 1.5x-2x original resolution in Battlescape. Unfortunately, for now these options are broken (for a good reason, I guess). When I try and whack a hammer at it by changing the constants in Screen.cpp, the battlescape UI goes missing, but the battlescape itself looks beautiful! Though the animations in that case are painfully slow (even on a Nexus 4!).

Anyway, I'd love to see a how-to on compiling this port (or I could try to retrace my steps, but I'm afraid these would be among the "Worst Practices") and maybe do something useful, though my complete lack of experience as a developer will make that tough.
Oh, and you guys rock! 3D explosions are the best thing, and the android port comes really close.

Offline page

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Re: Android Port (SDL2)
« Reply #101 on: May 20, 2014, 12:42:43 am »
Hi sfalexrog! Since I've been asked for those instructions several times lately, I took the time to write at least a basic description in the wiki page. As for your points:
- I thought only the Application.mk governed for which abi it was built? The libs in my builds folders seem to be for armeabi-v7a, how do you know/check that the apk has its libs built for armeabi? As you can see, I'm no ndk expert myself :)
- I don't know what's this 'crystax' ndk. I simply use r9d.
- mikmod and smpeg are SDL_mixer deps, available in its external folder. A bit of simlinking as shown in the wiki and you're done
- Yes, the rendering part needs some work, but I'm not yet familiar enough with oxc scaling to fix all that. You're invited to give it a go ;)

Well, hope this helped a bit. You can drop by the irc channel if you need anything.

Offline sfalexrog

  • Captain
  • ***
  • Posts: 56
    • View Profile
Re: Android Port (SDL2)
« Reply #102 on: May 22, 2014, 08:21:22 am »
Thanks, page! That helped a LOT. Looks like the r9d has stlport that supports exceptions and RTTI, so the compilation went flawless. I believe you only need the header files from boost.
 - As for armeabi and armeabi-v7a, well, I just looked inside your APK, saw that there's only libs/armeabi and no libs/armeabi-v7a and assumed that these were for armeabi. ndk-build _should_ place armeabi-v7a in the armeabi-v7a folder, so I guess there's something weird going on with your build system.
 - About the mikmod and smpeg libraries - okay, that makes sense, I just messed with SDL_mixer configuration and turned off pretty much everything except ogg. Don't know why exactly I did that - probably had some problems compiling it as it is.
 - Oh, the renderer. I've managed to recompile the app with higher internal resolution (still had to set GS and BS to 1.5x in the options, though), turning the cursor back on in the process. For some reason the cursor position didn't scale with the screen, so I had to "patch" the SDL_Event on the fly. I _think_ there must be a better way to do all this.
As for now, well, I got myself a version with 1.5x scaling:

(on a Nexus 4, larger version)

(on a Nexus 7, larger version)
Framerate seems okay, much better than when I've tried messing with the source the first time.

Offline sfalexrog

  • Captain
  • ***
  • Posts: 56
    • View Profile
Re: Android Port (SDL2)
« Reply #103 on: May 23, 2014, 09:11:26 pm »
Okay, looks like I've found the reason for the "OK button crash". Android sure doesn't like multiple windows. The fix is to create the window and the renderer separately, and to only destroy and recreate the renderer. The window is not going to get resized anyway (well, at least not on stock devices), so we just reuse it.
Sorry for no pull request, I'm new to all this github stuff and can't make heads or tails of it  :-[
Anyway, I think I should try and figure out what's up with the scaling the right way.

Offline sfalexrog

  • Captain
  • ***
  • Posts: 56
    • View Profile
Re: Android Port (SDL2)
« Reply #104 on: May 23, 2014, 11:35:42 pm »
Sorry for triple-posting, but I guess I should share this thing.

I've merged page's source with the current master (commit 962c78598d at the time of writing), "fixed" the screen resizing code (couldn't figure out how to make a pull request though), fiddled a bit with package names and got this: https://dl.dropboxusercontent.com/u/732324/openxcom-debug.apk
This apk is signed with a debug key, so I guess it won't run unless you have an option to run debuggable apps or something. Also it needs the latest data (unless you want to see some STR_ placeholders).

A few precautions:
 - I'm still building without smpeg2 and mikmod, so your mileage in terms of sound may vary. I probably should rebuild the package with them.
 - I've only built for armeabi-v7a, so some older devices are probably out of luck.
 - Since I can't say I always know what I'm doing, anything can happen, up to and including a chryssalid walking out of your android device and making zombies from your dog and your cat. You have been warned.