OpenArena: fixes for fullscreen mode, now the game is playable

This commit is contained in:
Gerasim Troeglazov
2020-05-21 23:48:43 +10:00
parent 38a0a669a5
commit 37e607220a
3 changed files with 372 additions and 25 deletions

View File

@@ -3,8 +3,8 @@ resource app_flags B_SINGLE_LAUNCH | B_ARGV_ONLY;
resource app_version {
major = 0,
middle = 7,
minor = 4,
middle = 8,
minor = 9,
variety = B_APPV_FINAL,
internal = 0,
@@ -16,23 +16,21 @@ resource app_version {
resource app_signature "application/x-vnd.openarena";
resource vector_icon {
$"6E636966010500060A04C3F4C39AC2C6C13EC3F4BE86C522C13E0A04C3F4C39A"
$"C2C6C13EC3F4BE86C522C13E060AAECE0EC7BFCA9ACBA1CA9ACBA1CA9ACAE5CA"
$"46CA72C99FC3FBB464BD84C9A5BC54CAA0BD11CA4CBC54CAA0C036BEFFC9BD3F"
$"CA29BEFFC9BDC3FBB829C8F6C9B7C8F6C9B7C89CCA23060AAECE0EC7BFCA9ACB"
$"A1CA9ACBA1CA9ACAE5CA46CA72C99FC3FBB464BD84C9A5BC54CAA0BD11CA4CBC"
$"54CAA0C036BEFFC9BD3FCA29BEFFC9BDC3FBB829C8F6C9B7C8F6C9B7C89CCA23"
$"020AC3E82BCC5B2BBB752BB49CBD59B49CBA0EB49CC03CC0DAC331B9DEC2A4C0"
$"DAC331C181C0E6C181C0E6BA66C090B52EBC8EB490BEC7B5DDBA1DC3E8B7AEBB"
$"C6B7AECC0AB7AED2A2BC8ED22FBA4AD314BECDC675C0E5CD7642C675C0E5C71B"
$"C32EC71BC32ECE05C29BD335BD59D335C037D335BA0E020AC3E82BCC5B2BBB75"
$"2BB49CBD59B49CBA0EB49CC03CC0DAC331B9DEC2A4C0DAC331C181C0E6C181C0"
$"E6BA66C090B52EBC8EB490BEC7B5DDBA1DC3E8B7AEBBC6B7AECC0AB7AED2A2BC"
$"8ED22FBA4AD314BECDC675C0E5CD7642C675C0E5C71BC32EC71BC32ECE05C29B"
$"D335BD59D335C037D335BA0E060A000100023F533F0000000000003F533FC357"
$"1E451C630A000101123F533F0000000000003F533FC3571E451C630117800004"
$"0A000102023F533F0000000000003F533FC3571E451C630A000103123F533F00"
$"00000000003F533FC3571E451C6301178000040A000104023F533F0000000000"
$"003F533FC3571E451C630A000105123F533F0000000000003F533FC3571E451C"
$"630117800004"
$"6E63696609050102000602B90853B9AA0B386297B7F2A74AD35D48AE8300A56A"
$"31FFFFE6CE02000602BB12E13A8F5CBA8F5CBB12E14AF43D4AF03D00996633FF"
$"683A0E02000602343640BBFD373BFD3734364048EF1449ED8700E9D0B7FF976C"
$"41020006023A46B83B49EBBB49EB3A46B84A20514A4DC200AD8A67FF7E4E1E02"
$"000602380D703BDDC2BBDDC2380D7048F5704A035C00EECEAEFFCC9966020006"
$"023B27593BEB8DBBD1453B12354AC4B84ADB1E3A33A2FFD43369FF020006023B"
$"27593BEB8DBBD1453B123549097048163D0033A2FFFF2C51B80401580C060ABA"
$"AB0A2E4C2F48282EB3CB3C2B27392B544B5035C84EC75D4A584C5E455C3A4034"
$"5206032E372F2A32B851B72B263B314406032E474F4F485050C4F5BCCC3A300A"
$"0447503A303F2E4B4C0A044C5E4A584E54505A0606EE0B31442932263BB780B7"
$"6B372E302EBA4DB7FFB8CBB8F02F34B8E0BA2D303C343F0605AE032A2B493639"
$"25CA4CC3295153564E4C305E41BD28B2690605BA0347504B4C4C4C4B4C4E4C4F"
$"4A4B4FC4F6C51AC35EC64C0A04384E3B493F533C570A043B493E4643503F530A"
$"0434513A403F3D394D060BE2AE084C6053585B5F4A6259CABCBCE947373938C0"
$"80BBE6BA3CBD122E4334533D3C59430A0A08010B000A000A0004060A09080503"
$"01021001178422040A030105000A02010A000A070109000A04020304000A0503"
$"000102000A010106000A040107000A06010800"
};

View File

@@ -5,7 +5,7 @@ heavily on the Quake III Arena-style deathmatch. The OpenArena project was estab
HOMEPAGE="http://openarena.ws/"
COPYRIGHT="OpenArena Team"
LICENSE="GNU GPL v2"
REVISION="2"
REVISION="3"
srcGitRev="e120f49e660aab5420e6acb3a5131992645f39c3"
SOURCE_URI="https://github.com/OpenArena/engine/archive/$srcGitRev.zip"
CHECKSUM_SHA256="5d92a0fab326bb5f80eb662e741add908bafc7b76ee023adf6846c86354b0d7c"
@@ -59,7 +59,7 @@ INSTALL()
{
cd build/release*
mkdir -p $appsDir/OpenArena
cp openarena* $appsDir/OpenArena/OpenArena
cp openarena.* $appsDir/OpenArena/OpenArena
cp oa_ded* $appsDir/OpenArena/OpenArena_dedicated
addResourcesToBinaries $portDir/additional-files/openarena.rdef \
$appsDir/OpenArena/OpenArena

View File

@@ -1,4 +1,4 @@
From 64bd2a7af5cda0dcc1409964d87420dca84d549b Mon Sep 17 00:00:00 2001
From 13cce68a32e395935dc3c1a6c6137700efc8b022 Mon Sep 17 00:00:00 2001
From: Mikolaj 'lich' Halber <lich@opmbx.org>
Date: Tue, 9 Oct 2018 14:24:32 +0300
Subject: Added Haiku support
@@ -131,5 +131,354 @@ index d11ecf6..43f4d15 100644
stdinIsATTY = isatty( STDIN_FILENO ) &&
--
2.19.1
2.26.0
From 1926d31270fb4097d7f076e990cc47d87defbb8d Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 20 May 2020 17:19:16 +1000
Subject: Fix settings dir
diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c
index 43f4d15..da2a148 100644
--- a/code/sys/sys_unix.c
+++ b/code/sys/sys_unix.c
@@ -193,6 +193,14 @@ const char *Sys_DefaultHomePath(void)
Q_strcat(homePath, sizeof(homePath),
"Library/Application Support/");
+ if(com_homepath->string[0])
+ Q_strcat(homePath, sizeof(homePath), com_homepath->string);
+ else
+ Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX);
+#elif defined(__HAIKU__)
+ Q_strcat(homePath, sizeof(homePath),
+ "config/settings/");
+
if(com_homepath->string[0])
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
else
@@ -207,6 +215,7 @@ const char *Sys_DefaultHomePath(void)
return homePath;
}
+
/*
================
Sys_Milliseconds
@@ -252,6 +261,8 @@ qboolean Sys_RandomBytes( byte *string, int len )
if( !fp )
return qfalse;
+ setvbuf( fp, NULL, _IONBF, 0 ); // don't buffer reads from /dev/urandom
+
if( fread( string, sizeof( byte ), len, fp ) != len )
{
fclose( fp );
@@ -277,16 +288,6 @@ char *Sys_GetCurrentUser( void )
return p->pw_name;
}
-/*
-==================
-Sys_GetClipboardData
-==================
-*/
-char *Sys_GetClipboardData(void)
-{
- return NULL;
-}
-
#define MEM_THRESHOLD 96*1024*1024
/*
@@ -336,6 +337,16 @@ FILE *Sys_FOpen( const char *ospath, const char *mode ) {
return fopen( ospath, mode );
}
+/*
+==================
+Sys_GetClipboardData
+==================
+*/
+char *Sys_GetClipboardData(void)
+{
+ return NULL;
+}
+
/*
==================
Sys_Mkdir
@@ -343,6 +354,12 @@ Sys_Mkdir
*/
qboolean Sys_Mkdir( const char *path )
{
+#ifdef __HAIKU__
+ struct stat buff;
+ if (stat(path, &buff) == 0)
+ if (S_ISDIR(buff.st_mode))
+ return qtrue;
+#endif
int result = mkdir( path, 0750 );
if( result != 0 )
@@ -858,6 +875,7 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
qboolean tried[ NUM_DIALOG_PROGRAMS ] = { qfalse };
dialogCommandBuilder_t commands[ NUM_DIALOG_PROGRAMS ] = { NULL };
dialogCommandType_t preferredCommandType = NONE;
+ int i;
commands[ ZENITY ] = &Sys_ZenityCommand;
commands[ KDIALOG ] = &Sys_KdialogCommand;
@@ -869,50 +887,37 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
else if( !Q_stricmp( session, "kde" ) )
preferredCommandType = KDIALOG;
- while( 1 )
+ for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
{
- int i;
+ if( preferredCommandType != NONE && preferredCommandType != i )
+ continue;
- for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
+ if( !tried[ i ] )
{
- if( preferredCommandType != NONE && preferredCommandType != i )
- continue;
-
- if( !tried[ i ] )
- {
- int exitCode;
+ int exitCode;
- commands[ i ]( type, message, title );
- exitCode = Sys_Exec( );
+ commands[ i ]( type, message, title );
+ exitCode = Sys_Exec( );
- if( exitCode >= 0 )
+ if( exitCode >= 0 )
+ {
+ switch( type )
{
- switch( type )
- {
- case DT_YES_NO: return exitCode ? DR_NO : DR_YES;
- case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
- default: return DR_OK;
- }
+ case DT_YES_NO: return exitCode ? DR_NO : DR_YES;
+ case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
+ default: return DR_OK;
}
+ }
- tried[ i ] = qtrue;
+ tried[ i ] = qtrue;
- // The preference failed, so start again in order
- if( preferredCommandType != NONE )
- {
- preferredCommandType = NONE;
- break;
- }
+ // The preference failed, so start again in order
+ if( preferredCommandType != NONE )
+ {
+ preferredCommandType = NONE;
+ i = NONE + 1;
}
}
-
- for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
- {
- if( !tried[ i ] )
- continue;
- }
-
- break;
}
Com_DPrintf( S_COLOR_YELLOW "WARNING: failed to show a dialog\n" );
@@ -967,6 +972,8 @@ void Sys_PlatformInit( void )
signal( SIGABRT, Sys_SigHandler );
signal( SIGBUS, Sys_SigHandler );
+ Sys_SetFloatEnv();
+
stdinIsATTY = isatty( STDIN_FILENO ) &&
!( term && ( !strcmp( term, "raw" ) || !strcmp( term, "dumb" ) ) );
}
--
2.26.0
From 2673d4a2987544b7f3c98be4a12f6a7fa96422a7 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 20 May 2020 22:03:56 +1000
Subject: Don't disable video subsystem when shutdown
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c
index a931e81..92632e8 100644
--- a/code/sdl/sdl_glimp.c
+++ b/code/sdl/sdl_glimp.c
@@ -98,8 +98,9 @@ GLimp_Shutdown
void GLimp_Shutdown( void )
{
ri.IN_Shutdown();
-
+#ifndef __HAIKU__
SDL_QuitSubSystem( SDL_INIT_VIDEO );
+#endif
screen = NULL;
}
--
2.26.0
From e01e6b0ac9f02e88761d4162f29502d302975754 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 21 May 2020 23:22:15 +1000
Subject: Add fake fullscreen mode
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c
index 92632e8..2398582 100644
--- a/code/sdl/sdl_glimp.c
+++ b/code/sdl/sdl_glimp.c
@@ -58,6 +58,11 @@ float tvAspectW; // leilei - for aspect correction
//int vresWidth;
//int vresHeight;
+#ifdef __HAIKU__
+static int lastWinWidth = -1;
+static int lastWinHeight = -1;
+#endif
+
typedef enum
{
@@ -281,6 +286,34 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
}
ri.Printf( PRINT_ALL, " %d %d\n", glConfig.vidWidth, glConfig.vidHeight);
+#ifdef __HAIKU__
+ // Use fake fullscreen mode for Haiku
+ if (fullscreen)
+ {
+ flags |= SDL_NOFRAME;
+ glConfig.isFullscreen = qfalse;
+ glConfig.vidWidth = videoInfo->current_w;
+ glConfig.vidHeight = videoInfo->current_h;
+ glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight;
+ }
+ else
+ {
+ if (noborder)
+ flags |= SDL_NOFRAME;
+ if (lastWinWidth <= 0 || lastWinHeight <= 0) {
+ lastWinWidth = glConfig.vidWidth;
+ lastWinHeight = glConfig.vidHeight;
+ }
+ if (lastWinWidth >= videoInfo->current_w || lastWinHeight >= videoInfo->current_h) {
+ lastWinWidth = 800;
+ lastWinHeight = 600;
+ }
+ glConfig.vidWidth = lastWinWidth;
+ glConfig.vidHeight = lastWinHeight;
+ glConfig.isFullscreen = qfalse;
+ glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight;
+ }
+#else
if (fullscreen)
{
flags |= SDL_FULLSCREEN;
@@ -293,6 +326,7 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
glConfig.isFullscreen = qfalse;
}
+#endif
colorbits = r_colorbits->value;
if ((!colorbits) || (colorbits >= 32))
@@ -446,8 +480,11 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
SDL_WM_SetCaption(CLIENT_WINDOW_TITLE, CLIENT_WINDOW_MIN_TITLE);
SDL_ShowCursor(0);
-
+#ifdef __HAIKU__
+ if (!(vidscreen = SDL_SetVideoMode(glConfig.vidWidth + 1, glConfig.vidHeight + 1, colorbits, flags)))
+#else
if (!(vidscreen = SDL_SetVideoMode(glConfig.vidWidth, glConfig.vidHeight, colorbits, flags)))
+#endif
{
ri.Printf( PRINT_DEVELOPER, "SDL_SetVideoMode failed: %s\n", SDL_GetError( ) );
continue;
@@ -788,7 +825,11 @@ void GLimp_Init( void )
r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
r_sdlDriver = ri.Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE | CVAR_LATCH );
+#ifdef __HAIKU__
+ r_centerWindow = ri.Cvar_Get( "r_centerWindow", "1", CVAR_ARCHIVE | CVAR_LATCH );
+#else
r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE | CVAR_LATCH );
+#endif
// leilei - tv mode hack
r_tvMode = ri.Cvar_Get( "r_virtualMode", "-1", CVAR_LATCH | CVAR_ARCHIVE );
r_tvModeAspect = ri.Cvar_Get( "r_tvModeAspect", "0", CVAR_LATCH | CVAR_ARCHIVE ); // yes
@@ -905,7 +946,11 @@ void GLimp_EndFrame( void )
qboolean needToToggle = qtrue;
qboolean sdlToggled = qfalse;
SDL_Surface *s = SDL_GetVideoSurface( );
-
+#ifdef __HAIKU__
+ // Don't set real fullscren mode for Haiku (only restart)
+ ri.Cmd_ExecuteText(EXEC_APPEND, "vid_restart\n");
+ ri.IN_Restart( );
+#else
if( s )
{
// Find out the current state
@@ -933,7 +978,7 @@ void GLimp_EndFrame( void )
ri.IN_Restart( );
}
-
+#endif
r_fullscreen->modified = qfalse;
}
}
--
2.26.0
From cf8f58eca19a9347f0b406efda80a7fc4492d84c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 21 May 2020 23:34:03 +1000
Subject: Resolve symlink for argv[0]
diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c
index cfaab69..86724ed 100644
--- a/code/sys/sys_main.c
+++ b/code/sys/sys_main.c
@@ -591,6 +591,12 @@ int main( int argc, char **argv )
int i;
char commandLine[ MAX_STRING_CHARS ] = { 0 };
+#ifdef __HAIKU__
+ char *binpath = realpath(argv[0], NULL);
+ if (binpath != NULL)
+ argv[0] = binpath;
+#endif
+
#ifndef DEDICATED
// SDL version check
--
2.26.0