Merge branch 'sdl_android' of https://github.com/pelya/commandergenius into sdl_android

This commit is contained in:
lubomyr
2016-03-07 14:44:09 +02:00
10 changed files with 106 additions and 22 deletions

View File

@@ -125,7 +125,7 @@ public class DummyService extends Service
view.setOnClickPendingIntent(R.id.notificationStop, killIntent);
ntf.contentView = view;
startForeground(1, ntf);
return Service.START_STICKY;
return Service.START_NOT_STICKY;
}
@Override
public void onDestroy()

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=11138
AppVersionCode=11139
# Application user-visible version name (string)
AppVersionName="1.11.38"
AppVersionName="1.11.39"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu

View File

@@ -13,9 +13,9 @@ PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
} || exit 1
../setEnvironment-$1.sh sh -c '\
$CC $CFLAGS -c main.c -o main-'"$1.o" || exit 1
$CC $CFLAGS -Werror=format -c main.c -o main-'"$1.o" || exit 1
../setEnvironment-$1.sh sh -c '\
$CC $CFLAGS -c gfx.c -o gfx-'"$1.o" || exit 1
$CC $CFLAGS -Werror=format -c gfx.c -o gfx-'"$1.o" || exit 1
[ -e ../../../lib ] || ln -s libs ../../../lib

View File

@@ -394,7 +394,7 @@ void XSDL_unpackFiles(int _freeSpaceRequiredMb)
SDL_JoystickClose(j0);
}
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH)
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys)
{
int x = 0, y = 0, i, ii;
SDL_Event event;
@@ -406,6 +406,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
int vertical = SDL_ListModes(NULL, 0)[0]->w < SDL_ListModes(NULL, 0)[0]->h;
char cfgpath[PATH_MAX];
FILE * cfgfile;
int okay = 0;
if( vertical )
{
@@ -459,7 +460,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
cfgfile = fopen(cfgpath, "r");
if( cfgfile )
{
fscanf(cfgfile, "%d %d %d %d", &savedRes, &savedDpi, &customX, &customY);
fscanf(cfgfile, "%d %d %d %d %d %d", &savedRes, &savedDpi, &customX, &customY, builtinKeyboard, ctrlAltShiftKeys);
fclose(cfgfile);
}
sprintf(custom, "%dx%d", customX, customY);
@@ -482,7 +483,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
}
}
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
y = VID_Y/3;
y = VID_Y/4;
renderString("Tap the screen to change", vertical ? VID_Y / 2 : VID_X/2, y);
y += 30;
renderString("display resolution and font scale (DPI)", vertical ? VID_Y / 2 : VID_X/2, y);
@@ -493,6 +494,9 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
y += 30;
sprintf(buf, "Font scale: %s", fontsStr[savedDpi]);
renderString(buf, vertical ? VID_Y / 2 : VID_X/2, y);
y += 30;
sprintf(buf, "Keyboard: %s", *builtinKeyboard == 0 ? "System" : *builtinKeyboard == 1 ? "Builtin QWERTY" : "System + Builtin");
renderString(buf, vertical ? VID_Y / 2 : VID_X/2, y);
y += 40;
sprintf(buf, "Starting in %d seconds", counter / 1000 + 1);
renderString(buf, vertical ? VID_Y / 2 : VID_X/2, y);
@@ -668,6 +672,58 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
*displayW = *displayW / fontsVal[dpi];
*displayH = *displayH / fontsVal[dpi];
okay = !config;
while ( !okay )
{
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_HELP)
return;
break;
case SDL_MOUSEBUTTONUP:
{
//SDL_GetMouseState(&x, &y);
if( vertical )
{
int z = x;
x = y;
y = z;
}
if( y > 0 && y < VID_Y * 2 / 6 )
*builtinKeyboard = (*builtinKeyboard + 1) % 3;
if( y > VID_Y * 2 / 6 && y < VID_Y * 4 / 6 )
*ctrlAltShiftKeys = !*ctrlAltShiftKeys;
if( y > VID_Y * 4 / 6 && y < VID_Y * 6 / 6 )
okay = 1;
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Screen coords %d %d dpi %d\n", x, y, res);
}
break;
case SDL_JOYBALLMOTION:
x = event.jball.xrel;
y = event.jball.yrel;
break;
}
}
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
char buf[100];
sprintf(buf, "Keyboard: %s", *builtinKeyboard == 0 ? "System" : *builtinKeyboard == 1 ? "Builtin QWERTY" : "System + Builtin");
renderString(buf, VID_X/2, VID_Y * 1 / 6);
sprintf(buf, "Separate Ctrl/Alt/Shift keys: %s", *ctrlAltShiftKeys == 0 ? "No" : "Yes");
renderString(buf, VID_X/2, VID_Y * 3 / 6);
sprintf(buf, "Okay");
renderString(buf, VID_X/2, VID_Y * 5 / 6);
SDL_Delay(100);
SDL_Flip(SDL_GetVideoSurface());
}
SDL_JoystickClose(j0);
if( config )
@@ -675,7 +731,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
cfgfile = fopen(cfgpath, "w");
if( cfgfile )
{
fprintf(cfgfile, "%d %d %d %d\n", res, dpi, customX, customY);
fprintf(cfgfile, "%d %d %d %d %d %d\n", res, dpi, customX, customY, *builtinKeyboard, *ctrlAltShiftKeys);
fclose(cfgfile);
}
}
@@ -687,7 +743,7 @@ void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, i
struct ifconf ifc;
struct ifreq ifr[20];
SDL_Surface * surf;
int y = resolutionH * 1 / 3;
int y = resolutionH * 1 / 6;
char msg[128];
if (resolutionH > resolutionW)
@@ -756,6 +812,13 @@ void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, i
sprintf (msg, "in your SSH client");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 20 / VID_Y;
sprintf (msg, "If you run Linux in chroot on this device, run:");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "export DISPLAY=:0 PULSE_SERVER=tcp:127.0.0.1:4712");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
SDL_SaveBMP(surf, "background.bmp");
SDL_FreeSurface(surf);
}

View File

@@ -6,7 +6,7 @@ enum { VID_X = 480, VID_Y = 320 };
void XSDL_initSDL();
void XSDL_deinitSDL();
void XSDL_unpackFiles(int freeSpaceRequiredMb);
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH);
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys);
void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, int resolutionH);
void XSDL_showServerLaunchErrorMessage();

View File

@@ -48,6 +48,7 @@ int main( int argc, char* argv[] )
int screenResOverride = 0;
int screenButtons = 0;
int warnDiskSpaceMb = 0;
int builtinKeyboard = 0;
int resolutionW = atoi(getenv("DISPLAY_RESOLUTION_WIDTH"));
int resolutionH = atoi(getenv("DISPLAY_RESOLUTION_HEIGHT"));
@@ -118,7 +119,7 @@ int main( int argc, char* argv[] )
if( !screenResOverride )
{
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH);
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH, &builtinKeyboard, &screenButtons);
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, SDL_GetVideoInfo()->vfmt->BitsPerPixel );
}
@@ -149,6 +150,12 @@ int main( int argc, char* argv[] )
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
}
{
char s[16];
sprintf(s, "%d", builtinKeyboard);
setenv("XSDL_BUILTIN_KEYBOARD", s, 1);
}
__android_log_print(ANDROID_LOG_INFO, "XSDL", "XSDL video resolution %s, args:", screenres);
for( i = 0; i < argnum; i++ )
__android_log_print(ANDROID_LOG_INFO, "XSDL", "> %s", args[i]);

View File

@@ -3,15 +3,17 @@ TODO, which will get actually done
- TeeWorlds: infinite loop while trying to enter chat text with gamepad.
- TeeWorlds: navigate UI with gamepad.
- TeeWorlds: navigate UI with gamepad, auto-switch to correct aiming mode when gamepad is used.
- OpenArena: fix aiming angles jumping at random after the first zoom and after respawn.
- TeeWorlds: aiming with gyroscope.
- SDL: implement SDL_GL_LoadLibrary() / SDL_GL_GetProcAddress() / SDL_GL_SetAttribute() / SDL_GL_GetAttribute().
- OpenArena: fix aiming angles jumping at random after the first zoom and after respawn, publish to Android TV.
- SDL: CompatibilityHacksForceScreenUpdate=y does not redraw screen after putting to background and restoring.
- OpenArena: fix VR mode, add settings for eye separation and focus angle.
- USB Keyboard: options for camera feed size and for redefining remote menu hotkey, control mouse with gyroscope.
- OpenArena: add dynamic camera/joystick, add option for joystick tap action.
- USB Keyboard: options for camera feed size and for redefining remote menu hotkey.
- OpenTTD: 24bpp color mode + 32bpp blitter in SDL menu.
@@ -19,10 +21,22 @@ TODO, which will get actually done
- OpenTTD: Fix team chat with 6 or more players.
- SDL: add option for non-fullscreen non-immersive mode.
- OpenTTD: tap to confirm construciton, and hide all dialogs when constructing something.
- UQM HD: add fonts from http://mosc-portal.bursa.ru/showthread.php?t=206 and switch back to joystick controls, set 4:3 aspect ratio as default.
- SDL: gyroscope calibration is broken.
- SDL: implement SDL_GL_LoadLibrary() / SDL_GL_GetProcAddress() / SDL_GL_SetAttribute() / SDL_GL_GetAttribute().
- SDL: CompatibilityHacksForceScreenUpdate=y does not redraw screen after putting to background and restoring.
- SDL: request SD card permission on Android 6.
- SDL: add option for non-fullscreen non-immersive mode.
- SDL: add option to remove border for Android TV.
- Debian: proot crashes on Shield TV arm64 box.
- Debian: add harldink simulation to proot, for Android 6.
- Debian: add OpenSL ES output plugin to PulseAudio.