Coder Social home page Coder Social logo

pelya / commandergenius Goto Github PK

View Code? Open in Web Editor NEW

This project forked from albertz/commandergenius

533.0 83.0 248.0 560.36 MB

Port of SDL library and several games to the Android OS.

Home Page: http://libsdl-android.sourceforge.net/

License: GNU Lesser General Public License v2.1

Shell 0.33% Java 0.41% Python 17.21% Makefile 1.51% C 61.89% C++ 17.35% Assembly 0.42% HTML 0.46% Perl 0.04% Objective-C 0.13% E 0.01% CSS 0.01% CMake 0.05% R 0.01% Inno Setup 0.02% Logos 0.01% Batchfile 0.02% DIGITAL Command Language 0.01% Yacc 0.01% xBase 0.12%

commandergenius's Introduction

About
=====

This is SDL 1.2 ported to Google Android (also bunch of other libs included).
Sources or patches of the individual games are in the directory project/jni/application.
It can also build an official SDL2 Android port, with a few features on top.


Installation
============

Install latest Android SDK and NDK from http://developer.android.com/index.html
Add NDK to your PATH env variable - you should be able to run commands 'ndk-build'.
it is recommended to install OpenJDK and its development files.
On RPM based distros they are usually called java-x.x.x-openjdk and java-x.x.x-openjdk-devel.
On Debian or Ubuntu you install them like this: sudo apt-get install openjdk-8-jdk ant
The application will run on Android 4.1 and above, but will use features from Android 9 if available.
The most supported environment for this port is Linux, MacOs should be okay too.
If you're developing under Windows, you will need to install some Linux environment,
such as Bash shell on Windows 10, or Portable Ubuntu, then install Linux toolchain on it.
https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
https://sourceforge.net/projects/portableubuntu/
Cygwin is not supported by the NDK.


How to compile demo application
===============================

Launch commands

	git submodule update --init --recursive
	./build.sh ballfield

Or in separate steps

	rm project/jni/application/src
	ln -s ballfield project/jni/application/src
	./changeAppSettings.sh
	./build.sh

Then edit file build.sh if needed to add NDK dir to your PATH, then launch it.
It will compile a bunch of libs under project/libs/,
create Android package file project/bin/MainActivity-debug.apk,
and install it to your device or emulator, if you specify option -i or -r to build.sh.
Then you can test it by launching Ballfield icon from Android applications menu.

There are other applications inside project/jni/application directory,
some of them are referenced using Git submodule mechanism, you may download them using command
Some of them may be outdated and won't compile, some contain only patch file and no sources,
so you should check out Git logs before compiling a particular app, and checkout whole repo at that date:
gitk project/jni/application/<directory>

The game enforces horizontal screen orientation, you may slide-open your keyboard if you have it
and use it for additional keys - the device will just keep current screen orientation.
Recent Android phone models like HTC Evo have no keyboard at all, on-screen keyboard built into SDL
is available for such devices - it has joystick (which can be configured as arrow buttons or analog joystick),
and 6 configurable keys, full text input is toggled with 7-th key. Both user and application may redefine
button layout and returned keycodes, and also toggle full text input - see SDL_screenkeyboard.h.
Also you can read multitouch events and accelerometer events - they are passed as joystick events.

This port also supports GL ES + SDL combo - there is GLXGears demo app in project/jni/application/glxgears,
to compile it remove project/jni/application/src symlink and make new one pointing to glxgears, and run build.sh
Note that GL ES is NOT pure OpenGL - there are no glBegin() and glEnd() call and other widely used functions,
and generally it will take a lot of effort to port OpenGL application to GL ES.


SDL2
====

To use SDL2, specify LibSdlVersion=2 inside AndroidAppSettings.cfg.

SDL2 currently supports only these options from AndroidAppSettings.cfg:

	AppName
	AppFullName
	AppVersionCode
	AppVersionName
	AppDataDownloadUrl
	ResetSdlConfigForThisVersion
	DeleteFilesOnUpgrade
	MultiABI
	CompiledLibraries
	CustomBuildScript
	AppCflags
	AppCppflags
	AppLdflags
	AppOverlapsSystemHeaders
	AppSubdirsBuild
	AppBuildExclude
	AppCmdline

SDL2 does not support overlay screen buttons, you will need to draw and handle touch controls inside your own code.

Note that the library names for SDL2 are uppercase: SDL2 SDL2_image SDL2_mixer SDL2_ttf,
whereass for SDL 1.2 library names are lowercase: sdl-1.2 sdl_image sdl_mixer sdl_ttf.

Other libraries like Boost and OpenSSL are fully supported when SDL2 is used.

SDL2 will not show download/unzip progess to the user, you can use https:// links inside AppDataDownloadUrl,
but it will appear that the app is frozen on first start.

By default, SDL2 does not lock screen orientation and cha switch between portrait and landscape,
to lock screen orientation, call this code before calling SDL_CreateWindow():

	SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeRight LandscapeLeft");

SDL2 will generate additional mouse events for touchscreen and touch events for mouse, to disable this you need to call:

	SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
	SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");

SDL2 will not terminate the app process and will not unload shared libraries when your main() / SDL_main() function returns,
when the app is launched again your main() will be called twice without clearing global and static variables.
To prevent this, call exit() or _exit() instead of returning from main().

SDL2 by default does not allow internet access in the AndroidManifest.xml, to fix this copy the patch file
to your app directory and run changeAppSettings.sh:

	cp project/jni/application/supertux/project.diff cp project/jni/application/src/project.diff

SDL2 does not support notch or display cutout.
SDL_GetDisplayBounds() / SDL_GetDisplayUsableBounds() / SDL_GetDisplayMode() / SDL_GetCurrentDisplayMode()
will report the screen size including the cutout, however it's not possible to draw inside the cutout area,
so you should use the size returned by SDL_GetWindowSize() and by SDL_WINDOWEVENT_RESIZED event,
and you should use fullscreen window mode.

SDL2 does not support Back button. You will need to draw back or pause button inside your app code.


Licensing issues when using gradle
==================================

cd into android-sdk-linux/tools/bin and

	./sdkmanager --licenses

if that does not work you need to update

	./sdkmanager --update

Accept the license with 'y'. It might download additional stuff, yet not sure, why.

Retry with

	./sdkmanager --licenses

If the system tells you that the licenses were accepted, but the build system tells otherwise, it might be looking at the wrong path.
Symlinking the licenses directory might solve your problem:

	ln -s $ANDROID_HOME/licenses project

If every other method fails. launch Android Studio, import 'project' directory, and try to build it once.


How to compile your own application
===================================

You may find quick Android game porting manual at http://anddev.at.ua/src/porting_manual.txt

If you're porting existing app which uses SDL 1.2 please always use SW mode:
neither SDL_SetVideoMode() call nor SDL_CreateRGBSurface() etc functions shall contain SDL_HWSURFACE flags.
The BPP in SDL_SetVideoMode() shall be set to the same value you've specified in ChangeAppSettings.sh,
and audio format - to AUDIO_S8 or AUDIO_S16. Also bear in mind that 16-bit BPP is always faster than 24 or 32-bit,
even on good devices, because most GFX chips on Android do not have separate RAM, and use system RAM instead,
so with 16 bit color mode you'll get lesser memory copying operations.

The native Android 16-bit pixel format is RGB_565, even for OpenGL, not BGR_565 as all other OpenGL implementations have.

Colorkey surfaces and alpha surfaces are supported, SDL_RLEACCEL is not supported.

To compile your own app, put your app sources into project/jni/application dir (or create symlink to them),
and change symlink "src" to point to your app:

	cp -r /path/to/my/app project/jni/application/myapp
or
	ln -s /path/to/my/app project/jni/application/myapp
then
	rm project/jni/application/src
	ln -s myapp project/jni/application/src
(the second one should be relative link without slashes)

Also your main() function name should be redefined to SDL_main(), include SDL.h so it will be done automatically.

Then launch script ChangeAppSettings.sh - it will ask few questions and modify several file in the project -
there's no way around such external configure script, because Java does not support preprocessor,
and the Java code is a part of SDL lib, the application generally should not care about it.
You may take AndroidAppSettings.cfg file from some other application to get sane defaults,
you may launch ChangeAppSettings.sh with -a or -v parameter to skip questions altogether or to ask only version code.
The C++ files shall have .cpp extension to be compiled, rename them if necessary.
Also you have to create an icon image file at project/jni/application/src/icon.png, and you may create a file
project/jni/application/src/AndroidData/logo.png to be used as a splash screen image.
Then you may launch build.sh.

To compile C++ code, add "c++_shared" to CompiledLibraries inside AndroidAppSettings.cfg.

C++ RTTI and exceptions give very slight memory overhead, if you need them -
add "-frtti -fexceptions" to the AppCflags inside AndroidAppSettings.cfg
If you use autoconf/automake/configure scripts with setEnvironment.sh, you may write
env CXXFLAGS='-frtti -fexceptions' ../setEnvironment.sh ./configure

Application data may be bundled with app itself, or downloaded from the internet on the first run -
if you want to put app data inside .apk file - create a .zip archive and put it into the directory
project/jni/application/src/AndroidData (create it if it doesn't exist), then run ChangeAppSettings.sh
and specify the file name there. If the data files are more than 150 Mb then it's a good idea to put them
on public HTTP server - you may specify URL in AppDataDownloadUrl in AndroidAppSettings.cfg, also you may specify several files.
If you'll release new version of data files you should change download URL or data file name and update your app as well -
the app will re-download the data if URL does not match the saved URL from previous download.

AppDataDownloadUrl can have several URLs in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^..."
If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled.
If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped.
If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
these files are put inside .apk package by the build system.

Android app bundles do not support .obb files, they use asset packs instead.
This app project includes one pre-configured install-time asset pack.
To put your data into asset pack, copy it to the directory AndroidData/assetpack
and run changeAppSettings.sh. The asset pack zip archive path will be returned by
getenv("ANDROID_ASSET_PACK_PATH"), this call will return NULL if the asset pack is not installed.
You can put "assetpack" keyword to AppDataDownloadUrl, the code will check
if the asset pack is installed and will not download the data from other URLs.
You can extract files from the asset pack the same way you extract files from the app assets.

AppDataDownloadUrl="!!Game data|assetpack|https://yourserver.xyz/gamedata.zip"

All devices have different screen resolutions, you may toggle automatic screen resizing
in ChangeAppSettings.sh and draw to virtual 640x480 screen - it will be HW accelerated
and will not impact performance. Automatic screen resizing does not work in SDL 1.3/2.0.
SDL_GetVideoInfo() or SDL_ListModes(NULL, 0)[0] will always return native screen resolution.
Also make sure that your HW textures are not wider than 1024 pixels, or it will fail to allocate such
texture on HTC G1, and other low-end devices. Software surfaces may be of any size of course.

If you want HW acceleration - just use OpenGL, that's the easiest and most cross-platform way,
however if you'll use on-screen keyboard (even the text input button) the OpenGL state will get
messed up after each frame - after each SDL_GL_SwapBuffers() you'll need to restore following GL state:

glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, your_texture_id);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glEnable(GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_COLOR_ARRAY);

Previously I've got the code to save/restore OpenGL state, but it doens't work on every device -
you may wish to uncomment it inside file SDL_touchscreenkeyboard.c in functions beginDrawingTex() and endDrawingTex().

If you don't use on-screen keyboard you don't need to reinit OpenGL state - set following in AndroidAppSettings.cfg:
AppNeedsArrowKeys=n
AppNeedsTextInput=n
AppTouchscreenKeyboardKeysAmount=0

SDL 1.2 supports HW acceleration, however it has many limitations:
You should use 16-bit color depth.
You cannot blit SW surface to screen, it should be only HW surface.
You can use colorkey, per-surface alpha and per-pixel alpha with HW surfaces.
If you're using SDL 1.3 always use SDL_Texture, if you'll be using SDL_Surface or call SDL_SetVideoMode()
with SDL 1.3 it will automatically switch to SW mode.
Also the screen is always double-buffered, and after each SDL_Flip() there is garbage in pixel buffer,
so forget about dirty rects and partial screen updates - you have to re-render whole picture each frame.
Calling SDL_UpdateRects() just calls SDL_Flip() internally, updating the whole screen at once.
Single-buffer rendering might be possible with techniques like glFramebufferTexture2D(),
however it is not present on all devices, so I won't do that.
Basically your code should be like this for SDL 1.2 (also set SwVideoMode=n in AndroidAppSetings.cfg):

// ----- HW-accelerated video output for Android example
// Init HW-accelerated video
SDL_SetVideoMode( 640, 480, 16, SDL_DOUBLEBUF | SDL_HWSURFACE );

// Load graphics
SDL_Surface *sprite = IMG_Load( "sprite.png" );
SDL_Surface * hwSprite;

if( sprite->format->Amask )
{
	// Surface contains per-pixel alpha, convert it to HW-accelerated format
	hwSprite = SDL_DisplayFormatAlpha(sprite);
}
else
{
	// Set pink color as transparent
	SDL_SetColorKey( sprite, SDL_SRCCOLORKEY, SDL_MapRGB(sprite->format, 255, 0, 255) );
	// Create HW-accelerated surface
	hwSprite = SDL_DisplayFormat(sprite);
	// Set per-surface alpha, if necessary
	SDL_SetAlpha( hwSprite, SDL_SRCALPHA, 128 );
}

// Blit it in HW-accelerated way
SDL_BlitSurface(hwSprite, sourceRect, SDL_GetVideoSurface(), &targetRect);

// Render the resulting video frame to device screen
SDL_Flip(SDL_GetVideoSurface());

// Supported, but VERY slow (slower than blitting in SW mode)
SDL_BlitSurface(sprite, sourceRect, SDL_GetVideoSurface(), &targetRect);

// Supported, but VERY slow (use in cases where you need to take a screenshot)
SDL_BlitSurface(SDL_GetVideoSurface(), sourceRect, sprite, &targetRect);

// ----- End of example

To get HW acceleration in SDL 1.3/2.0 just follow the instructions on libsdl.org

If you'll add new libs - add them to project/jni/, copy Android.mk from existing lib, and
add libname to project/jni/<yourapp>/Android.mk
Also you'll need to move all include files to <libname>/include dir.
If lib contains "configure" script - go to lib dir and execute command "../launchConfigureLib.sh" - it will
launch "configure" with appropriate environment and will create the "config.h" file at least, though linking
will most probably fail because of ranlib - just edit Android.mk to compile lib sources and remove all tools and tests.

MIDI support can be emulated via SDL_mixer lib (it uses Timidity internally)- download file
http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz
unpack it and put "timidity" dir into your game data zipfile.
Or you may paste this URL directly as an optional download in ChangeAppSettings.sh:
MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download

SDL by default listens to the Volume Up and Volume Down hardware keys, and sends them to the application,
instead of changing volume. Most users expect those keys to actually change volume, instead of performing some in-game action.
To make SDL ignore those keys, and let the Android framework handle them instead, set
RedefinedKeys="XXX YYY NO_REMAP NO_REMAP ZZZ BBB CCC" inside AndroidAppSettings.cfg, that is,
the third and fourth keycode should be a special value "NO_REMAP" instead of SDL keycode.
XXX, YYY and ZZZ are placeholders for SDL keycodes of other hardware keys -
XXX is sent when user touches the screen and app is not using mouse or multitouch,
YYY is for DPAD_CENTER/SEARCH keys, ZZZ is for MENU key, BBB is for BACK key, CCC is for CAMERA key.

The ARM architecture has some limitations which you have to be aware about -
if you'll access integer that's not 4-byte aligned you'll get garbage instead of correct value,
and it's processor-model specific - it may work on some devices and do not work on another ones -
you may wish to check your code in Android 1.6 emulator from time to time to catch such bugs.

char * p = 0x13; // Non-4 byte aligned pointer
int i = (int *) p; // We have garbage inside i now
memcpy( &i, p, sizeof(int) ); // The correct way to dereference a non-aligned pointer

This compiler flags will catch most obvious errors, you may add them to AppCflags var in settings:
-Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress
Also beware of the NDK - some system headers contain the code that triggers that warnings.

SDL supports AdMob advertisements, you need to set your publisher ID inside AndroidAppSettings.cfg,
see project test-advertisements for details.
Also you can hide or reposition your ad from C code, check out file SDL_android.h for details.

SDL reports several joysticks, which are used to pass accelerometer and multitouch events.
On-screen joystick events are sent as SDL_JOYAXISMOTION in event.jaxis.jalue, scaled from -32767 to 32767,
with event.jaxis.which == 0 and event.jaxis.axis from 0 to 1, you will need to set AppUsesJoystick=y
in AndroidAppSettings.cfg and call SDL_JoystickOpen(0) in your code.
If you specify AppUsesSecondJoystick=y in AndroidAppSettings.cfg, there will be second on-screen joystick,
it will send events with event.jaxis.which == 0 and event.jaxis.axis from 2 to 3.
Multitouch events are sent as SDL_JOYBALLMOTION in event.jball.xrel and event.jball.yrel, scaled to screen size,
with event.jball.which == 0 and e.jball.ball from 0 to 15, you will need to set AppUsesMultitouch=y
in AndroidAppSettings.cfg and call SDL_JoystickOpen(0). SDL_JOYBUTTONDOWN and  SDL_JOYBUTTONUP events
are sent when the screen is touched or released, with e.jbutton.which == 0 and e.jbutton.button from 0 to 15.
Additionally, the touch pressure is sent as SDL_JOYAXISMOTION, scaled from 0 to 32767,
with event.jaxis.which == 0 and event.jaxis.axis from 4 to 19.
Accelerometer events are sent as SDL_JOYAXISMOTION, with event.jaxis.which == 1 and event.jaxis.axis from 0 to 1,
scaled from -32767 to 32767, denoting the device tilt angles from the horizontal.
Raw accelerometer events are sent with event.jaxis.axis from 5 to 7, with Earth gravity having a value 9800.
You will need to set AppUsesAccelerometer=y in AndroidAppSettings.cfg, and call SDL_JoystickOpen(1) in your code.
Gyroscope events are sent as SDL_JOYAXISMOTION, with event.jaxis.which == 1 and event.jaxis.axis from 2 to 4,
with value 32767 equal to 0.25 rad/s. Multiple events will be sent at once, if the device is rapidly rotated.
You will need to set AppUsesGyroscope=y in AndroidAppSettings.cfg to use it, and call SDL_JoystickOpen(1).
Gyroscope hardware is much more precise and less noisy than accelerometer, it is present on newer devices
starting from Galaxy S II, but older devices do no have it - it is emulated with accelerometer + compass.
SDL also supports gamepads - you can plug PS3/Xbox gamepad to almost any tablet, some devices have built-in gamepad.
Gamepad stick events are sent as SDL_JOYAXISMOTION, with event.jaxis.which from 2 to 5 and event.jaxis.axis from 0 to 3.
Gamepad analog L1/R1 buttons are sent as SDL_JOYAXISMOTION, with event.jaxis.which from 2 to 5 and event.jaxis.axis from 4 to 5.
The gamepad where any button was pressed becomes the first gamepad. Maximum 4 gamepads are supported.
Other gamepad buttons generate key events, which are taken from RedefinedKeysGamepad in AndroidAppSettings.cfg.


How to compile your own application using automake/configure scripts
====================================================================

There is limited support for "configure" scripts, I'm compiling scummvm and openttd this way,
though ./configure scripts tend to have stupid bugs in various places, and ranlib command never works.
You should enable custom build script in ChangeAppSettings.sh, and you should create script
AndroidBuild.sh and put it under project/jni/application/src dir. The AndroidBuild.sh script should
generate file project/jni/application/src/libapplication.so, which will be copied into .apk file by build system.
There is helper script project/jni/application/setEnvironment.sh which will set CFLAGS and LDFLAGS
for configure script and makefile, see AndroidBuild.sh in project/jni/application/scummvm dir for reference.


Signing your application
==========================================================

You can use scripts sign.sh and signBundle.sh to sign your app.
Set environment variables ANDROID_KEYSTORE_FILE and ANDROID_KEYSTORE_ALIAS
to your app signing certificate path and certificate alias,
and if you don't want the script asking you for a password, set variable
ANDROID_KEYSTORE_PASS_FILE to a file containing your certificate password.

If you are using app bundles, set envirnment variables
ANDROID_UPLOAD_KEYSTORE_FILE, ANDROID_UPLOAD_KEYSTORE_ALIAS, and ANDROID_UPLOAD_KEYSTORE_PASS_FILE
to your app bundle signing certificate in a similar way.


Android application sleep/resume support
========================================

Application may be put to background at any time, for example if user gets phone call onto the device.
The application will lose OpenGL context then, and has to re-create it when put to foreground.

The application is not allowed to do any GFX output without OpenGL context (or it will crash),
that's why SDL_Flip() call will block until we're re-acquired context.

The event SDL_ACTIVEEVENT with flag SDL_APPACTIVE will be sent when that happens,
also SDL_VIDEORESIZE event will be sent (the same behavior as in MacOsX SDL implementation).

If you're seeing black screen, and the video thread stucks, when your app is restored from background,
this may happen because you do not call SDL_Flip() when app is put to background.
If your app does not call SDL_Flip() at least once per second, you have to call it on SDL_APPACTIVE event.

If you're using OpenAL it will be paused automatically when your app goes to background.

If you're using pure SDL 1.2 API (with or without HW acceleration) you don't need to worry about anything -
the SDL itself will re-create GL textures and fill them with pixel data from existing SDL HW surfaces,
so you may leave the callbacks to defaults.

If you're using SDL 1.3 API and using SDL_Texture, then the textures pixeldata is lost - you will need
to call SDL_UpdateTexture() to refill texture pixeldata from appRestored() callback for all your textures.
If you're using compatibility API with SDL_Surfaces you don't have to worry about that.

If you're using SDL with OpenGL with either SDL 1.2 or SDL 1.3, the situation is even more grim -
not only all your GL textures are lost, but all GL matrices, blend modes, etc. has to be re-created.

OS may decide there's too little free RAM left on device, and kill background applications
without notice, so it vill be good to create temporary savegame etc. from appPutToBackground() callback.

Also it's a good practice to pause any application audio, especially if the user gets phone call,
and if you won't set your own callbacks the default callbacks will do exactly that.
There are circumstances when you want to avoid that, for example if the application is audio player,
or if application gets some notification over network (for example you're running a game server,
and want a beep when someone connects to you) - you may unpause audio for some short time,
that will require another thread to watch the network, because main thread will be blocked inside SDL_Flip().

The SDL provides function
SDL_ANDROID_SetApplicationPutToBackgroundCallback( callback_t appPutToBackground, callback_t appRestored );
where callback_t is function pointer of type "void (*) void".
The default callbacks will call another Android-specific functions:
SDL_ANDROID_PauseAudioPlayback() and SDL_ANDROID_ResumeAudioPlayback()
which will pause and resume audio from HW layer, so application does not need to destroy and re-init audio,
and in general you don't need to redefine those functions, unless you want to play audio in background.
The callbacks will be called from inside SDL_Flip().

The whole idea behind callbacks is that the existing application should not be modified to
operate correctly - the whole time in background will just look to app as one very long SDL_Flip(),
so it's good idea to implement some maximum time cap on game frame, so it won't process
the game to the end level 'till the app is in background, or calculate the difference in time
between appPutToBackground() and appRestored() and update game time variables.


Quick guide to debug native code
================================

You need compile your app with debug enabled to be able to debug native code:
	./build.sh debug
To debug your application - launch it, go to "project" dir and launch command
	ndk-gdb
then you can run usual GDB commands, like:
	cont - continue execution.
	info threads - list all threads, there will usually be like 11 of them with thread 10 being your main thread.
	bt - list stack trace / call hierarchy
	up / down - go up / down in the call hierarchy
	print var - print the value of variable "var"

You can also debug by adding extensive logs to your app:
	__android_log_print(ANDROID_LOG_INFO, "My App", "We somehow reached execution point #224");
and then watching "adb logcat" output.

Android does not print app stdout/stderr streams to logcat, so printf() will not work,
but you can redefine printf() and fprintf(stderr) in your app to write to Android log by adding this to AppCflags:
	-include jni/application/android_debug.h

If your application crashed, you should use following steps:

1. Gather the crash report from "adb logcat" - it should contain stack trace, if it does not then you're unlucky,

I/DEBUG   (   51): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   51): Build fingerprint: 'sprint/htc_supersonic/supersonic/supersonic:2.1-update1/ERE27/194487:userdebug/test-keys'
I/DEBUG   (   51): pid: 915, tid: 924  >>> de.schwardtnet.alienblaster <<<
I/DEBUG   (   51): signal 11 (SIGSEGV), fault addr deadbaad
I/DEBUG   (   51):  r0 00000000  r1 afe133f1  r2 00000027  r3 00000058
I/DEBUG   (   51):  r4 afe3ae08  r5 00000000  r6 00000000  r7 70477020
I/DEBUG   (   51):  r8 000000b0  r9 ffffff20  10 48552868  fp 00000234
I/DEBUG   (   51):  ip 00002ee4  sp 485527f8  lr deadbaad  pc afe10aac  cpsr 60000030
I/DEBUG   (   51):          #00  pc 00010aac  /system/lib/libc.so
I/DEBUG   (   51):          #01  pc 0000c00e  /system/lib/libc.so
I/DEBUG   (   51):          #02  pc 0000c0a4  /system/lib/libc.so
I/DEBUG   (   51):          #03  pc 0002ca00  /data/data/de.schwardtnet.alienblaster/lib/libsdl.so
I/DEBUG   (   51):          #04  pc 00028b6e  /data/data/de.schwardtnet.alienblaster/lib/libsdl.so
I/DEBUG   (   51):          #05  pc 0002d080  /data/data/de.schwardtnet.alienblaster/lib/libsdl.so

2. Go to project/bin/ndk/local/armeabi or armeabi-v7a dir, find there the library mentioned in stacktrace
(libsdl.so in our example), copy the address of the first line of stacktrace (0002ca00), and execute command

<your NDK path>/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb libsdl.so -ex "list *0x0002ca00" -ex "list *0x00028b6e" -ex "list *0x0002d080"

It will output the exact line in your source where the application crashed, and some stack trace if available.
You may also try to use ndk-stack script to do that for you.

If your application does not work for unknown reasons, there may be the case when it exports some symbol
that clash with exports from system libraries - run checkExports.sh to check this.
Also there are some symbols that are present in the NDK but are not on the device - run checkMissing.sh to check.

If your application fails to load past startup SDL logo with error

I/dalvikvm( 3401): Unable to dlopen(/data/data/com.svc/lib/libapplication.so): Cannot load library: alloc_mem_region[847]: OOPS:  1268 cannot map library 'libapplication.so'. no vspace available.

that means you're allocating huge data buffer in heap (that may be C static or global buffer variable) -
run checkStaticDataSize.sh to see the size of all static symbols inside your application,
heap memory limit on most phones is 24 Mb.

If the error string is like this:

I/dalvikvm(18105): Unable to dlopen(/data/data/net.olofson.kobodl/lib/libapplication.so): Cannot load library: link_image[1995]: failed to link libapplication.so

that means your application contains undefined symbols, absent in the system libraries,
you may check for all missing symbols by running script checkMissing.sh .
That typically happens because of linking to the dynamic libstdc++ which is not included into the .apk file -
specify "-lgnustl_static" in the linker flags to fix that.


License information
===================

The SDL 1.2 port is licensed under LGPL, so you may use it for commercial purposes
without releasing source code, however to fullfill LGPL requirements you'll have to publish
the file AndroidAppSettings.cfg to allow linking other version of libsdl-1.2.so with the libraries
in the binary package you're distributing - typically libapplication.so and other
closed-source libraries in your .apk file.

The SDL 1.3 port and Java source files are licensed under zlib license, which means
you may modify them as you like without releasing source code.

The libraries under project/jni have their own license, I've tried to compile all LGPL-ed libs
as shared libs but you should anyway inspect the licenses of the libraries you're linking to.
libmad and liblzo2 are licensed under GPL, so if you're planning to make commercial app you should avoid
using them, otherwise you'll have to release your whole application sources under GPL too.

The "Ultimate Droid" on-screen keyboard theme by Sean Stieber is licensed under Creative Commons - Attribution license.
The "Simple Theme" on-screen keyboard theme by Dmitry Matveev is licensed under zlib license.
The "Sun" on-screen keyboard theme by Sirea (Martina Smejkalova) is licensed under Creative Commons - Attribution license.
The "Keen" on-screen keyboard theme by Gerstrong (Gerhard Stein) is licensed under GPL 2.0.

commandergenius's People

Contributors

albertz avatar bob-the-hamster avatar cgisquet avatar gerstrong avatar gjtorikian avatar grumbel avatar gyf9835 avatar jahrome avatar jil8885 avatar krosk avatar licaon-kter avatar lubomyr avatar miguelhorta avatar nitomartinez avatar pelya avatar semphriss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commandergenius's Issues

Error when closing SDL_Video system

Every time when i exit the game, i have error:

I/libSDL  ( 6328): Calling VideoQuit()
E/libSDL  ( 6328): ERROR: Invalid window
E/libSDL  ( 6328): ERROR: Invalid texture
E/libSDL  ( 6328): ERROR: ANDROID_FreeHWSurface: cannot find freed HW surface in HwSurfaceList array

Any ideas?

Problems on video 'adreno 320'

I use 8bpp SDL_SWSURFACE | SDL_HWPALETTE video mode, and i have some problems with adreno 320: game hangs up on devices with this video.

Problem devices:

    Google
        Nexus 4– mako
        Nexus 10– manta
    HTC
        HTC One– m7
    Huawei
        MTC Viva– hwu8816
        HUAWEI U9508– hwu9508
    LGE
        LG-E615– m4ds
    Samsung
        Galaxy S 4– jflte
        Galaxy S4 LTE A– ks01lteskt
        Galaxy S4– jflteMetroPCS
        Galaxy S 4– jaltektt
    Sony Ericsson
        Xperia Z – SO-02E
        Xperia Z– C6603
        Xperia ZL– C6502
        Xperia Z– C6606
    Нет данных
        SGP321

Common cases:

Just downloaded last night. I have a stock Sprint HTC One. When the game starts up, it hangs as soon as I touch the screen. Cannot start a game even it that menu comes up.
Device: Samsung Galaxy s4 i9505.
Trouble: When open application on few moments see splashscreen. After only black screen and google advertisment top of screen. Advertisment work. Android think that application work. But no reaction on screen click.
I have galaxy s4. Game starts and then freezes with Westwood logo in background.

Been waiting for the whole dune series to end up on Android. Now it's here and it doesn't work. Very frustrating. I see many others complaining about the same thing.

I was hoping with this latest update it would be fixed. But it not.

Fails to start on a N7 w/ user profiles

I have a Nexus 7. I'm trying to run Xsdl in a second user profile, but I always receive the message: 'Error: X server failed to launch, because of stale Unix socket with non-existing path.'. Power cycling makes no difference.

I've attached the logs.

I suspect this is because there are hard-coded references to paths which aren't valid in a multiprofile system --- e.g. /data/data/x.org.server/files/usr/share/X11/xkb/rules/evdev; on my device it's at /data/user/10/x.org.server/files/usr/share/X11/xkb/rules/evdev.

I also notice that it's failing to create the Unix socket in /tmp/.X11-unix, because I don't have a /tmp; but don't all Android devices not have a /tmp?

I/libSDL (14085): Physical screen resolution is 1920x1200
I/SDL (14085): libSDL: setting envvar LANGUAGE to 'en_GB'
D/SDL (14085): libSDL: Is running on OUYA: false
I/libSDL (14085): moveMouseWithGyroscopeSpeed 2 = 5.000000
I/libSDL (14085): Changing curdir to "/storage/emulated/10/Android/data/x.org.server/files"
I/libSDL (14085): Calling SDL_main("XSDL")
I/libSDL (14085): param 0 = "XSDL"
I/XSDL (14085): Actual video resolution 1920/152x1200/86
I/XSDL (14085): User u10_a95 ID 1010095
I/XSDL (14085): Current video mode: 1920 1200
V/libSDL (14085): calling SDL_SetVideoMode(480, 320, 0, 0)
I/libSDL (14085): SDL_SetVideoMode(): application requested mode 480x320 OpenGL 0 HW 0 BPP 16
E/libSDL (14085): ERROR: Setting the swap interval is not supported
E/libSDL (14085): ERROR: Getting the swap interval is not supported
E/libSDL (14085): ERROR: GL_GetAttribute not supported
I/libSDL (14085): ANDROID_GL_GetProcAddress("glGetString"): 0x408ae864
V/libSDL (14085): SDL_SetVideoMode(): Requested mode: 480x320x16, obtained mode 480x320x16
V/libSDL (14085): SDL_SetVideoMode(): returning surface 0x758333e8
I/SDL (14085): Device: flo
I/SDL (14085): Device name: KTU84L
I/SDL (14085): Device model: Nexus 7
I/SDL (14085): Device board: flo
I/System.out(14085): libSDL: input device ID -1 type 769 name Virtual
I/System.out(14085): libSDL: input device ID 1 type 257 name gpio-keys
I/System.out(14085): libSDL: input device ID 2 type -2147483648 name apq8064-tabla-snd-card Headset Jack
I/System.out(14085): libSDL: input device ID 3 type 257 name apq8064-tabla-snd-card Button Jack
I/System.out(14085): libSDL: input device ID 4 type 257 name h2w button
I/System.out(14085): libSDL: input device ID 5 type -2147483648 name lid_input
I/System.out(14085): libSDL: input device ID 6 type 4098 name elan-touchscreen
I/SDL (14085): AutoDetectTouchInput: hoverTouchDistance 0.0 threshold 552 hover false fingerHover false
I/XSDL (14085): Screen coords 53 74 res 0
I/XSDL (14085): Screen coords 183 125 dpi 0
I/XSDL (14085): TCP port 6000 already used, trying next one: Address already in use
I/XSDL (14085): 2 network interfaces found
I/XSDL (14085): interface: lo address: 127.0.0.1
I/XSDL (14085): interface: wlan0 address: 192.168.148.60
I/XSDL (14085): XSDL video resolution 1920/152x1200/86x16, args:
I/XSDL (14085): > XSDL
I/XSDL (14085): > :1
I/XSDL (14085): > -nolock
I/XSDL (14085): > -noreset
I/XSDL (14085): > -screen
I/XSDL (14085): > 1920/152x1200/86x16
I/XSDL (14085): > -exec
I/XSDL (14085): > /data/user/10/x.org.server/files/usr/bin/xhost + ; /data/user/10/x.org.server/files/usr/bin/xli -onroot -center background.bmp
I/XSDL (14085): InitConnectionLimits: MaxClients = 255
I/XSDL (14085): InitCard: (null)
I/XSDL (14085): Calling SDL_Init()
I/XSDL (14085): _XSERVTrans
I/XSDL (14085): mkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
I/XSDL (14085): _XSERVTrans
I/XSDL (14085): mkdir: ERROR: Cannot create /tmp/.X11-unix
I/XSDL (14085): _XSERVTrans
I/XSDL (14085): SocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
I/XSDL (14085): _XSERVTrans
I/XSDL (14085): MakeAllCOTSServerListeners: failed to create listener for unix
I/XSDL (14085): (WW) Failed to open protocol names file /data/data/x.org.server/files/usr/lib/xorg/protocol.txt
I/XSDL (14085): sdlScreenInit
I/XSDL (14085): Attempting for 1920x1200/16bpp mode
V/libSDL (14085): calling SDL_SetVideoMode(1920, 1200, 16, 0)
I/libSDL (14085): SDL_SetVideoMode(): application requested mode 1920x1200 OpenGL 0 HW 0 BPP 16
E/libSDL (14085): ERROR: Setting the swap interval is not supported
E/libSDL (14085): ERROR: Getting the swap interval is not supported
E/libSDL (14085): ERROR: GL_GetAttribute not supported
I/libSDL (14085): ANDROID_GL_GetProcAddress("glGetString"): 0x408ae864
V/libSDL (14085): SDL_SetVideoMode(): Requested mode: 1920x1200x16, obtained mode 1920x1200x16
V/libSDL (14085): SDL_SetVideoMode(): returning surface 0x758333e8
I/XSDL (14085): Set 1920x1200/16bpp mode
I/XSDL (14085): sdlMapFramebuffer: shadow 0
I/XSDL (14085): sdlRandRInit
I/XSDL (14085): InitOutput()
I/XSDL (14085): sdlCreateRes
I/XSDL (14085): [dix] Could not init font path element /usr/share/fonts/X11/misc/, removing from list!
I/XSDL (14085): [dix] Could not init font path element /usr/share/fonts/X11/TTF/, removing from list!
I/XSDL (14085): [dix] Could not init font path element /usr/share/fonts/X11/OTF/, removing from list!
I/XSDL (14085): [dix] Could not init font path element /usr/share/fonts/X11/Type1/, removing from list!
I/XSDL (14085): [dix] Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
I/XSDL (14085): [dix] Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
I/XSDL (14085): (EE) XKB: Couldn't open rules file /data/data/x.org.server/files/usr/share/X11/xkb/rules/evdev
I/XSDL (14085): (EE) XKB: Failed to load keymap. Loading default keymap instead.
I/XSDL (14085): (EE) XKB: Couldn't open rules file /data/data/x.org.server/files/usr/share/X11/xkb/rules/evdev
I/XSDL (14085): XKB: Failed to compile keymap
I/XSDL (14085): Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
I/XSDL (14085):
I/XSDL (14085): Fatal server error:
I/XSDL (14085): Failed to activate core devices.
I/XSDL (14085):
I/XSDL (14085): (dix) removing device 2
I/XSDL (14085): (dix) removing device 3
I/XSDL (14085): Current video mode: 1920 1200
V/libSDL (14085): calling SDL_SetVideoMode(480, 320, 0, 0)
I/libSDL (14085): SDL_SetVideoMode(): application requested mode 480x320 OpenGL 0 HW 0 BPP 16
E/libSDL (14085): ERROR: Setting the swap interval is not supported
E/libSDL (14085): ERROR: Getting the swap interval is not supported
E/libSDL (14085): ERROR: GL_GetAttribute not supported
I/libSDL (14085): ANDROID_GL_GetProcAddress("glGetString"): 0x408ae864
V/libSDL (14085): SDL_SetVideoMode(): Requested mode: 480x320x16, obtained mode 480x320x16
V/libSDL (14085): SDL_SetVideoMode(): returning surface 0x758333e8

Trying to compile fheroes2

Is there a build script missing for the fheroes2 application? I downloaded the source code for fheroes2 and put it under project/jni/application/src/fheroes2 however when i run build.sh it does not seem to compile the project. Is it missing the AndroidBuild.sh or some other build file?

Blocking SDL_Flip() + Accelerometer control => deadlock

Having some free time again (after several months ...), I adapted the enigma UI for smartphone controls and got the Pause/Resume functionality working. Howewer there is a deadlock if the accelerometer is initialized, the blocking SDL_Flip() behaviour is used and the App ist being paused. In this case, the nativeAccelerometer() call blocks, locking up the whole App.

I did not want to check in changes to the main java source tree after this period of time, but the fix itself is simple - just destroy the accelerometer listener in onPause() and re-initialize it in onResume().

-- Michi

Patch to complete support for any GCC version

This patch completes the partial support for any GCC version

From 98823390351f6a7f58605a26c9114b7e260af358 Mon Sep 17 00:00:00 2001
From: Alex Wulms <[email protected]>
Date: Sun, 5 Oct 2014 15:54:47 +0200
Subject: [PATCH] Support GCCVER parameter in all scripts so that projects can
 be build with any GCC version

---
 build.sh                                  | 13 ++++++++-----
 project/jni/application/setEnvironment.sh |  2 +-
 project/jni/setCrossEnvironment.sh        |  2 +-
 readme.txt                                | 10 ++++++++++
 4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/build.sh b/build.sh
index 2fd7da1..cc7854d 100755
--- a/build.sh
+++ b/build.sh
@@ -54,6 +54,9 @@ fi
        android update project -p project || exit 1
        rm -f project/src/Globals.java
 }
+
+[ -z "$GCCVER" ] && GCCVER=4.6
+
 # Set here your own NDK path if needed
 # export PATH=$PATH:~/src/endless_space/android-ndk-r7
 NDKBUILDPATH=$PATH
@@ -98,7 +101,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
                rm obj/local/armeabi/libapplication.so && \
                cp jni/application/src/libapplication-armeabi.so obj/local/armeabi/libapplication.so && \
                cp jni/application/src/libapplication-armeabi.so libs/armeabi/libapplication.so && \
-               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
+               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${GCCVER}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
                || true ; } && \
        {       grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
                grep "MultiABI=" ../AndroidAppSettings.cfg | grep "y\\|all\\|armeabi-v7a" > /dev/null && \
@@ -106,7 +109,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
                rm obj/local/armeabi-v7a/libapplication.so && \
                cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
                cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
-               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
+               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${GCCVER}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
                || true ; } && \
         {       grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
                grep "MultiABI=" ../AndroidAppSettings.cfg | grep "armeabi-v7a-hard" > /dev/null && \
@@ -114,7 +117,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
                rm obj/local/armeabi-v7a-hard/libapplication.so && \
                cp jni/application/src/libapplication-armeabi-v7a-hard.so obj/local/armeabi-v7a-hard/libapplication.so && \
                cp jni/application/src/libapplication-armeabi-v7a-hard.so libs/armeabi-v7a/libapplication.so && \
-               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
+               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${GCCVER}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
                || true ; } && \
        {       grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
                grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips" > /dev/null && \
@@ -122,7 +125,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
                rm obj/local/mips/libapplication.so && \
                cp jni/application/src/libapplication-mips.so obj/local/mips/libapplication.so && \
                cp jni/application/src/libapplication-mips.so libs/mips/libapplication.so && \
-               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-4.6/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so \
+               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-${GCCVER}/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so \
                || true ; } && \
        {       grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
                grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86" > /dev/null && \
@@ -130,7 +133,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
                rm obj/local/x86/libapplication.so && \
                cp jni/application/src/libapplication-x86.so obj/local/x86/libapplication.so && \
                cp jni/application/src/libapplication-x86.so libs/x86/libapplication.so && \
-               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86-4.6/prebuilt/$MYARCH/bin/i686-linux-android-strip --strip-unneeded libs/x86/libapplication.so \
+               `which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86-${GCCVER}/prebuilt/$MYARCH/bin/i686-linux-android-strip --strip-unneeded libs/x86/libapplication.so \
                || true ; } && \
        cd .. && ./copyAssets.sh && cd project && \
        {       if $build_release ; then \
diff --git a/project/jni/application/setEnvironment.sh b/project/jni/application/setEnvironment.sh
index a2e8ddc..233f6c9 100755
--- a/project/jni/application/setEnvironment.sh
+++ b/project/jni/application/setEnvironment.sh
@@ -22,7 +22,7 @@ grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"

 #echo NDK $NDK
 GCCPREFIX=arm-linux-androideabi
-GCCVER=4.6
+[ -z "$GCCVER" ] && GCCVER=4.6
 PLATFORMVER=android-14
 LOCAL_PATH=`dirname $0`
 if which realpath > /dev/null ; then
diff --git a/project/jni/setCrossEnvironment.sh b/project/jni/setCrossEnvironment.sh
index c779fd9..1d43dc5 100755
--- a/project/jni/setCrossEnvironment.sh
+++ b/project/jni/setCrossEnvironment.sh
@@ -20,7 +20,7 @@ NDK=`readlink -f $NDK`

 #echo NDK $NDK
 GCCPREFIX=arm-linux-androideabi
-GCCVER=4.6
+[ -z "$GCCVER" ] && GCCVER=4.6
 PLATFORMVER=android-8
 LOCAL_PATH=`dirname $0`
 if which realpath > /dev/null ; then
diff --git a/readme.txt b/readme.txt
index cddd184..29d355d 100644
--- a/readme.txt
+++ b/readme.txt
@@ -279,6 +279,16 @@ There is helper script project/jni/application/setEnvironment.sh which will set
 for configure script and makefile, see AndroidBuild.sh in project/jni/application/scummvm dir for reference.


+How to compile your own application using GCC 4.7 or newer
+==========================================================
+
+By default, your application will be build with GCC 4.6. To use a newer version of GCC, e.g. GCC 4.8, set-up
+your project like described but execute following commands before running any of the commandergenius scripts
+to configure or build your project:
+export GCCVER=4.8
+export NDK_TOOLCHAIN_VERSION=${GCCVER}
+
+
 Android application sleep/resume support
 ========================================

-- 
1.8.4.5

unicodestuff.h missing in SDL 1.3

I tried to compile a game using SDL 1.3, but it complained that it couldn't find unicodestuff.h:

jni/../jni/sdl-1.3/src/video/android/SDL_androidinput.c:45:26: fatal error: unicodestuff.h: No such file or directory

Ported SDL app runtime problems

Hi

I ported an SDL game into an app using commandergenius. the build is successful, I have a signed app MainActivity-debug.apk and able to install it into the Andriod emulator.

In the emulator the app launches with a splash screen, data.zip is loaded then it fails.

This is the output from the emulator shell, logcat:

(Other information about the ported application, build, resources and emulator follow this logcat output)

I/SDL     ( 1269): libSDL: Creating startup screen
I/Choreographer(  662): Skipped 166 frames!  The application may be doing too much work on its main thread.
I/SDL     ( 1269): libSDL: onWindowFocusChanged: true - sending onPause/onResume
I/SDL     ( 1269): libSDL: Loading libraries
I/SDL     ( 1269): libSDL: loaded GLESv2 lib
I/SDL     ( 1269): libSDL: loading lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_native_helpers.so
D/dalvikvm( 1269): Trying to load lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_native_helpers.so 0xb2d186e0
D/dalvikvm( 1269): Added shared lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_native_helpers.so 0xb2d186e0
D/dalvikvm( 1269): No JNI_OnLoad found in /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_native_helpers.so 0xb2d186e0, skipping init
I/SDL     ( 1269): libSDL: loading lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl-1.2.so
D/dalvikvm( 1269): Trying to load lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl-1.2.so 0xb2d186e0
D/dalvikvm( 1269): Added shared lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl-1.2.so 0xb2d186e0
I/SDL     ( 1269): libSDL: loading lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_mixer.so
D/dalvikvm( 1269): Trying to load lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_mixer.so 0xb2d186e0
D/gralloc_goldfish( 1269): Emulator without GPU emulation detected.
D/dalvikvm( 1269): Added shared lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_mixer.so 0xb2d186e0
D/dalvikvm( 1269): No JNI_OnLoad found in /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_mixer.so 0xb2d186e0, skipping init
I/SDL     ( 1269): libSDL: loading lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_image.so
D/dalvikvm( 1269): Trying to load lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_image.so 0xb2d186e0
D/dalvikvm( 1269): Added shared lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_image.so 0xb2d186e0
D/dalvikvm( 1269): No JNI_OnLoad found in /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_image.so 0xb2d186e0, skipping init
I/SDL     ( 1269): libSDL: Trying to extract binaries from assets binaries-armeabi-v7a.zip
I/SDL     ( 1269): libSDL: Trying to extract binaries from assets binaries-armeabi.zip
I/SDL     ( 1269): libSDL: Trying to extract binaries from assets binaries.zip
I/SDL     ( 1269): libSDL: Loading settings
I/SDL     ( 1269): libSDL: Settings.Load(): enter
I/ActivityManager(  372): Displayed uk.co.interlinux.dsi/.MainActivity: +1s796ms (total +2s146ms)
D/dalvikvm( 1269): GC_CONCURRENT freed 288K, 11% free 2887K/3240K, paused 4ms+4ms, total 101ms
I/SDL     ( 1269): android.os.Build.MODEL: sdk
I/SDL     ( 1269): libSDL: We don't have permission to write to SD card, switching to the internal storage.
I/SDL     ( 1269): libSDL: Settings.Load(): loading settings failed, running config dialog
I/SDL     ( 1269): Device RAM size: 501 Mb, required minimum RAM: 50 Mb
I/SDL     ( 1269): libSDL: Starting data downloader
I/SDL     ( 1269): libSDL: Starting downloader
I/SDL     ( 1269): Downloading data to: '/data/data/uk.co.interlinux.dsi/files'
I/SDL     ( 1269): libSDL: loading lib /data/data/uk.co.interlinux.dsi/files/../lib/libapplication.so
D/dalvikvm( 1269): Trying to load lib /data/data/uk.co.interlinux.dsi/files/../lib/libapplication.so 0xb2d186e0
D/dalvikvm( 1269): Added shared lib /data/data/uk.co.interlinux.dsi/files/../lib/libapplication.so 0xb2d186e0
D/dalvikvm( 1269): No JNI_OnLoad found in /data/data/uk.co.interlinux.dsi/files/../lib/libapplication.so 0xb2d186e0, skipping init
I/SDL     ( 1269): libSDL: loading lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_main.so
D/dalvikvm( 1269): Trying to load lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_main.so 0xb2d186e0
D/dalvikvm( 1269): Added shared lib /data/data/uk.co.interlinux.dsi/files/../lib/libsdl_main.so 0xb2d186e0
I/SDL     ( 1269): Processing download data.zip
I/Choreographer( 1269): Skipped 30 frames!  The application may be doing too much work on its main thread.
I/SDL     ( 1269): Fetching file from assets: data.zip
I/SDL     ( 1269): Reading from zip file 'data.zip'
I/SDL     ( 1269): Reading from zip file 'data.zip' entry 'data/'
I/SDL     ( 1269): Creating dir '/data/data/uk.co.interlinux.dsi/files/data/'

...
... more data continued ...
...

I/SDL     ( 1269): Saving file '/data/data/uk.co.interlinux.dsi/files/data/score.gif'
I/SDL     ( 1269): Saving file '/data/data/uk.co.interlinux.dsi/files/data/score.gif' done
I/SDL     ( 1269): Reading from zip file 'data.zip' finished
I/SDL     ( 1269): libSDL: Initializing video and SDL application
V/SDL     ( 1269): GLSurfaceView_SDL::onWindowResize(): 480x800
V/SDL     ( 1269): GLSurfaceView_SDL::EglHelper::start(): creating GL context
V/SDL     ( 1269): Desired GL config: R5G6B5A0 depth 0 stencil 0 type GLES
V/SDL     ( 1269): GL config 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 4 (0,0,0,0,0)
V/SDL     ( 1269): GL config 1: R5G6B5A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5 (0,0,1,1,1)
V/SDL     ( 1269): GL config 2: R8G8B8A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 12 (8,8,8,8,8)
V/SDL     ( 1269): GL config 3: R8G8B8A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 13 (8,8,9,9,9)
V/SDL     ( 1269): GL config 4: R8G8B8A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 13 (8,9,9,9,9)
V/SDL     ( 1269): GL config 5: R8G8B8A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 14 (8,9,10,10,10)
V/SDL     ( 1269): GL config 6: R0G0B0A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 21 (16,17,17,17,17)
V/SDL     ( 1269): GL config 7: R0G0B0A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 22 (16,17,18,18,18)
V/SDL     ( 1269): GLSurfaceView_SDL::EGLConfigChooser::chooseConfig(): selected 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 4 (0,0,0,0,0)
V/SDL     ( 1269): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
I/SDL     ( 1269): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/SDL     ( 1269): libSDL: DemoRenderer.onSurfaceChanged(): paused false mFirstTimeStart false w 480 h 800
I/libSDL  ( 1269): Physical screen resolution is 480x800
I/SDL     ( 1269): libSDL: setting envvar LANGUAGE to 'en_US'
D/SDL     ( 1269): libSDL: Is running on OUYA: false
D/dalvikvm( 1269): GC_CONCURRENT freed 339K, 12% free 3033K/3444K, paused 25ms+2ms, total 133ms
D/dalvikvm( 1269): WAIT_FOR_CONCURRENT_GC blocked 108ms
I/dalvikvm-heap( 1269): Grow heap (frag case) to 8.023MB for 5242896-byte allocation
D/dalvikvm( 1269): GC_FOR_ALLOC freed <1K, 5% free 8153K/8568K, paused 53ms, total 54ms
I/libSDL  ( 1269): Changing curdir to "/data/data/uk.co.interlinux.dsi/files"
I/libSDL  ( 1269): Calling SDL_main("sdl")
I/libSDL  ( 1269): param 0 = "sdl"
I/libSDL  ( 1269): Application closed, calling exit(0)
I/WindowState(  372): WIN DEATH: Window{b33b3bf0 u0 SurfaceView}
I/ActivityManager(  372): Process uk.co.interlinux.dsi (pid 1269) has died.
W/ActivityManager(  372): Force removing ActivityRecord{b2f8b038 u0 uk.co.interlinux.dsi/.MainActivity t7}: app died, no saved state
W/InputDispatcher(  372): channel 'b33e0a10 uk.co.interlinux.dsi/uk.co.interlinux.dsi.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
E/InputDispatcher(  372): channel 'b33e0a10 uk.co.interlinux.dsi/uk.co.interlinux.dsi.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher(  372): Attempted to unregister already unregistered input channel 'b33e0a10 uk.co.interlinux.dsi/uk.co.interlinux.dsi.MainActivity (server)'
I/WindowState(  372): WIN DEATH: Window{b33e0a10 u0 uk.co.interlinux.dsi/uk.co.interlinux.dsi.MainActivity}

Other information about the ported application, build, resources and emulator:

Emulator:

Android 4.4.2 is a basic Android platform.
ARM (armeabi-v7a) processor,
with the following hardware config:
hw.lcd.density=240
hw.ramSize=512
hw.sdCard=yes
vm.heapSize=48

Build:

  • ndk - android-ndk-r8c
  • sdk - android-sdk_r21-linux
  • Ubuntu 12.04.4 LTS
  • Java installed from apt-get repos
    java version "1.6.0_31"
    OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1ubuntu1~0.12.04.2)
    OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
  • Ant installed from apt-get repos
    Apache Ant(TM) version 1.8.2 compiled on December 3 2011

Environment variables:

PATH=/home/myuserid/andriod-dev/ndk/android-ndk-r8c:/home/myuserid/andriod-dev/sdk/android-sdk-linux/tools/

  • AndroidAppSettings.cfg
AppName="dsi"
AppFullName=uk.co.interlinux.dsi
AppVersionCode=100002
AppVersionName="1.00.07.01"
'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
AppDataDownloadUrl="!DSI Data Files|data.zip"
ResetSdlConfigForThisVersion=y
DeleteFilesOnUpgrade="y"
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
LibSdlVersion=1.2
ScreenOrientation=p
VideoDepthBpp=16
NeedDepthBuffer=n
NeedStencilBuffer=n
NeedGles2=n
SwVideoMode=y
SdlVideoResize=y
SdlVideoResizeKeepAspect=n
InhibitSuspend=y
CreateService=n
CompatibilityHacks=y
CompatibilityHacksStaticInit=n
CompatibilityHacksTextInputEmulatesHwKeyboard=n
CompatibilityHacksPreventAudioChopping=n
CompatibilityHacksAppIgnoresAudioBufferSize=n
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
CompatibilityHacksSlowCompatibleEventQueue=n
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n
CompatibilityHacksProperUsageOfSDL_UpdateRects=n
AppUsesMouse=n
AppNeedsTwoButtonMouse=n
RightMouseButtonLongPress=n
ShowMouseCursor=n
GenerateSubframeTouchEvents=n
ForceRelativeMouseMode=n
AppNeedsArrowKeys=y
AppNeedsTextInput=y
AppUsesJoystick=y
AppUsesSecondJoystick=n
AppUsesThirdJoystick=n
AppUsesAccelerometer=y
AppUsesGyroscope=n
MoveMouseWithGyroscope=n
AppUsesMultitouch=n
AppRecordsAudio=n
AccessSdCard=n
AccessInternet=n
ImmersiveMode=n
NonBlockingSwapBuffers=n
RedefinedKeys="SPACE RETURN PLUS MINUS TAB ESCAPE DELETE"
AppTouchscreenKeyboardKeysAmount=0
RedefinedKeysScreenKb="SPACE RETURN PLUS MINUS TAB ESCAPE DELETE"
RedefinedKeysScreenKbNames="SPACE RETURN PLUS MINUS TAB ESCAPE DELETE"
TouchscreenKeysTheme=0
RedefinedKeysGamepad="SPACE RETURN PLUS MINUS TAB ESCAPE DELETE"
StartupMenuButtonTimeout=0
HiddenMenuOptions=''
FirstStartMenuOptions=''
MultiABI='n'
AppMinimumRAM=50
CompiledLibraries="sdl_mixer sdl_image"
CustomBuildScript=y
AppCflags=''
AppLdflags=''
AppOverlapsSystemHeaders=
AppSubdirsBuild=''
AppBuildExclude=''
AppCmdline=''
MinimumScreenSize=s
AdmobPublisherId=n
AdmobTestDeviceId=
AdmobBannerSize=
  • AndroidBuild.sh
#!/bin/sh
LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
ln -sf libsdl-1.2.so $LOCAL_PATH/../../../obj/local/armeabi/libSDL.so
if [ \! -f dsi/configure ] ; then
    sh -c "cd dsi && ./autogen.sh"
    sh -c "./autogen.sh"
fi
if [ \! -f dsi/Makefile ] ; then
    ../setEnvironment.sh sh -c "cd dsi && ./configure --host=arm-linux-androideabi"
fi
make -C dsi && mv -f dsi libapplication.so

--- end ---

Application structure

Main src folder

../src/dsi

Data folder

../src/data

data.zip created in ../src using zip -r': zip -r data data/

ls AndroidData/
data.zip logo.png

Makefile.am

INCLUDES = -I$(top_srcdir) -I$(srcdir)
bin_PROGRAMS = DSI
#DSI_CFLAGS = -DDSI_DIR=\"$(DESTDIR)$(pkgdatadir)\" \
#  -DDSI_DATA_DIR=\"$(DESTDIR)$(pkgdatadir)/data\" \
#  -DDSI_SCORE_DIR=\"$(DESTDIR)$(localstatedir)/lib/games/dsi\" \
#  -DDSI_PIXMAP_DIR=\"$(DESTDIR)$(datadir)/pixmaps\"
DSI_CFLAGS = -DDSI_DIR=\"$(DESTDIR)\" \
  -DDSI_DATA_DIR=\"$(DESTDIR)data\" \
  -DDSI_SCORE_DIR=\"$(DESTDIR)/lib/games/dsi\" \
  -DDSI_PIXMAP_DIR=\"$(DESTDIR)/pixmaps\"
DSI_SOURCES = main.c rcfile.c sprite.c aliens.c intro.c rungame.c \
  data.c hi_score.c final_score.c sound.c bombs.c  shots.c level.c \
  player.c
DSI_LDADD = -lSDL_mixer -lSDL_image
noinst_HEADERS = *.h

--- end ---

main.c

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>

#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_image.h>

#include "config.h"
#include "sound.h"
#include "structs.h"
#include "data.h"
#include "hi_score.h"
#include "final_score.h"
#include "sprite.h"
#include "rungame.h"
#include "intro.h"
#include "rcfile.h"

SDL_Surface *screen;
SDL_Surface *background;

int fullscreen;
char *rcfile;

static void _usage(void)
{
    printf("Usage:\n  %s [Option...]\n\n", PACKAGE_NAME);
    printf("  -?      \tshow this message\n");
    printf("  -v      \tprint version number\n");
    printf("  -f      \tfullscreen\n");
    printf("  -m    m \tbuiltin MOD music\n");
    printf("        w \tbuiltin WAV music\n");
    printf("        n \tno music\n");
    printf("  -t   <file>\tplay music file\n\n");
}

static int _get_rc_prefs(void)
{
    FILE *f = NULL;
    char *arg;

    rcfile = dsi_rc_init("dsirc", 1);
    if (rcfile == NULL)
        return 0;
    if ((f = dsi_open_prefs(rcfile, "[dsi-prefs]")) == NULL)
        return 0;

    if ((arg = dsi_get_tag_arg(f, "fullscreen")) != NULL)
    {
        int i = atoi(arg);
        if (i == 1 || i == 0)
            fullscreen = i;
    }
    if ((arg = dsi_get_tag_arg(f, "track-mode")) != NULL)
    {
        if (0 == strcmp(arg, "m"))
            music_decoder = MPLAY_MOD;
        else if (0 == strcmp(arg, "w"))
            music_decoder = MPLAY_WAV;
        else if (0 == strcmp(arg, "n"))
            music_decoder = MPLAY_NONE;
    }
    if ((arg = dsi_get_tag_arg(f, "track-file")) != NULL)
    {
        if (*arg) {
            music_file = malloc(strlen(arg)+1);
            if (music_file)
            {
                strcpy(music_file, arg);
                music_decoder = MPLAY_FILE;
            }
        }
    }
    fclose(f);
    return 1;
}

static int _init_all(void)
{
    int tally;

    if ((background = LoadImage(DATAFILE("background.gif"), 0)) == NULL)
        return -1;
    if ((tally = rungame_init()) < 0)
        return -1;
    if (sprite_init(tally) < 0)
        return -1;

    if (sound_init() < 0)
        return -1;
    if (intro_init() < 0)
        return -1;
    if (hi_score_init() < 0)
        return -1;
    if (final_score_init() < 0)
        return -1;
    return 1;
}

static void _free_all(void)
{
    rungame_free();
    sprite_free();
    intro_free();
    hi_score_free();
    final_score_free();
    sound_free();
    SDL_FreeSurface(background);
    free(music_file);
}

int main(int argc, char *argv[])
{
    int leave = 0, CarryScore = 0;
    int opt;
    music_decoder = MPLAY_WAV;
    music_file = NULL;
    SDL_Surface *image = NULL;
    SDL_Joystick *joy = NULL;

    //rcfile overrides defaults
    _get_rc_prefs();

    //Command line overrides rcfile
    while ((opt = getopt(argc, argv, "fv?m:t:")) != -1) {
        switch (opt) {
        case 'f':
            fullscreen = 1;
            break;
        case 'm':
            if (0 == strcmp(optarg, "m"))
                music_decoder = MPLAY_MOD;
            else if (0 == strcmp(optarg, "w"))
                music_decoder = MPLAY_WAV;
            else if (0 == strcmp(optarg, "n"))
                music_decoder = MPLAY_NONE;
            else
            {
            printf("%s invalid option to -m   '%s'\n",
                    PACKAGE_NAME, optarg);
                _usage();
                return 0;
            }
            break;
        case 't':
            strncpy(music_file, optarg, PATH_MAX);
            music_file[PATH_MAX -1] = '\0';
            music_decoder = MPLAY_FILE;
            break;
        case 'v':
            printf("%s version is %s\n",
                    PACKAGE_NAME, PACKAGE_VERSION);
            return 0;
        default: /* '?' */
            _usage();
            return 0;
        }
    }

    //Initialize the SDL library
    if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 )
    {
        fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
        exit(2);
    }

    //Open the audio device
    if ( Mix_OpenAudio(11025, AUDIO_U8, 1, 512) < 0 )
    {
        fprintf(stderr,
        "Warning: Couldn't set 11025 Hz 8-bit audio\n- Reason: %s\n",
                            SDL_GetError());
    }
// seems to be a compile problem with GetNumMusicDecoders and getMusicDecoder
//  else
//  {
//      //Detect music decoders
//      int i, n;
//      n = Mix_GetNumMusicDecoders();
//      for (i = 0; i < n; ++i)
//      {
//          if (0 == strcmp(Mix_GetMusicDecoder(i), "MIKMOD"));
//              music_decoder = MPLAY_MOD;
//      }
//  }
    //Open the display device (if fullscreen -f flag selected
    //at command line)
    //Open the joy stick
#ifdef __LINUX__
    if (SDL_NumJoysticks())
        joy=SDL_JoystickOpen(0);
#endif
    if(fullscreen == 1)
    {
        screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_FULLSCREEN);
        if ( screen == NULL )
        {
            fprintf(stderr, "Couldn't set 640x480 video mode: %s\n",
                                SDL_GetError());
            exit(2);
        }
    }else
    {
#ifdef __LINUX__
        image = IMG_Load(DSI_PIXMAP_DIR "/alien.png");
#else
        image = SDL_LoadBMP("/Alien.ICO");
#endif
        if (image)
            SDL_WM_SetIcon(image, NULL);
        screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE);
        if ( screen == NULL )
        {
            fprintf(stderr, "Couldn't set 640x480 video mode: %s\n",
                                SDL_GetError());
            exit(2);
        }
        SDL_WM_SetCaption("DSI Space Invaders", "DSI");
    }

    //Initialize the random number generator
    srand(time(NULL));

    //Load the artwork
    if (_init_all() > 0)
    {
        while (leave != RUN_QUIT)
        {
            if (leave == RUN_INTRO)
            {
                leave = intro_run();
            }
            if (leave == RUN_GAME)
            {
                CarryScore = 0;
                leave = RunGame(&CarryScore);
            }
            if (leave == RUN_FINAL)
            {
                leave = final_score_view(CarryScore);
            }
            //if 'v' for view score is pressed in intro and after game
            if (leave == RUN_SCORE)
            {
                leave = hi_score_view();
            }
        }
        //Free the artwork
        _free_all();
    }
    if(joy)
        SDL_JoystickClose(joy);
    Mix_CloseAudio();
    SDL_Quit();
    return 0;
}

I have used these online resources:

http://anddev.at.ua/src/porting_manual.txt

I also attempted this in a different project directory, the demo, alien.c did not run.

I'll try things and run changes as people might think necessary and report back.

This is the project I'm porting: https://sourceforge.net/projects/dspaceinvadors/

I am the lead developer, see REAME

https://sourceforge.net/p/dspaceinvadors/code/HEAD/tree/

Thank you.
Damian

SDL resets when native Android display resolution changes

Hello,

As described in issue 3 of XServer XSDL, the SDL app resets itself whenever the native Android display resolution changes.

For example, when I connect my Android device to my computer monitor via HDMI, I increase Android's native display resolution to 1920x1080 using these Android shell commands:

wm resize 1920x1080
wm density 160

This causes any existing SDL apps to reset themselves (I am shown the initial SDL logo screen again --- with the "Change device configuration" button at the top of the screen) and thus lose their state/progress.

Please make SDL resilient to native Android resolution changes so that I don't lose state/progress in my SDL apps (XServer XSDL, OpenTyrian, and more!).

Thanks for your consideration.

arx-libertatis

Чувак!
Если возможно, сделай доброе дело:
Arx-Libertatis на SDL и у тебя порт SDL, можно их объединить, как-нибудь?
У меня Android 4.0.4, CPU 1Ghz_2, MEM 215Mb, и я смотрю такая конфа у многих в среднем.
Пускай даже только оболочка, а образ(CD), доставать надо,
Пускай даже минимум 800_600 бесплатный, а большее - за денюжку.
В Рунете очень многие хотят, аж воют от тоски!
А у меня свой резон - комп сломался и будет не скоро.
Объявить можно на 4PDA и на самом arx-libertatis.org
Спасибо.
Удачи в хороших проектах!!!
:-)

Cannot compile VCMI

Hello. So, I have got 2387 revision of VCMI and am trying to compile it. Everything seems to work up to step

launch "make" from directory project/jni/application/vcmi

Then compilation fails and make command outputs huge log - http://paste.pocoo.org/show/585738/
I am using Archlinux (Linux localhost 3.3.2-1-ARCH #1 SMP PREEMPT Sat Apr 14 09:48:37 CEST 2012 x86_64 Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz GenuineIntel GNU/Linux) if that matters.
NDK is android-ndk-r5-crystax-2

Hover does not work with jitter filter disabled

Also tone down jitter filter, add togglable on-screen buttons for Ctrl/Alt/Shift to Gimp, and modify it's default config - turn off 'Show pointer for paint tools', 'Show brush outline' and rulers.

"powered by" logo

I had done porting one of the classic game, and i think it is good idea to add logo of you project.

Do you have such logos?

xserver mouse moves only horizontal

Hi

Thanks for the xserver xsdl port. I have one issue with it. It seems like the mouxe clicking does not work. Then i tried relative mode which shows the pointer however the pointerl only moves on a horizantal line.

I am using nexus 7 and4.4.4 cyanogenmod

Thanks

Crash on startup with threading error

I am using a Nexus 6 on Android 5.0.1.
This happens in OpenMSX (see my bug report there), but they told me it was likely a commanderGenius issue so I'm reporting it here.

Below is a copypaste of the issue from OpenMSX:

Just want to post my experience. This happens with both nightly builds and 0.12 stable.

I am on said phone at the moment so forgive my bad log posting. Also note that I am rooted (using superuser, not superSU).

I suck at using locgat, so if this is not enough to go on, I've made a backup of my entire logcat output. Let me know when you need more info.

I think it should be enough though, since it clearly looks like an issue with threading. I have threading turned off in the settings, btw.

I/ActivityManager(  807): Start proc org.openmsx.android.openmsx for activity org.openmsx.android.openmsx/.MainActivity: pid=19671 uid=10211 gids={50211, 9997, 1028, 1015} abi=armeabi
E/AndroidRuntime(19671): FATAL EXCEPTION: Thread-2069
E/AndroidRuntime(19671): Process: org.openmsx.android.openmsx, PID: 19671
E/AndroidRuntime(19671): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
E/AndroidRuntime(19671):    at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6247)
E/AndroidRuntime(19671):    at android.view.ViewRootImpl.recomputeViewAttributes(ViewRootImpl.java:2877)
E/AndroidRuntime(19671):    at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1292)
E/AndroidRuntime(19671):    at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1292)
E/AndroidRuntime(19671):    at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1292)
E/AndroidRuntime(19671):    at android.view.View.setSystemUiVisibility(View.java:17970)
E/AndroidRuntime(19671):    at org.openmsx.android.openmsx.DimSystemStatusBar$DimSystemStatusBarHoneycomb.dim(MainActivity.java:1302)
E/AndroidRuntime(19671):    at org.openmsx.android.openmsx.MainActivity$1.run(MainActivity.java:296)
E/AndroidRuntime(19671):    at java.lang.Thread.run(Thread.java:818)
I/ActivityManager(  807): Process org.openmsx.android.openmsx (pid 19671) has died
W/InputMethodManagerService(  807): Got RemoteException sending setActive(false) notification to pid 19671 uid 10211

Choppy video

Trying to run a PC-based arcade game on my MemoPad 7 tablet (x86). 1 GB RAM, CPU Intel Atom Z3745. This runs perfectly on identical hardware on a PC running puppylinux. But it's choppy to the point of being unplayable on my tablet. I am preloading the x86 libandroid-shmem.so file and have the video in a different thread (option in the gui of xserver-xsdl). Anyone else have any suggestions?

XSDL portrait mode + mouse emulation(large,tablets) not working correctly

When moving finger from left-to-right & top-to-bottom WM mouse cursor is incrementally going further away from the finger to the left & bottom.

This happens only in portrait mode. In landscape the problem does not exsist.

How to reproduce:
Settings :
"Video settings" > "Portrait/vertical.screen orientation"
"Mouse emulation" > "Mouse emulation mode" > "Large (tablets)" or "Small, magnifying glass"

xserver with metacity refresh issues

Hi

I can run the xserver ni oroblem. I am running it the way it is sown in the screen, with metacity. Alll works except that when i drag a window it leaves trail meaning tat it never clears the screen, looks like 80s tv effects.

Thanks

Combine GLSurfaceView_SDL variant with Android defined view

Hi Buddy,
I have extended your GLSurfaceView_SDL and combine it with Android MediaController which is a FrameLayout.
But it seems that when GLSurfaceView_SDL don't have actual content the MediaController is displayed, once there
comes a drawing picture request from native code(Such as from a specific SDL_main routine) the Android defined
MediaController disappeared.
Do you have any similar try to combine these? What's the expected behavior of it?

singleInstance -> singleTask

I found that android:launchMode="singleInstance" does not work with In-app billing V3, because singleInstance mode does not permits launch subtasks. So i think that it is better to use singleTask mode. Is there any disadvantages?

Milkytracker and Grafx2 issues

Hi.

I've tested your milkytracker and grafx2 ports for android on my tablet ASUS Transfomer TF101. There are great ports but there isn't support for my keboard+mouse docking.

Is not possible to configure my docking mouse to work with your programs and gain some precision on grafx2 for example. With milkytracker there are some more problems. It seems not working with my physical keyboard anyway. There aren't any keyboard layout or possible configuration to use my keyboard to compose with the pattern editor.

It will be a GREAT idea and improvement to add physical keyboard and mouse support to your programs to users with tablets with docking extensions (keyboard and mouse) like me.

Great job anyway.

Cheers.

Rebuilding SDL_Sound

I'm trying to build SDL_Sound for Android, specifically, a patched model for MKXP, as it's part of the sound system that the project uses along with fluidsynth etc. (https://github.com/Ancurio/mkxp) This project seems to be one of the better ones for working with SDL_Sound, so I'm wondering if I can use these tools to build SDL_Sound for SDL2, include the patches, and have a library to build other projects with.

lollipop

Both the standalone SDL and Debian noroot give a stale socket error in lollipop so can't be used.

Problem with portrait mode on Samsung Galaxy Tab 4 tablet (Android 4.4.2 OS)

Hi Pelya,

One of the openMSX users reported following problem:
"I installed openMSX android version (0.11.0-251) on my Samsung Galaxy Tab 4 tablet (Android 4.4.2 OS).
In "Landscape Screen Orientation", openMSX works very well, but when configure "Portrait Screen Orientation" (Change Device Configuration > Video Settings > Portrait/vertical screen orientation) the openMSX cuts the image on both sides"

See https://onedrive.live.com/?cid=5765a0dc9e19ecee&id=5765A0DC9E19ECEE!539&ithint=folder,png&authkey=!ANcYr-_GtoDtq0o for a screenshot

OpenMSX is compiled against version of commandergenius from more then 6 months ago. Don't know the exact date.

Is this a known issue that has meanwhile been fixed? Can we fix openMSX by simply re-baselining against latest version of commandergenius?

Thanks and kind regards,
Alex

Add support for SuperSU where available

It would be great to have support for SuperSU in devices with it available, thus allowing to run a full Debian system without troubles due to not using a true chroot environment.

jack and midi input not run

hello i am connecting a Hecules midi controller to mixxx program. the controller is detected in console but to launch Qjaq-control show an error: could not connect to jack server from client. the global operation fallen. and in the text message i see

shm:remove: shmid32160006 is still mapedd to addr 0x42454000, it will be deleted on shmdt () call
shmdt: unmaped addr addr 0x42454000 for FD16 ID 2 shmid 32160006
shm_remove deleting shmid 32160006
shm_find id: can not find shmid 32160006
shm_remove: ERROR shmid 32160006 does not exist

i read it is an bug.
I put the user in the audio group but nothing
in other reading i see the error is does not exist the snd-pcm-oss module and others
with the lsmod command i see there is not modules installed and when i install with modprobe it, they shown error and i can not to install

helpme please.

Don't work in Android 5.1.1

Running non rooted stock 5.1.1 on 16GB Nexus 5 (Version LMY48B) don't load main screen.The screen is black and nothing happens.

Mouse still doesn't works and new mouse related problems in Grafx2 after actualitation

Hi! After updating Grafx2 and MilkyTracker from market, new issues appears on my Asus Transformer.

Asus touchpad still unuseable in both applications (Grafx2 and MilkyTracker). Android system cursor moves at different speed than grafx2 and Milkytracker cursors. It will be a good idea make use of Android system cursor only when using mouse/touchpad configurations. Random pulsations are made too when using touchpad and applications went crazy. Mouse is still not working.

Keyboard layout seems to be ok now in Milkytracker.

New issue with Grafx2: Painting cursor appears now like a big 8x8 white square over the original cursor. Impossible to use it now with mouse or without it (touch mode).

XSDL "Change resolution" untouchable resolutions 1024x768 800x600 800x480 640x480

In landscape :
Bottom 3rd row is untouchable.
When a resolution is picked it sets the resolution above it instead.

In portrait :
Right most 3rd column is untouchable.
When a resolution is picked it sets the resolution to the left of it instead.

The following are the resolutions that can't be set :
1024x768 800x600 800x480 640x480

I think it do be better if we could just type in the resolution (& DPI number) inside "Change device configuration"

Why can't i prevent the a thread exited without detaching from JVM

Hi Pelya,

In my latest commit 1, i created a pthread_key_t 2for threads that created in Java layer, to do a automatically detaching from JVM when the thread exits.

I verified this way works fine in my other JNI related project.

Have your meet the same issue(crashed when a thread created in Java layer & exited from native code without formerly detaching from JVM)?

Just as the typical log:
437 07-28 11:55:45.989 9615 9652 D dalvikvm: threadid=13: thread exiting, not yet detached (count=0)
438 07-28 11:55:45.989 9615 9652 D dalvikvm: threadid=13: thread exiting, not yet detached (count=1)
439 07-28 11:55:45.989 9615 9652 E dalvikvm: threadid=13: native thread exited without detaching
440 07-28 11:55:45.989 9615 9652 E dalvikvm: VM aborting
441 07-28 11:55:45.989 9615 9652 F libc : Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 9652 (GLThread)
442 07-28 11:55:46.020 437 476 D KeyguardUpdateMonitor: Lawmo lock is mLawmoLock=false
443 07-28 11:55:46.028 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
444 07-28 11:55:46.051 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
445 07-28 11:55:46.075 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
446 07-28 11:55:46.098 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
447 07-28 11:55:46.114 15784 15784 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
448 07-28 11:55:46.114 15784 15784 I DEBUG : Build fingerprint: 'motorola/XT910_cn/umts_spyder:4.1.2/6.7.2_GC-381/398:user/release-keys'
449 07-28 11:55:46.114 15784 15784 I DEBUG : pid: 9615, tid: 9652, name: GLThread >>> org.ffmpeg.ffplayer <<<
450 07-28 11:55:46.114 15784 15784 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
451 07-28 11:55:46.122 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
452 07-28 11:55:46.145 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
453 07-28 11:55:46.176 10275 10322 D AudioHardwareMot: Output latency, from ALSA = 99
454 07-28 11:55:46.614 15784 15784 I DEBUG : tls: 5580af00
455 07-28 11:55:46.614 15784 15784 I DEBUG :
456 07-28 11:55:46.614 15784 15784 I DEBUG : r0 00000000 r1 4081265c r2 deadd00d r3 000000ff
457 07-28 11:55:46.614 15784 15784 I DEBUG : r4 40812656 r5 0000020c r6 40138460 r7 00000001
458 07-28 11:55:46.614 15784 15784 I DEBUG : r8 407d7a2d r9 40138454 sl 5136afc0 fp 00000001
459 07-28 11:55:46.614 15784 15784 I DEBUG : ip 00001f00 sp 5580ac20 lr 407cb00f pc 407cb01e cpsr 80000030
460 07-28 11:55:46.614 15784 15784 I DEBUG : d0 74726f6261204d75 d1 6977206465746973
461 07-28 11:55:46.614 15784 15784 I DEBUG : d2 6568636174656465 d3 746e756f63282072
462 07-28 11:55:46.614 15784 15784 I DEBUG : d4 3ff0000000000000 d5 0000000000000000
463 07-28 11:55:46.614 15784 15784 I DEBUG : d6 3ff0000000000000 d7 3ff0000000000000
464 07-28 11:55:46.614 15784 15784 I DEBUG : d8 7ff8000000000000 d9 412e848000000000
465 07-28 11:55:46.614 15784 15784 I DEBUG : d10 0000000000000000 d11 0000000000000000
466 07-28 11:55:46.614 15784 15784 I DEBUG : d12 0000000000000000 d13 0000000000000000
467 07-28 11:55:46.614 15784 15784 I DEBUG : d14 0000000000000000 d15 0000000000000000
468 07-28 11:55:46.614 15784 15784 I DEBUG : d16 3ff0000000000000 d17 7e37e43c8800759c
469 07-28 11:55:46.614 15784 15784 I DEBUG : d18 3f964134a0a972e0 d19 c0256370281281e3

Thanks,
faywong

Request to support android tv and moga and shield controllers

Hi,

I have received a request from one of the users of openMSX for Android to support android tv and also the moga and shield controllers.

Are there any plans to include this in Android SDL? Or maybe it's already included in most recent version?

Thanks and kind regards,
Alex

Trackball movement much too slow

I'm trying out OpenTTD on a HTC Dream, which has a relatively small trackball, and the cursor movement speed is just glacial, even with speed and acceleration set to "fast". Makes the game as good as unplayable.

Compilation errors

while the NO_REMAP functionality was added i got this errors:

compile:
    [javac] Compiling 10 source files to /home/matthieu/android/commandergenius/project/bin/classes
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:453: cannot find symbol
    [javac] symbol: method showAdditionalInputConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showAdditionalInputConfig(p);
    [javac]                                             ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:472: cannot find symbol
    [javac] symbol: method showArrowKeysConfig(net.bigorno.xrick.MainActivity)
    [javac]                                                     showArrowKeysConfig(p);
    [javac]                                                     ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:479: cannot find symbol
    [javac] symbol: method showAccelerometerConfig(net.bigorno.xrick.MainActivity)
    [javac]                                                     showAccelerometerConfig(p);
    [javac]                                                     ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:485: cannot find symbol
    [javac] symbol: method showAudioConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showAudioConfig(p);
    [javac]                                             ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:567: cannot find symbol
    [javac] symbol: method showLeftClickConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showLeftClickConfig(p);
    [javac]                                             ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:572: cannot find symbol
    [javac] symbol: method showRightClickConfig(net.bigorno.xrick.MainActivity)
    [javac]                                                     showRightClickConfig(p);
    [javac]                                                     ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:578: cannot find symbol
    [javac] symbol: method showAdditionalMouseConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showAdditionalMouseConfig(p);
    [javac]                                             ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:655: cannot find symbol
    [javac] symbol: method showScreenKeyboardThemeConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showScreenKeyboardThemeConfig(p);
    [javac]                                             ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:659: cannot find symbol
    [javac] symbol: method showScreenKeyboardSizeConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showScreenKeyboardSizeConfig(p);
    [javac]                                             ^
    [javac] /home/matthieu/android/commandergenius/project/src/Settings.java:663: cannot find symbol
    [javac] symbol: method showScreenKeyboardTransparencyConfig(net.bigorno.xrick.MainActivity)
    [javac]                                             showScreenKeyboardTransparencyConfig(p);
    [javac]                                             ^
    [javac] 10 errors

i'm using the latest ndk (r5b).

Request for game "Simple Sokoban"

I haven't seen any requests for games to be added, but I also didn't see anything against it either, so I'll shoot.

Simple Sokoban is a fairly bare-bones implementation of Sokoban in ANSI C89, that uses SDL for I/O. I think this would be a great game to be able to play on Android. Since it seems like a simple game (really, there are only four buttons), I am hoping someone would not mind porting it.

Surface error

Hi

I know this may not have anything to do with your particular code, but I'm really needing help here. I'm porting a SDL 1.2 game, using your repo as base, and i'm getting the following error on SDL_SetVideoMode:

04-01 10:37:36.006 15620-15719/com.webpolis.game.soccerkup V/libSDL﹕ calling SDL_SetVideoMode(800, 480, 32, -1879048192)
04-01 10:37:36.006 15620-15719/com.webpolis.game.soccerkup I/libSDL﹕ SDL_SetVideoMode(): application requested mode 800x480 OpenGL 0 HW 0 BPP 32
04-01 10:37:36.006 15620-15719/com.webpolis.game.soccerkup E/libSDL﹕ ERROR: Setting the swap interval is not supported
04-01 10:37:36.006 15620-15719/com.webpolis.game.soccerkup E/libSDL﹕ ERROR: Getting the swap interval is not supported
04-01 10:37:36.006 15620-15719/com.webpolis.game.soccerkup E/libSDL﹕ ERROR: GL_GetAttribute not supported
04-01 10:37:36.006 15620-15719/com.webpolis.game.soccerkup I/libSDL﹕ ANDROID_GL_GetProcAddress("glGetString"): 0x40090cb4
04-01 10:37:36.016 15620-15719/com.webpolis.game.soccerkup V/libSDL﹕ SDL_SetVideoMode(): Requested mode: 800x480x32, obtained mode 800x480x32
04-01 10:37:36.016 15620-15719/com.webpolis.game.soccerkup V/libSDL﹕ SDL_SetVideoMode(): returning surface 0x4f4f0ad0

As you see, the surface is created, but nothing is shown. I'm using existing code, which has been proved to work fine in my desktop. Any way, this error is triggered at the beginning, on initialization, before the game loop.

The piece of code here is:

    SDL_SetVideoMode(ww, hh, 32, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_FULLSCREEN);

I'm doing ndk-debug and the error is triggered after the above line is executed.

In AndroidAppSettings.cfg I have (between other stuff, of course):

VideoDepthBpp=32
SwVideoMode=y
SdlVideoResize=y

Also, inside the game loop, I had to disable

SDL_GL_SwapBuffers();

because it was causing OpenGL video mode has not been set

Is there anything I should check? I am very new to SDL/OpenGL stuff, but I was successful in getting some of the games included in your package to work on my device.

Thanks in advance, any help is very very appreciated. If successful, I will share my code with you.

Deadlock in change device config button's onClick method

If user clicks the button too fast deadlock may happen.

It tries to loadedLibraries.acquireUninterruptibly(); and blocks UI thread so loadedLibraries.release(); never gets called.

Suggested fix (hack): disable button untill it's "ready":

@@ -113,6 +117,7 @@ public class MainActivity extends Activity
                if( Globals.StartupMenuButtonTimeout > 0 )
                {
                        _btn = new Button(this);
+                       _btn.setEnabled(false);
                        _btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
                        _btn.setText(getResources().getString(R.string.device_change_cfg));
                        class onClickListener implements View.OnClickListener
@@ -185,6 +190,7 @@ public class MainActivity extends Activity
                                                        Settings.Load(Parent);
                                                        loaded.release();
                                                        loadedLibraries.release();
+                                                       _btn.setEnabled(true);
                                                }
                                        }
                                        Callback2 cb = new Callback2();

I can't gon on compiling your project

I followed your instruction and compiled your project, but stopped while compiling project/jni/freetype/builds/amiga/src/base/ftdebug.c with many include file missing errors, such as exec/types.h, utility/tagitem.h, and so on. I searched for a long time and couldn't find how to get them. Please tell me a way to compile your project successfully. I use ubuntu with android-ndk-r4.

Unable to create overlay button.

I want to create button in left-top corner of the screen. I add creation code into end of initSDLInternal method:

private void initSDLInternal()
{
...
        // Receive keyboard events
        DimSystemStatusBar.get().dim(_videoLayout);
        DimSystemStatusBar.get().dim(mGLView);

        Button btnTag = new Button(this);
        btnTag.setLayoutParams(new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP
                        | Gravity.LEFT));
        btnTag.setText("O");
        btnTag.setId(1);
        btnTag.setClickable(true);
        btnTag.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Log.e("APP", "CLICK");
                Toast toast = Toast.makeText(MainActivity.this, "YARR!@", Toast.LENGTH_LONG);
                toast.show();
            }
        });

        _videoLayout.addView(btnTag);
}

When game starts i see this button but i cant click on it. I miss something, why this code does not work? Is there any workraound?

Problems with Italian Keyboards (possibly with other non-US keyboards)

I have tested it on an Asus TF700T, both with the dock (italian) keyboard and with an external (wireless) Italian keyboard. I checked, from within a chrooted linux environment, that the keyboard input events are correct (I used evtest to check), but XServer XSDL does not handle all of them correctly (I used xev to check):

  1. Keys AE11 (in the Italian keyboard: apostrophe, question, grave, questiondown)
    and AB10 (minus, underscore, dead_macron, division) are swapped.
  2. DEL, ESC, INS and 102ND (in the Italian keyboard: less, greater) keys do not work at all, they are not even detected by X server
  3. Alt/AltGr+WHATEVERKEY events are seen as if only WHATEVERKEY is pressed (without Alt/AltGr)

See my posts here:
http://forum.xda-developers.com/showpost.php?p=57875401&postcount=7
http://forum.xda-developers.com/showpost.php?p=58129816&postcount=11

Playing midi files through SDL_mixer

It is possible to play .mid files through Mix_PlayMusic in android? In native app its work as expected. But when i build android app i dont hear music. Also i implement sound effects through Mix_PlayChannel and they work in native app and android app.

Maybe i miss something?

Also, this files i can play through Android Media Player and it is work fine.

Middle mouse button emulation

Hi this is not really bug, it is a question. It is possible to configure build to emulate middle button with 2 fingers tap? I mean when i touch screen with two fingers sdl will recive mouse middle press with coords of first finger, when i move fingers it will recive mouse move events with middle button pressed, and finally send mouse up event.

If not, what the best way to implement this behaviour. If possible please say what classes should be modified to implement this. I plan to implement this feature if is not yet available.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.