XSDL: fixed PulseAudio

This commit is contained in:
Sergii Pylypenko
2019-10-29 22:17:43 +02:00
parent ae4f496106
commit 769a99cbd8
8 changed files with 50 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ AppVersionName="1.20.41"
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version for obb file
# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries
# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip
AppDataDownloadUrl="!!Data files|:data.tar.gz:data-1.tgz^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf^Additional fonts (90Mb)|:xfonts.tar.gz:https://sourceforge.net/projects/libsdl-android/files/apk/XServer-XSDL/xfonts.tgz/download"
AppDataDownloadUrl="!!Data files|:data.tar.gz:data-2.tgz^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf^Additional fonts (90Mb)|:xfonts.tar.gz:https://sourceforge.net/projects/libsdl-android/files/apk/XServer-XSDL/xfonts.tgz/download"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n

View File

@@ -4,7 +4,6 @@ CURDIR=`pwd`
PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
if false; then # Disable PulseAudio for now
if [ -e pulseaudio/android-build.sh ]; then
[ -e pulseaudio/$1/install/bin/pulseaudio ] || {
cd pulseaudio
@@ -12,7 +11,6 @@ if [ -e pulseaudio/android-build.sh ]; then
cd ..
} || exit 1
fi
fi # Disable PulseAudio for now
../setEnvironment-$1.sh sh -c '\
$CC $CFLAGS -Werror=format -c main.c -o main-'"$1.o" || exit 1
@@ -81,19 +79,11 @@ cp -f $CURDIR/xserver/data/busybox-$1 ./busybox
for f in xhost xkbcomp xloadimage xsel; do cp -f $CURDIR/xserver/android/$1/$f ./$f ; done
# Statically-linked prebuilt executables, generated using Debian chroot.
if false; then # Disable PulseAudio for now
mkdir -p pulse
cp -f $CURDIR/pulseaudio/$1/install/bin/pulseaudio pulse/
cp -f $CURDIR/pulseaudio/$1/install/lib/libpulse.so.0.18.2 pulse/libpulse.so.0
#ln -sf libpulse.so.0.18.2 pulse/libpulse.so.0
#ln -sf libpulse.so.0.18.2 pulse/libpulse.so
cp -f $CURDIR/pulseaudio/$1/install/lib/libpulsecore-7.0.so pulse/
cp -f $CURDIR/pulseaudio/$1/install/lib/pulseaudio/libpulsecommon-7.0.so pulse/
for F in $CURDIR/pulseaudio/$1/install/lib/pulse-7.0/modules/*.so; do
cp -f $F pulse/
done
cp -f $CURDIR/pulseaudio/android-pulseaudio.conf pulse/pulseaudio.conf
fi # Disable PulseAudio for now
cp -f $CURDIR/pulseaudio/$1/install/bin/pulseaudio ./
cp -f $CURDIR/pulseaudio/$1/install/lib/*.so ./
cp -f $CURDIR/pulseaudio/$1/install/lib/pulseaudio/*.so ./
cp -f $CURDIR/pulseaudio/$1/install/lib/pulse-*/modules/*.so ./
cp -f $CURDIR/pulseaudio/$1/*/install/lib/*.so ./
rm -f ../AndroidData/binaries-$1.zip
rm -rf ../AndroidData/lib

View File

@@ -1 +0,0 @@
../xserver/data/data-1.tgz

View File

@@ -0,0 +1 @@
../xserver/data/data-2.tgz

View File

@@ -84,9 +84,12 @@ static int unpackFiles(const char *archive, const char *script, const char *dele
if( strlen(deleteOldDataMarkerFile) > 0 && stat( fname2, &st ) == 0 )
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Upgrade detected, showing warning dialog");
upgradeWarning = UPGRADE_WARNING_PROCEED;
/*
upgradeWarning = UPGRADE_WARNING_ASK;
while( upgradeWarning == UPGRADE_WARNING_ASK )
SDL_Delay(200);
*/
if( upgradeWarning == UPGRADE_WARNING_CANCEL )
return 1;
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Deleting old installation...");
@@ -290,6 +293,12 @@ static void symlinkBusybox(void)
remove(fname);
symlink(fname2, fname);
__android_log_print(ANDROID_LOG_INFO, "XSDL", "ln -s %s %s", fname2, fname);
}
static void symlinkUsrBin(void)
{
char fname[PATH_MAX*2];
char fname2[PATH_MAX];
strcpy( fname, getenv("APPDIR") );
strcat( fname, "/busybox" );
@@ -421,6 +430,8 @@ void XSDL_unpackFiles(int _freeSpaceRequiredMb)
exit(1);
}
SDL_JoystickClose(j0);
symlinkUsrBin();
}
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys, char * portStr)

View File

@@ -8,6 +8,7 @@
#include <netinet/in.h>
#include <sys/un.h>
#include <errno.h>
#include <pthread.h>
#include <SDL/SDL.h>
#include <SDL/SDL_screenkeyboard.h>
#include <SDL/SDL_android.h>
@@ -21,6 +22,7 @@ static void retryLaunchWithDifferentPort(void);
static void showError(void);
static void setupEnv(void);
static char port[16] = ":0";
static void startPulseAudio(void);
int main( int argc, char* argv[] )
{
@@ -171,6 +173,8 @@ int main( int argc, char* argv[] )
__android_log_print(ANDROID_LOG_INFO, "XSDL", "XSDL chdir to: %s", getenv("SECURE_STORAGE_DIR"));
chdir( getenv("SECURE_STORAGE_DIR") ); // Megahack: change /proc/self/cwd to the X.org data dir, and use /proc/self/cwd path in libX11
startPulseAudio();
android_main( argnum, args, envp ); // Should never exit on success, if we want to terminate we kill ourselves
return 0;
@@ -207,3 +211,29 @@ void showError(void)
XSDL_showServerLaunchErrorMessage();
XSDL_deinitSDL();
}
static void *pulseThread(void *param)
{
char pulseCmd[PATH_MAX * 7] = "";
sprintf(pulseCmd, "HOME=%s TMPDIR=%s LD_LIBRARY_PATH=%s/usr/bin "
"logwrapper %s/usr/bin/pulseaudio --disable-shm -n -F %s/pulseaudio.conf "
"--dl-search-path=%s/usr/bin --daemonize=false --use-pid-file=false "
"--log-target=stderr --log-level=debug",
getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR"),
getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR"),
getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR"));
while( 1 )
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Starting Pulseaudio");
__android_log_print(ANDROID_LOG_INFO, "XSDL", "%s", pulseCmd);
system(pulseCmd);
sleep(5);
}
return NULL;
}
void startPulseAudio(void)
{
pthread_t threadId;
pthread_create(&threadId, NULL, &pulseThread, NULL);
}