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

Offline jedikwon

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Re: Android Port (SDL2)
« Reply #120 on: June 16, 2014, 02:22:52 am »
Can someone tell how to do Right click? I cannot make a soldier to face different ways and cancel aiming. Back button on my Android tablet doesn't do anything.

Offline HunterZ

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Android Port (SDL2)
« Reply #121 on: June 16, 2014, 02:29:33 am »
Can someone tell how to do Right click? I cannot make a soldier to face different ways and cancel aiming. Back button on my Android tablet doesn't do anything.
Facing is accomplished by swiping on the soldier in the direction he/she should face. It's a bit tricky.

Canceling aiming mode can be done by tapping on the weapon icon again.

Offline HunterZ

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Android Port (SDL2)
« Reply #122 on: June 16, 2014, 03:00:03 am »


HunterZ, well, I hate to ruin the magic, but touchscreen support is somewhat barebones because it's mainly mouse emulation, and there's only so much you can do with it. I've noticed myself trying to drag-drop things on the inventory screen, so maybe I'll get down to implementing it some day :)
Makes sense, as I noticed it was a native app that uses SDL.

Maybe if you are able to hack only the inventory screen input logic to drive the mouse up/down status based on whether the user's finger is touching the screen?

Quote
Maybe I'll tune drag-turning a bit too, but that might start to interfere with map drag-scrolling.
Yeah, I don't have any ideas about how to make things better there, except maybe to do it via a virtual D-pad overlay or something.

Quote
As for Roland music, well, you can actually make some .OGGs and use them!
Unfortunately I only have a real MT-32, and the game takes advantage of additional CM-32 sounds. I could maybe try putting my SC-88 in CM-32 mode, but that would only work if the game doesn't try to program the synth with any custom instrument sound parameters.

For now I've installed OGGs of SC-55 soundfont recordings, which are a decent step up from AdLib.


Offline blahbluh

  • Squaddie
  • *
  • Posts: 1
    • View Profile
Re: Android Port (SDL2)
« Reply #123 on: June 16, 2014, 04:02:46 pm »
Thanks! Nice to know someone is actually using the android version  :)

Son, you're doing God's work. Your port was posted on www.reddit.com/r/androidgaming, so you're probably going to get a lot more feedback from now on. As soon as I get home, I'll install the apk on all my devices, I'll get back with I encounter any bugs.

Offline jedikwon

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Re: Android Port (SDL2)
« Reply #124 on: June 17, 2014, 07:53:15 am »
Facing is accomplished by swiping on the soldier in the direction he/she should face. It's a bit tricky.

Canceling aiming mode can be done by tapping on the weapon icon again.

Oh I see. Thank you. It is tricky as you say though. I wish I can use Android Back button as a right mouse button.

Offline HunterZ

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Android Port (SDL2)
« Reply #125 on: June 17, 2014, 08:47:55 am »
Oh I see. Thank you. It is tricky as you say though. I wish I can use Android Back button as a right mouse button.
Hey, that's not a bad idea since it would address both the facing and shooting issues, and I don't think the back button is currently used for anything else.

Offline vpraetor

  • Squaddie
  • *
  • Posts: 1
    • View Profile
Re: Android Port (SDL2)
« Reply #126 on: June 17, 2014, 03:43:45 pm »
Just registered to say thank you for working on it.

Offline HunterZ

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Android Port (SDL2)
« Reply #127 on: June 18, 2014, 05:48:06 am »
For some reason the MT-32 OGG soundtrack posted in the following thread sounds like static on Android OpenXcom 1.0: https://openxcom.org/forum/index.php?topic=2270.0

I'm not sure why this is happening, since the OGGs play fine on Android in a media player app, and the SC-55 soundtrack OGGs sound fine in game.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2165
    • View Profile
    • Email
Re: Android Port (SDL2)
« Reply #128 on: June 18, 2014, 06:59:56 am »
Mismatching sample rate settings maybe?

Offline HunterZ

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Android Port (SDL2)
« Reply #129 on: June 18, 2014, 07:13:21 am »
Mismatching sample rate settings maybe?
It's possible. It may also be that the MT-32 soundtrack is recorded at much higher sampling and bit rates. The working SC-55 OGG soundtrack is 44kHz 128kbps, while the MT-32 one is 48kHz 499kbps.

If it matters, Android port of OpenXcom defaults to 22kHz sound output, so it's probably downsampling both soundtracks on the fly unless the music doesn't go through the game's 22kHz audio mixer.

Offline sfalexrog

  • Captain
  • ***
  • Posts: 56
    • View Profile
    • Email
Re: Android Port (SDL2)
« Reply #130 on: June 18, 2014, 03:12:59 pm »
For some reason the MT-32 OGG soundtrack posted in the following thread sounds like static on Android OpenXcom 1.0: https://openxcom.org/forum/index.php?topic=2270.0

I'm not sure why this is happening, since the OGGs play fine on Android in a media player app, and the SC-55 soundtrack OGGs sound fine in game.

First off, by Gods that soundtrack is beautiful! I nearly fell in love with that sound.

Second, for what it's worth, I've tried downsampling the audio to 22050 Hz, which made it somewhat paler, but I've thrown the resulting files to Android and they worked. Not sure what's the problem with 48000 Hz version, but it might be android or SDL2_mixer screwing up some resampling. I'll admit that I didn't touch the sound code, nor did I look into any changes to it (if there were any). Maybe resampling to 44100 Hz will work better in terms of sound.

Offline kiksy

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Android Port (SDL2)
« Reply #131 on: June 19, 2014, 11:03:50 am »
Signed up to say thanks for this, no bugs so far. Installed the improved sounds mod and that seems fine too.

+1 for back button as right click.

Offline balbaroth

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Re: Android Port (SDL2)
« Reply #132 on: June 19, 2014, 05:53:19 pm »
Thanks for this marvelous xcom android port
i can now kill aliens at work ;)

I went thru the whole thread and i didnt saw anything that mention mod support

My question is about mod support : i was able to put mods that doesnt modify the .exe
but the best mod : Soldier diaries modify the game .exe

is there a way to build a apk that has that modified openxcom.exe so that wonderful mod work on android ? :)

Offline HunterZ

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Android Port (SDL2)
« Reply #133 on: June 20, 2014, 07:56:03 am »
I tried using the 44kHz SC-55 OGG soundtrack with the game's sampling rate set to various values, and found that it also had issues at any setting other than 22kHz. It seems that the OGG support of the Android version is very shaky.

Offline sfalexrog

  • Captain
  • ***
  • Posts: 56
    • View Profile
    • Email
Re: Android Port (SDL2)
« Reply #134 on: June 20, 2014, 12:46:02 pm »
I tried using the 44kHz SC-55 OGG soundtrack with the game's sampling rate set to various values, and found that it also had issues at any setting other than 22kHz. It seems that the OGG support of the Android version is very shaky.

The OGGs (and all other sounds, IIRC) are handled by SDL2_mixer, not by the game itself. Its support for Android may be flaky, but I can't really do much about that apart from updating the library once in a while.

My question is about mod support : i was able to put mods that doesnt modify the .exe
but the best mod : Soldier diaries modify the game .exe

is there a way to build a apk that has that modified openxcom.exe so that wonderful mod work on android ? :)

Well, that won't work with any binary mod, but since Shoes has opensourced his changes, I guess it's just a merge and a build away. The real trouble is that I don't really want to get too far away from the main source tree (there are already enough things that may and will break in the future), and I've screwed with the build process too much without documenting anything. I'll try to provide the build instructions and scripts "soon" (well, as soon as I make them anyway, I'm still doing some things by hand).

I wish I can use Android Back button as a right mouse button.

I see the appeal of the back button, but I'm not convinced. Back buttons, like many other Android things, are not as standard as you'd want: for example, I'm using a custom ROM with PIE controls (the ones that kinda "slide out" instead of always being on screen). The back button on these controls is not caught by the game, but instead screws up the game's window. Personally, I like the idea of "long tap to turn" much more. As for other things - doesn't the back button already cancel the current action? (yeah, I know I should know better, but hey, ROM screwing and all that  :) )