XSDL: option to disable PulseAudio

This commit is contained in:
Sergii Pylypenko
2021-03-13 01:24:39 +02:00
parent a8207ceeae
commit a3d5595519
5 changed files with 20 additions and 10 deletions

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=12050
AppVersionCode=12051
# Application user-visible version name (string)
AppVersionName="1.20.50"
AppVersionName="1.20.51"
# 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, '!!' will also hide the entry from the menu, so it cannot be disabled

View File

@@ -426,7 +426,7 @@ void XSDL_unpackFiles(int _freeSpaceRequiredMb)
SDL_JoystickClose(j0);
}
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys, char * portStr)
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys, char * portStr, int * pulseAudio)
{
int x = 0, y = 0, i, ii;
SDL_Event event;
@@ -493,7 +493,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
cfgfile = fopen(cfgpath, "r");
if( cfgfile )
{
fscanf(cfgfile, "%d %d %d %d %d %d %d", &savedRes, &savedDpi, &customX, &customY, builtinKeyboard, ctrlAltShiftKeys, &port);
fscanf(cfgfile, "%d %d %d %d %d %d %d %d", &savedRes, &savedDpi, &customX, &customY, builtinKeyboard, ctrlAltShiftKeys, &port, pulseAudio);
fclose(cfgfile);
if (strcmp(portStr, ":0") != 0)
{
@@ -782,7 +782,11 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
port ++;
port %= 4;
}
if( y > VID_Y * 4 / 6 && y < VID_Y * 6 / 6 )
if( y > VID_Y * 3.5f / 6 && y < VID_Y * 4.5f / 6 )
{
*pulseAudio = !(*pulseAudio);
}
if( y > VID_Y * 4.5 / 6 && y < VID_Y * 6 / 6 )
{
okay = 1;
}
@@ -822,6 +826,9 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
sprintf(buf, "Display number: %d", port);
renderString(buf, VID_X/2, VID_Y * 3 / 6);
sprintf(buf, "PulseAudio: %s", *pulseAudio ? "Yes" : "No");
renderString(buf, VID_X/2, VID_Y * 4 / 6);
sprintf(buf, "Okay");
renderString(buf, VID_X/2, VID_Y * 5 / 6);
@@ -837,7 +844,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
cfgfile = fopen(cfgpath, "w");
if( cfgfile )
{
fprintf(cfgfile, "%d %d %d %d %d %d %d\n", res, dpi, customX, customY, *builtinKeyboard, *ctrlAltShiftKeys, port);
fprintf(cfgfile, "%d %d %d %d %d %d %d %d\n", res, dpi, customX, customY, *builtinKeyboard, *ctrlAltShiftKeys, port, *pulseAudio);
fclose(cfgfile);
}
}

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, int * builtinKeyboard, int * ctrlAltShiftKeys, char * port);
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys, char * port, int * pulseAudio);
void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, int resolutionH);
void XSDL_showServerLaunchErrorMessage();

View File

@@ -61,6 +61,8 @@ int main( int argc, char* argv[] )
int displayW = atoi(getenv("DISPLAY_WIDTH_MM"));
int displayH = atoi(getenv("DISPLAY_HEIGHT_MM"));
int pulseAudio = 1;
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Actual video resolution %d/%dx%d/%d", resolutionW, displayW, resolutionH, displayH);
setupEnv();
@@ -125,7 +127,7 @@ int main( int argc, char* argv[] )
if( !screenResOverride )
{
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH, &builtinKeyboard, &screenButtons, port);
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH, &builtinKeyboard, &screenButtons, port, &pulseAudio);
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH,
SDL_GetVideoInfo()->vfmt->BitsPerPixel == 24 ? 32 : SDL_GetVideoInfo()->vfmt->BitsPerPixel );
}
@@ -177,7 +179,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();
if( pulseAudio )
startPulseAudio();
android_main( argnum, args, envp ); // Should never exit on success, if we want to terminate we kill ourselves