Compare commits

..

1 Commits

Author SHA1 Message Date
Alibek Omarov
3f81af50af engine: platform: allow querying window type through R_GetWindowHandle 2025-05-24 21:28:09 +05:00
29 changed files with 682 additions and 229 deletions

View File

@@ -75,8 +75,13 @@ def configure(conf):
conf.fatal('Can\'t find libbacktrace submodule. Run `git submodule update --init --recursive`.')
return
conf.define('BACKTRACE_ELF_SIZE', 64 if conf.env.DEST_SIZEOF_VOID_P == 8 else 32)
conf.define('BACKTRACE_XCOFF_SIZE', 64 if conf.env.DEST_SIZEOF_VOID_P == 8 else 32)
if conf.env.DEST_SIZEOF_VOID_P == 8:
conf.define('BACKTRACE_ELF_SIZE', 64)
conf.define('BACKTRACE_XCOFF_SIZE', 64)
else:
conf.define('BACKTRACE_ELF_SIZE', 32)
conf.define('BACKTRACE_XCOFF_SIZE', 32)
conf.define('_ALL_SOURCE', 1)
conf.define('_GNU_SOURCE', 1)
conf.define('_POSIX_PTHREAD_SEMANTICS', 1)

View File

@@ -45,8 +45,3 @@
Tags can be any: subsystem, simple feature name or even just a filename, without extension.
Just keep them always same, it helps keep history clean and commit messages short.
## LLM-based tools usage.
While we wouldn't recommend using any LLM-based (also misleadingly called AI) tools, we understand that they are here to stay.
Whether you're reporting bug or contributing the code, you take complete authorship and responsibility over provided content and the same rules will apply to you as for everybody else, so validate the bug report or the patch before sending it.

View File

@@ -3462,10 +3462,10 @@ static void CL_InitLocal( void )
Cmd_AddRestrictedCommand ("userinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of setinfo)" );
Cmd_AddCommand ("physinfo", CL_Physinfo_f, "print current client physinfo" );
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "disconnect from server" );
Cmd_AddRestrictedCommand( "record", CL_Record_f, "record a demo" );
Cmd_AddCommand ("record", CL_Record_f, "record a demo" );
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "play a demo" );
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "demo benchmark" );
Cmd_AddRestrictedCommand( "killdemo", CL_DeleteDemo_f, "delete a specified demo file" );
Cmd_AddCommand ("killdemo", CL_DeleteDemo_f, "delete a specified demo file" );
Cmd_AddCommand ("startdemos", CL_StartDemos_f, "start playing back the selected demos sequentially" );
Cmd_AddCommand ("demos", CL_Demos_f, "restart looping demos defined by the last startdemos command" );
Cmd_AddCommand ("movie", CL_PlayVideo_f, "play a movie" );

View File

@@ -102,14 +102,12 @@ BaseCmd_Find
Find every type of base command and write into arguments
============
*/
void BaseCmd_FindAll( const char *name, cmd_t **cmd, cmdalias_t **alias, convar_t **cvar )
void BaseCmd_FindAll( const char *name, base_command_t **cmd, base_command_t **alias, base_command_t **cvar )
{
base_command_hashmap_t *base = BaseCmd_GetBucket( name );
base_command_hashmap_t *i = base;
*cmd = NULL;
*alias = NULL;
*cvar = NULL;
*cmd = *alias = *cvar = NULL;
for( ; i; i = i->next )
{
@@ -124,13 +122,13 @@ void BaseCmd_FindAll( const char *name, cmd_t **cmd, cmdalias_t **alias, convar_
switch( i->type )
{
case HM_CMD:
*cmd = (cmd_t *)i->basecmd;
*cmd = i->basecmd;
break;
case HM_CMDALIAS:
*alias = (cmdalias_t *)i->basecmd;
*alias = i->basecmd;
break;
case HM_CVAR:
*cvar = (convar_t *)i->basecmd;
*cvar = i->basecmd;
break;
default:
break;

View File

@@ -21,9 +21,6 @@ GNU General Public License for more details.
#ifdef XASH_HASHED_VARS
#include "common.h"
#include "cdll_int.h"
typedef enum base_command_type
{
HM_DONTCARE = 0,
@@ -37,7 +34,8 @@ typedef void base_command_t;
void BaseCmd_Init( void );
void BaseCmd_Shutdown( void );
base_command_t *BaseCmd_Find( base_command_type_e type, const char *name );
void BaseCmd_FindAll( const char *name, cmd_t **cmd, cmdalias_t **alias, convar_t **cvar );
void BaseCmd_FindAll( const char *name,
base_command_t **cmd, base_command_t **alias, base_command_t **cvar );
void BaseCmd_Insert ( base_command_type_e type, base_command_t *basecmd, const char *name );
void BaseCmd_Remove ( base_command_type_e type, const char *name );
void BaseCmd_Stats_f( void ); // to be registered later

View File

@@ -526,17 +526,51 @@ static void Cmd_UnAlias_f ( void )
*/
struct cmd_s
{
cmd_t *next;
char *name;
xcommand_t function;
int flags;
char desc[];
struct cmd_s *next;
char *name;
xcommand_t function;
int flags;
char desc[];
};
int cmd_argc;
const char *cmd_args = NULL;
char *cmd_argv[MAX_CMD_TOKENS];
static cmd_t *cmd_functions; // possible commands to execute
static int cmd_argc;
static const char *cmd_args = NULL;
static char *cmd_argv[MAX_CMD_TOKENS];
static cmd_t *cmd_functions; // possible commands to execute
/*
============
Cmd_Argc
============
*/
int GAME_EXPORT Cmd_Argc( void )
{
return cmd_argc;
}
/*
============
Cmd_Argv
============
*/
const char *GAME_EXPORT Cmd_Argv( int arg )
{
if((uint)arg >= cmd_argc )
return "";
return cmd_argv[arg];
}
/*
============
Cmd_Args
============
*/
const char *GAME_EXPORT Cmd_Args( void )
{
return cmd_args;
}
/*
===========================
@@ -544,6 +578,8 @@ Client exports
===========================
*/
/*
============
Cmd_AliasGetList
@@ -958,20 +994,24 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr
if( !Cmd_Argc( )) return; // no tokens
#if defined( XASH_HASHED_VARS )
BaseCmd_FindAll( cmd_argv[0], &cmd, &a, &cvar );
#if defined(XASH_HASHED_VARS)
BaseCmd_FindAll( cmd_argv[0],
(base_command_t**)&cmd,
(base_command_t**)&a,
(base_command_t**)&cvar );
#endif
if( !host.apply_game_config )
{
#if !defined( XASH_HASHED_VARS )
// check aliases
for( a = cmd_alias; a; a = a->next )
if( !a ) // if not found in basecmd
{
if( !Q_stricmp( cmd_argv[0], a->name ))
break;
for( a = cmd_alias; a; a = a->next )
{
if( !Q_stricmp( cmd_argv[0], a->name ))
break;
}
}
#endif
if( a )
{
@@ -986,13 +1026,14 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr
// special mode for restore game.dll archived cvars
if( !host.apply_game_config || !Q_strcmp( cmd_argv[0], "exec" ))
{
#if !defined( XASH_HASHED_VARS )
for( cmd = cmd_functions; cmd; cmd = cmd->next )
if( !cmd || !cmd->function ) // if not found in basecmd
{
if( !Q_stricmp( cmd_argv[0], cmd->name ) && cmd->function )
break;
for( cmd = cmd_functions; cmd; cmd = cmd->next )
{
if( !Q_stricmp( cmd_argv[0], cmd->name ) && cmd->function )
break;
}
}
#endif
// check functions
if( cmd && cmd->function )
@@ -1257,50 +1298,6 @@ void Cmd_Null_f( void )
{
}
/*
=============
Cmd_MakePrivileged_f
=============
*/
static void Cmd_MakePrivileged_f( void )
{
const char *s = Cmd_Argv( 1 );
convar_t *cv;
cmd_t *cmd;
cmdalias_t *alias;
if( Cmd_Argc( ) != 2 )
{
Con_Printf( S_USAGE "make_privileged <cvar or command>\n" );
return;
}
#if defined( XASH_HASHED_VARS )
BaseCmd_FindAll( s, &cmd, &alias, &cv );
#else
cmd = Cmd_Exists( s );
cv = Cvar_FindVar( s );
#endif
if( !cv && !cmd )
{
Con_Printf( "Nothing was found.\n" );
return;
}
if( cv )
{
SetBits( cv->flags, FCVAR_PRIVILEGED );
Con_Printf( "Cvar %s set to be privileged\n", cv->name );
}
if( cmd )
{
SetBits( cmd->flags, CMD_PRIVILEGED );
Con_Printf( "Command %s set to be privileged\n", cmd->name );
}
}
/*
==========
Cmd_Escape
@@ -1363,8 +1360,6 @@ void Cmd_Init( void )
Cmd_AddRestrictedCommand( "if", Cmd_If_f, "compare and set condition bits" );
Cmd_AddRestrictedCommand( "else", Cmd_Else_f, "invert condition bit" );
Cmd_AddRestrictedCommand( "make_privileged", Cmd_MakePrivileged_f, "makes command or variable privileged (protected from access attempts from server)" );
#if defined(XASH_HASHED_VARS)
Cmd_AddCommand( "basecmd_stats", BaseCmd_Stats_f, "print info about basecmd usage" );
Cmd_AddCommand( "basecmd_test", BaseCmd_Test_f, "test basecmd" );

View File

@@ -422,30 +422,6 @@ void FS_CheckConfig( void );
// cmd.c
//
typedef struct cmd_s cmd_t;
static inline int GAME_EXPORT Cmd_Argc( void )
{
extern int cmd_argc;
return cmd_argc;
}
static inline const char *GAME_EXPORT RETURNS_NONNULL Cmd_Argv( int arg )
{
extern int cmd_argc;
extern char *cmd_argv[MAX_CMD_TOKENS];
if((uint)arg >= cmd_argc )
return "";
return cmd_argv[arg];
}
static inline const char *GAME_EXPORT RETURNS_NONNULL Cmd_Args( void )
{
extern const char *cmd_args;
return cmd_args;
}
void Cbuf_Clear( void );
void Cbuf_AddText( const char *text );
void Cbuf_AddTextf( const char *text, ... ) FORMAT_CHECK( 1 );
@@ -455,6 +431,9 @@ void Cbuf_InsertTextLen( const char *text, size_t len, size_t requested_len );
void Cbuf_ExecStuffCmds( void );
void Cbuf_Execute (void);
qboolean Cmd_CurrentCommandIsPrivileged( void );
int Cmd_Argc( void );
const char *Cmd_Args( void ) RETURNS_NONNULL;
const char *Cmd_Argv( int arg ) RETURNS_NONNULL;
void Cmd_Init( void );
void Cmd_Shutdown( void );
void Cmd_Unlink( int group );

View File

@@ -1030,11 +1030,9 @@ qboolean Cvar_CommandWithPrivilegeCheck( convar_t *v, qboolean isPrivileged )
return true;
}
#if !defined( XASH_HASHED_VARS )
// check variables
v = Cvar_FindVar( Cmd_Argv( 0 ));
#endif
if( !v ) // already found in basecmd
v = Cvar_FindVar( Cmd_Argv( 0 ));
if( !v )
return false;

View File

@@ -74,7 +74,7 @@ static CVAR_DEFINE_AUTO( host_gameloaded, "0", FCVAR_READ_ONLY, "inidcates a loa
static CVAR_DEFINE_AUTO( host_clientloaded, "0", FCVAR_READ_ONLY, "inidcates a loaded client.dll" );
CVAR_DEFINE_AUTO( host_limitlocal, "0", 0, "apply cl_cmdrate and rate to loopback connection" );
CVAR_DEFINE( host_maxfps, "fps_max", "72", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "host fps upper limit" );
CVAR_DEFINE_AUTO( fps_override, "0", FCVAR_FILTERABLE, "unlock higher framerate values, not supported" );
CVAR_DEFINE_AUTO( fps_override, "1", FCVAR_FILTERABLE, "unlock higher framerate values, not supported" );
static CVAR_DEFINE_AUTO( host_framerate, "0", FCVAR_FILTERABLE, "locks frame timing to this value in seconds" );
static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" );
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );

View File

@@ -52,8 +52,6 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesi
rendermode = LUMP_MASKED;
else if( Q_stristr( name, "gradient" ))
rendermode = LUMP_GRADIENT;
else if( Q_stristr( name, "texgamma" ))
rendermode = LUMP_TEXGAMMA;
else if( Q_stristr( name, "valve" ))
{
rendermode = LUMP_HALFLIFE;
@@ -189,7 +187,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, fs_offset_t filesi
Image_GetPaletteLMP( pal, LUMP_MASKED );
image.flags |= IMAGE_HAS_ALPHA|IMAGE_ONEBIT_ALPHA;
}
else Image_GetPaletteLMP( fin + pixels, LUMP_TEXGAMMA );
else Image_GetPaletteLMP( fin + pixels, LUMP_NORMAL );
}
else
{
@@ -228,7 +226,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesi
return false;
}
memcpy( &pin, buffer, sizeof( dspriteframe_t ));
memcpy( &pin, buffer, sizeof(dspriteframe_t) );
image.width = pin.width;
image.height = pin.height;

View File

@@ -133,6 +133,7 @@ typedef struct
int version; // model version
qboolean isworld;
qboolean isbsp30ext;
qboolean need_clipnode_remap; // try to fit 32-bit clipnodes into 16-bit types
} dbspmodel_t;
typedef struct
@@ -1734,19 +1735,9 @@ static void Mod_MakeHull0( model_t *mod, const dbspmodel_t *bmod )
Mod_SetupHull
=================
*/
static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, poolhandle_t mempool, int headnode, int hullnum )
static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, int headnode, int hullnum, model_t *world )
{
hull_t *hull = &mod->hulls[hullnum];
// assume no hull
hull->firstclipnode = hull->lastclipnode = 0;
hull->planes = NULL; // hull is missed
if(( headnode == -1 ) || ( hullnum != 1 && headnode == 0 ))
return; // hull missed
if( headnode >= mod->numclipnodes )
return; // ZHLT weird empty hulls
hull_t *hull = &mod->hulls[hullnum];
switch( hullnum )
{
@@ -1770,16 +1761,74 @@ static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, poolhandle_t mempool
if( VectorIsNull( hull->clip_mins ) && VectorIsNull( hull->clip_maxs ))
return; // no hull specified
// assume no hull
hull->firstclipnode = hull->lastclipnode = 0;
hull->planes = NULL; // hull is missed
if( headnode >= mod->numclipnodes )
return; // ZHLT weird empty hulls
// take a simpler route if we don't need clipnodes remapping
if( !bmod->need_clipnode_remap )
{
hull->planes = mod->planes;
// some map "optimizers" (you know who you are!) put -1 here
hull->firstclipnode = Q_max( 0, headnode );
hull->lastclipnode = mod->numclipnodes - 1;
// only allocate clipnodes array for the base model, only for first hull
if( mod == world && hullnum == 1 )
{
int i;
if( bmod->version == QBSP2_VERSION )
{
hull->clipnodes32 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes32 ) * mod->numclipnodes );
for( i = 0; i < mod->numclipnodes; i++ )
{
hull->clipnodes32[i].planenum = bmod->clipnodes_out[i].planenum;
hull->clipnodes32[i].children[0] = bmod->clipnodes_out[i].children[0];
hull->clipnodes32[i].children[1] = bmod->clipnodes_out[i].children[1];
}
}
else
{
hull->clipnodes16 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes16 ) * mod->numclipnodes );
for( i = 0; i < mod->numclipnodes; i++ )
{
hull->clipnodes16[i].planenum = bmod->clipnodes_out[i].planenum;
hull->clipnodes16[i].children[0] = bmod->clipnodes_out[i].children[0];
hull->clipnodes16[i].children[1] = bmod->clipnodes_out[i].children[1];
}
}
}
else
{
if( bmod->version == QBSP2_VERSION )
hull->clipnodes32 = world->hulls[1].clipnodes32;
else
hull->clipnodes16 = world->hulls[1].clipnodes16;
}
return;
}
if(( headnode == -1 ) || ( hullnum != 1 && headnode == 0 ))
return; // hull missed
// fit array to real count
if( bmod->version == QBSP2_VERSION )
{
CountDClipNodes_r( bmod->clipnodes_out, hull, headnode, MAX_MAP_CLIPNODES_BSP2 );
hull->clipnodes32 = Mem_Malloc( mempool, sizeof( *hull->clipnodes32 ) * hull->lastclipnode );
hull->clipnodes32 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes32 ) * hull->lastclipnode );
}
else
{
CountDClipNodes_r( bmod->clipnodes_out, hull, headnode, MAX_MAP_CLIPNODES_HLBSP );
hull->clipnodes16 = Mem_Malloc( mempool, sizeof( *hull->clipnodes16 ) * hull->lastclipnode );
hull->clipnodes16 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes16 ) * hull->lastclipnode );
}
hull->planes = mod->planes; // share planes
@@ -1864,28 +1913,19 @@ for embedded submodels
*/
static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
{
qboolean colored = false;
qboolean qbsp2 = false;
poolhandle_t mempool;
char *ents;
dmodel_t *bm;
const qboolean colored = FBitSet( mod->flags, MODEL_COLORED_LIGHTING ) ? true : false;
const qboolean qbsp2 = FBitSet( mod->flags, MODEL_QBSP2 ) ? true : false;
const char *name = mod->name;
int i, j;
ents = mod->entities;
mempool = mod->mempool;
if( FBitSet( mod->flags, MODEL_COLORED_LIGHTING ))
colored = true;
if( FBitSet( mod->flags, MODEL_QBSP2 ))
qbsp2 = true;
model_t *world = mod; // submodels might want to share hulls
int i;
mod->numframes = 2; // regular and alternate animation
// set up the submodels
for( i = 0; i < mod->numsubmodels; i++ )
{
bm = &mod->submodels[i];
dmodel_t *bm = &mod->submodels[i];
int j;
// hull 0 is just shared across all bmodels
mod->hulls[0].firstclipnode = bm->headnode[0];
@@ -1899,7 +1939,7 @@ static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
// but hulls1-3 is build individually for a each given submodel
for( j = 1; j < MAX_MAP_HULLS; j++ )
Mod_SetupHull( bmod, mod, mempool, bm->headnode[j], j );
Mod_SetupHull( bmod, mod, bm->headnode[j], j, world );
mod->firstmodelsurface = bm->firstface;
mod->nummodelsurfaces = bm->numfaces;
@@ -1920,7 +1960,7 @@ static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
char temp[MAX_VA_STRING];
Q_snprintf( temp, sizeof( temp ), "*%i", i );
Mod_FindModelOrigin( ents, temp, bm->origin );
Mod_FindModelOrigin( world->entities, temp, bm->origin );
// mark models that have origin brushes
if( !VectorIsNull( bm->origin ))
@@ -3447,7 +3487,12 @@ static void Mod_LoadClipnodes( model_t *mod, dbspmodel_t *bmod )
if(( bmod->version == QBSP2_VERSION ) || ( bmod->version == HLBSP_VERSION && bmod->isbsp30ext && bmod->numclipnodes >= MAX_MAP_CLIPNODES_HLBSP ))
{
dclipnode32_t *in = bmod->clipnodes32;
dclipnode32_t *in = bmod->clipnodes32;
// bsp30ext allows for extended total amount of clipnodes, but the limit is still 16-bit per submodel
// therefore we need to remap them
if( bmod->version == HLBSP_VERSION )
bmod->need_clipnode_remap = true;
for( i = 0; i < bmod->numclipnodes; i++, out++, in++ )
{

View File

@@ -198,7 +198,7 @@ static int HTTP_FileQueue( httpfile_t *file )
if( !( file->file = FS_Open( name, "wb+", true )))
{
Con_Printf( S_ERROR "HTTP: cannot open %s!\n", name );
Con_Printf( S_ERROR "HTTP: cannot open %s!", name );
HTTP_FreeFile( file, true );
return 0;
}

View File

@@ -314,8 +314,6 @@ typedef enum
struct vidmode_s;
typedef enum window_mode_e window_mode_t;
typedef enum ref_window_type_e ref_window_type_t;
// Window
qboolean R_Init_Video( const int type );
void R_Free_Video( void );
@@ -332,7 +330,7 @@ void *SW_LockBuffer( void );
void SW_UnlockBuffer( void );
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b );
void Platform_Minimize_f( void );
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type );
qboolean R_GetWindowHandle( void **handle, int type );
//
// in_evdev.c

View File

@@ -14,14 +14,12 @@ GNU General Public License for more details.
*/
#include <SDL.h>
#include <SDL_config.h>
#include <SDL_syswm.h>
#include "common.h"
#include "client.h"
#include "vid_common.h"
#include "platform_sdl2.h"
// include it after because it breaks definitions in net_api.h wtf
#include <SDL_syswm.h>
static vidmode_t *vidmodes = NULL;
static int num_vidmodes = 0;
static void GL_SetupAttributes( void );
@@ -376,7 +374,7 @@ static qboolean WIN_SetWindowIcon( HICON ico )
SDL_VERSION( &wminfo.version );
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE && wminfo.subsystem == SDL_SYSWM_WINDOWS )
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE && wminfo.info.subsystem == SDL_SYSWM_WINDOWS )
{
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
@@ -1183,7 +1181,7 @@ ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
if( SDL_GetWindowWMInfo( host.hWnd, &wmInfo ))
return REF_WINDOW_TYPE_NULL;
switch( wmInfo.subsystem )
switch( wmInfo.info.subsystem )
{
case SDL_SYSWM_WINDOWS:
if( !type || type == REF_WINDOW_TYPE_WIN32 )

View File

@@ -260,8 +260,6 @@ typedef struct sv_client_s
double userinfo_next_changetime;
double userinfo_penalty;
double overflow_warn_time;
client_frame_t *frames; // updates can be delta'd from here
event_state_t events; // delta-updated events cycle
} sv_client_t;

View File

@@ -3183,20 +3183,6 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
return;
}
if( NET_IsMasterAdr( from ))
{
if( !Q_strcmp( pcmd, M2S_CHALLENGE ))
{
SV_AddToMaster( from, msg );
}
else if( !Q_strcmp( pcmd, M2S_NAT_CONNECT ))
{
SV_ConnectNatClient( from );
}
return;
}
if( !Q_strcmp( pcmd, A2S_GOLDSRC_INFO ) || pcmd[0] == A2S_GOLDSRC_PLAYERS || pcmd[0] == A2S_GOLDSRC_RULES )
{
SV_SourceQuery_HandleConnnectionlessPacket( pcmd, from );
@@ -3209,6 +3195,14 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
{
SV_Info( from, Q_atoi( Cmd_Argv( 1 )));
}
else if( !Q_strcmp( pcmd, M2S_CHALLENGE ))
{
SV_AddToMaster( from, msg );
}
else if( !Q_strcmp( pcmd, M2S_NAT_CONNECT ))
{
SV_ConnectNatClient( from );
}
else if( !Q_strcmp( pcmd, C2S_BANDWIDTHTEST ))
{
SV_TestBandWidth( from );

View File

@@ -707,11 +707,7 @@ static void SV_SendClientDatagram( sv_client_t *cl )
{
if( MSG_GetNumBytesWritten( &cl->datagram ) < MSG_GetNumBytesLeft( &msg ))
MSG_WriteBits( &msg, MSG_GetData( &cl->datagram ), MSG_GetNumBitsWritten( &cl->datagram ));
else if( host.realtime > cl->overflow_warn_time )
{
Con_DPrintf( S_WARN "Ignoring unreliable datagram for %s, would overflow on msg\n", cl->name );
cl->overflow_warn_time = host.realtime + 5.0f;
}
else Con_DPrintf( S_WARN "Ignoring unreliable datagram for %s, would overflow on msg\n", cl->name );
}
MSG_Clear( &cl->datagram );

View File

@@ -733,7 +733,13 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
if( !NET_GetMaster( from, &heartbeat_challenge, &last_heartbeat ))
{
Con_Reportf( S_WARN "unexpected master server info query packet from %s\n", NET_AdrToString( from ));
Con_Printf( S_WARN "unexpected master server info query packet from %s\n", NET_AdrToString( from ));
return;
}
if( last_heartbeat + sv_master_response_timeout.value < host.realtime )
{
Con_Printf( S_WARN "unexpected master server info query packet (too late? try increasing sv_master_response_timeout value)\n");
return;
}
@@ -742,13 +748,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
if( challenge2 != heartbeat_challenge )
{
Con_Reportf( S_WARN "unexpected master server info query packet (wrong challenge!)\n" );
return;
}
if( last_heartbeat + sv_master_response_timeout.value < host.realtime )
{
Con_Printf( S_WARN "unexpected master server info query packet (too late? try increasing sv_master_response_timeout value)\n");
Con_Printf( S_WARN "unexpected master server info query packet (wrong challenge!)\n" );
return;
}

View File

@@ -24,6 +24,9 @@ def options(opt):
grp.add_option('--enable-fbdev', action = 'store_true', dest = 'FBDEV_SW', default = False,
help = 'build fbdev-only software-only engine')
grp.add_option('--disable-async-resolve', action = 'store_true', dest = 'NO_ASYNC_RESOLVE', default = False,
help = 'disable multithreaded operations(asynchronous name resolution)')
grp.add_option('--enable-custom-swap', action = 'store_true', dest = 'CUSTOM_SWAP', default = False,
help = 'enable custom swap allocator. For devices with no swap support')
@@ -60,8 +63,6 @@ def find_sdl(conf):
conf.env.XASH_SDL = 2
def configure(conf):
have_async_resolve = True
# Common dependencies, will be linked to both dedicated server and client
if conf.env.DEST_OS == 'linux':
conf.check_cc(lib='rt')
@@ -71,13 +72,13 @@ def configure(conf):
conf.env.LIB_HAIKU = ['network']
conf.env.LIBPATH_HAIKU = ['/boot/system/lib']
elif conf.env.DEST_OS == 'wasi':
have_async_resolve = False
conf.options.NO_ASYNC_RESOLVE = True
conf.env.CFLAGS += ['-mllvm', '-wasm-enable-sjlj']
elif conf.env.DEST_OS == 'sunos':
conf.check_cc(lib='socket')
elif conf.env.DEST_OS == 'dos':
conf.options.STATIC = True
have_async_resolve = False
conf.options.NO_ASYNC_RESOLVE = True
if conf.options.ENGINE_FUZZ:
conf.env.append_unique('CFLAGS', '-fsanitize=fuzzer-no-link')
@@ -104,7 +105,6 @@ def configure(conf):
elif conf.options.SDL12: # TODO: move to sdl2.py
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL1')
conf.env.XASH_SDL = 1
have_async_resolve = False
conf.env.HAVE_SDL1 = True
else:
find_sdl(conf)
@@ -114,7 +114,7 @@ def configure(conf):
conf.env.STATIC = True
conf.define('XASH_NO_LIBDL', 1)
if not conf.env.DEST_OS in ['win32', 'android'] and have_async_resolve:
if not conf.env.DEST_OS in ['win32', 'android'] and not conf.options.NO_ASYNC_RESOLVE:
conf.check_pthreads(mode='c')
if hasattr(conf.options, 'DLLEMU'):
@@ -126,7 +126,7 @@ def configure(conf):
conf.define_cond('XASH_ENGINE_TESTS', conf.options.ENGINE_TESTS)
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', not have_async_resolve)
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', conf.options.NO_ASYNC_RESOLVE)
conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1
for refdll in conf.refdlls:

View File

@@ -195,7 +195,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
pal = gEngfuncs.FS_LoadImage( "#masked.pal", src, pal_bytes );
break;
default:
pal = gEngfuncs.FS_LoadImage( "#texgamma.pal", src, pal_bytes );
pal = gEngfuncs.FS_LoadImage( "#normal.pal", src, pal_bytes );
break;
}

View File

@@ -181,7 +181,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
pal = gEngfuncs.FS_LoadImage( "#masked.pal", src, pal_bytes );
break;
default:
pal = gEngfuncs.FS_LoadImage( "#texgamma.pal", src, pal_bytes );
pal = gEngfuncs.FS_LoadImage( "#normal.pal", src, pal_bytes );
break;
}

432
scripts/waifulib/cmake.py Normal file
View File

@@ -0,0 +1,432 @@
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed under The MIT License (MIT)
# Copyright (c) 2016, Michel Mooij
# Copyright (c) 2023, Velaron
'''
Summary
-------
Generate *cmake* files of all C/C++ programs, static- and shared libraries
that have been defined within a *waf* build environment.
Once exported to *cmake*, all exported (C/C++) tasks can be build without
any further need for, or dependency, to the *waf* build system itself.
**cmake** is an open source cross-platform build system designed to build, test
and package software. It is available for all major Desktop Operating Systems
(MS Windows, all major Linux distributions and Macintosh OS-X).
See http://www.cmake.org for a more detailed description on how to install
and use it for your particular Desktop environment.
Description
-----------
When exporting *waf* project data, a single top level **CMakeLists.txt** file
will be exported in the top level directory of your *waf* build environment.
This *cmake* build file will contain references to all exported *cmake*
build files of each individual C/C++ build task. It will also contain generic
variables and settings (e.g compiler to use, global preprocessor defines, link
options and so on).
Example below presents an overview of an environment in which *cmake*
build files already have been exported::
.
├── components
│ └── clib
│ ├── program
│ │ ├── CMakeLists.txt
│ │ └── wscript
│ ├── shared
│ │ ├── CMakeLists.txt
│ │ └── wscript
│ └── static
│ ├── CMakeLists.txt
│ └── wscript
├── CMakeLists.txt
└── wscript
Usage
-----
Tasks can be exported to *cmake* using the command, as shown in the
example below::
$ waf cmake
All exported *cmake* build files can be removed in 'one go' using the *cmake*
*cleanup* option::
$ waf cmake --cmake-clean
Tasks generators to be excluded can be marked with the *skipme* option
as shown below::
def build(bld):
bld.program(name='foo', src='foobar.c', cmake_skip=True)
'''
from waflib.Build import BuildContext
from waflib import Utils, Logs, Context, Errors, TaskGen
def get_deps(bld, target):
'''Returns a list of (nested) targets on which this target depends.
:param bld: a *waf* build instance from the top level *wscript*
:type bld: waflib.Build.BuildContext
:param target: task name for which the dependencies should be returned
:type target: str
:returns: a list of task names on which the given target depends
'''
try:
tgen = bld.get_tgen_by_name(target)
except Errors.WafError:
return []
else:
uses = Utils.to_list(getattr(tgen, 'use', []))
deps = uses[:]
for use in uses:
deps += get_deps(bld, use)
return list(set(deps))
def get_tgens(bld, names):
'''Returns a list of task generators based on the given list of task
generator names.
:param bld: a *waf* build instance from the top level *wscript*
:type bld: waflib.Build.BuildContext
:param names: list of task generator names
:type names: list of str
:returns: list of task generators
'''
tgens = []
for name in names:
try:
tgen = bld.get_tgen_by_name(name)
except Errors.WafError:
pass
else:
tgens.append(tgen)
return list(set(tgens))
def get_targets(bld):
'''Returns a list of user specified build targets or None if no specific
build targets has been selected using the *--targets=* command line option.
:param bld: a *waf* build instance from the top level *wscript*.
:type bld: waflib.Build.BuildContext
:returns: a list of user specified target names (using --targets=x,y,z) or None
'''
if bld.targets == '':
return None
targets = bld.targets.split(',')
for target in targets:
targets += get_deps(bld, target)
return targets
def options(opt):
'''Adds command line options for the CMake *waftool*.
:param opt: Options context from the *waf* build environment.
:type opt: waflib.Options.OptionsContext
'''
opt.add_option('--cmake', dest='cmake', default=False, action='store_true', help='select cmake for export/import actions')
opt.add_option('--cmake-clean', dest='cmake_clean', default=False, action='store_true', help='delete exported cmake files')
def configure(conf):
'''Method that will be invoked by *waf* when configuring the build
environment.
:param conf: Configuration context from the *waf* build environment.
:type conf: waflib.Configure.ConfigurationContext
'''
conf.find_program('cmake', var='CMAKE', mandatory=False)
class CMakeContext(BuildContext):
'''export C/C++ tasks to CMake.'''
cmd = 'cmake'
def execute(self):
'''Will be invoked when issuing the *cmake* command.'''
self.restore()
if not self.all_envs:
self.load_envs()
self.recurse([self.run_dir])
self.pre_build()
for group in self.groups:
for tgen in group:
try:
f = tgen.post
except AttributeError:
pass
else:
f()
try:
self.get_tgen_by_name('')
except Exception:
pass
self.cmake = True
if self.options.cmake_clean:
cleanup(self)
else:
export(self)
self.timer = Utils.Timer()
def export(bld):
'''Exports all C and C++ task generators to cmake.
:param bld: a *waf* build instance from the top level *wscript*.
:type bld: waflib.Build.BuildContext
'''
if not bld.options.cmake and not hasattr(bld, 'cmake'):
return
cmakes = {}
loc = bld.path.relpath().replace('\\', '/')
top = CMake(bld, loc)
cmakes[loc] = top
targets = get_targets(bld)
for tgen in bld.task_gen_cache_names.values():
if targets and tgen.get_name() not in targets:
continue
if getattr(tgen, 'cmake_skip', False):
continue
if set(('c', 'cxx', 'subst')) & set(getattr(tgen, 'features', [])):
loc = tgen.path.relpath().replace('\\', '/')
if loc not in cmakes:
cmake = CMake(bld, loc)
cmakes[loc] = cmake
top.add_child(cmake)
cmakes[loc].add_tgen(tgen)
for cmake in cmakes.values():
cmake.export()
@TaskGen.feature('subst')
@TaskGen.before_method('process_subst')
def backup_sources(self):
# process_subst removes source list to avoid further processing but we need it
self.srces = self.to_nodes(self.source)
def cleanup(bld):
'''Removes all generated makefiles from the *waf* build environment.
:param bld: a *waf* build instance from the top level *wscript*.
:type bld: waflib.Build.BuildContext
'''
if not bld.options.cmake_clean:
return
loc = bld.path.relpath().replace('\\', '/')
CMake(bld, loc).cleanup()
targets = get_targets(bld)
for tgen in bld.task_gen_cache_names.values():
if targets and tgen.get_name() not in targets:
continue
if getattr(tgen, 'cmake_skip', False):
continue
if set(('c', 'cxx', 'subst')) & set(getattr(tgen, 'features', [])):
loc = tgen.path.relpath().replace('\\', '/')
CMake(bld, loc).cleanup()
class CMake(object):
def __init__(self, bld, location):
self.bld = bld
self.location = location
self.cmakes = []
self.tgens = []
def export(self):
content = self.get_content()
if not content:
return
node = self.make_node()
if not node:
return
node.write(content)
Logs.pprint('YELLOW', 'exported: %s' % node.abspath())
def cleanup(self):
node = self.find_node()
if node:
node.delete()
Logs.pprint('YELLOW', 'removed: %s' % node.abspath())
def add_child(self, cmake):
self.cmakes.append(cmake)
def add_tgen(self, tgen):
self.tgens.append(tgen)
def get_location(self):
return self.location
def get_fname(self):
name = '%s/CMakeLists.txt' % (self.location)
return name
def find_node(self):
name = self.get_fname()
if not name:
return None
return self.bld.srcnode.find_node(name)
def make_node(self):
name = self.get_fname()
if not name:
return None
return self.bld.srcnode.make_node(name)
def get_content(self):
is_top = (self.location == self.bld.path.relpath())
content = ''
if is_top:
content += 'cmake_minimum_required(VERSION 3.5)\n'
content += 'project(%s)\n' % (getattr(Context.g_module, Context.APPNAME))
content += '\n'
env = self.bld.env
defines = env.DEFINES
if len(defines):
content += 'add_definitions(\n -D%s\n)\n' % (
'\n -D'.join(defines))
content += '\n'
flags = env.CFLAGS
if len(flags):
# remove -MMD flag from gccdeps.py as it's already inserted by CMake
flags = [f for f in flags if not f == '-MMD']
content += 'set(CMAKE_C_FLAGS "%s")\n' % (' '.join(flags))
flags = env.CXXFLAGS
if len(flags):
flags = [f for f in flags if not f == '-MMD']
content += 'set(CMAKE_CXX_FLAGS "%s")\n' % (' '.join(flags))
if len(self.tgens):
content += '\n'
for tgen in self.tgens:
content += self.get_tgen_content(tgen)
if len(self.cmakes):
content += '\n'
for cmake in self.cmakes:
content += 'add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/%s)\n' % (cmake.get_location())
return content
def get_tgen_content(self, tgen):
content = ''
name = tgen.get_name()
# this only covers simple subst case when we have
# direct source and target files
if 'subst' in tgen.features:
if getattr(tgen, 'subst_fun', None):
return
encoding = getattr(tgen, 'encoding', 'latin-1')
re_m4 = getattr(tgen, 're_m4', TaskGen.re_m4)
targets = Utils.to_list(tgen.target)
for x, y in zip(tgen.srces, targets):
code = x.read(encoding=encoding)
matches = re_m4.findall(code)
for var in matches:
p = getattr(tgen, var, None)
if p is not None:
content += 'set(%s \"%s\")\n' % (var, p)
content += 'configure_file(%s %s @ONLY)\n\n' % (x.path_from(tgen.path).replace('\\', '/'), y)
return content
content += 'set(%s_SRC' % (name.upper())
for src in tgen.source:
content += '\n %s' % (src.path_from(tgen.path).replace('\\', '/'))
content += '\n)\n\n'
includes = self.get_includes(tgen)
# includes.extend(tgen.env.INCLUDES)
if len(includes):
content += 'set(%s_INCLUDES' % (name.upper())
for include in includes:
content += '\n ${CMAKE_CURRENT_BINARY_DIR}/%s %s' % (include, include)
content += '\n)\n\n'
content += 'include_directories(${%s_INCLUDES})\n' % (name.upper())
link_dirs = getattr(tgen.env, 'LIBPATH', [])
if len(link_dirs):
content += '\nlink_directories('
for dir in link_dirs:
content += '\n \"%s\"' % dir.replace('\\', '/')
content += '\n)\n\n'
if set(('cprogram', 'cxxprogram')) & set(tgen.features):
if tgen.env.DEST_OS == 'win32':
content += 'add_executable(%s WIN32 ${%s_SRC})\n' % (name, name.upper())
else:
content += 'add_executable(%s ${%s_SRC})\n' % (name, name.upper())
elif set(('cshlib', 'cxxshlib')) & set(tgen.features):
content += 'add_library(%s SHARED ${%s_SRC})\n\n' % (
name, name.upper())
else: # cstlib, cxxstlib or objects
content += 'add_library(%s ${%s_SRC})\n\n' % (name, name.upper())
defines = self.get_genlist(tgen, 'defines')
defines.extend(tgen.env.DEFINES)
if len(defines):
content += 'target_compile_definitions(%s PRIVATE\n -D%s\n)\n' % (
name, '\n -D'.join(defines))
content += '\n'
libs = getattr(tgen.env, 'LIB', [])
libs.extend(tgen.env.STLIB)
if len(libs):
content += '\n'
content += 'target_link_libraries(%s\n %s)\n' % (name, '\n '.join(libs))
content += '\n'
return content
def get_includes(self, tgen):
'''returns the include paths for the given task generator.
'''
includes = self.get_genlist(tgen, 'includes')
for use in getattr(tgen, 'use', []):
key = 'INCLUDES_%s' % use
try:
tg = self.bld.get_tgen_by_name(use)
if 'fake_lib' in tg.features:
if key in tgen.env:
includes.extend([l.replace('\\', '/')
for l in tgen.env[key]])
except Errors.WafError:
if key in tgen.env:
includes.extend([l.replace('\\', '/')
for l in tgen.env[key]])
return includes
def get_genlist(self, tgen, name):
lst = Utils.to_list(getattr(tgen, name, []))
lst = [str(l.path_from(tgen.path)) if hasattr(
l, 'path_from') else l for l in lst]
return [l.replace('\\', '/') for l in lst]

View File

@@ -267,7 +267,9 @@ def get_optimization_flags(conf):
if conf.env.COMPILER_CC in ['gcc', 'clang'] and conf.env.DEST_OS not in ['android']:
# HLSDK by default compiles with these options under Linux
# no reason for us to not do the same
if conf.env.DEST_CPU == 'x86':
# TODO: fix DEST_CPU in force 32 bit mode
if conf.env.DEST_CPU == 'x86' or (conf.env.DEST_CPU == 'x86_64' and conf.env.DEST_SIZEOF_VOID_P == 4):
cflags.append('-march=pentium-m')
cflags.append('-mtune=core2')

View File

@@ -28,12 +28,16 @@ def options(opt):
@conf
def check_vgui(conf):
if conf.env.DEST_CPU == 'x86' or (conf.env.DEST_CPU == 'x86_64' and conf.env.DEST_SIZEOF_VOID_P == 4):
vgui_dest_cpu = 'x86' # link with 32-bit binary when crosscompiling to 32-bit
else: vgui_dest_cpu = conf.env.DEST_CPU
if not conf.options.ENABLE_UNSUPPORTED_VGUI:
conf.start_msg('Does this architecture support VGUI?')
if conf.env.DEST_CPU != 'x86':
if vgui_dest_cpu != 'x86':
conf.end_msg('no')
Logs.warn('vgui is not supported on this CPU: ' + str(conf.env.DEST_CPU))
Logs.warn('vgui is not supported on this CPU: ' + str(vgui_dest_cpu))
return False
else: conf.end_msg('yes')
@@ -60,25 +64,25 @@ def check_vgui(conf):
if conf.env.DEST_OS == 'win32':
conf.env.LIB_VGUI = ['vgui']
libpath = os.path.join(libpath, 'win32_vc6')
if conf.env.DEST_CPU != 'x86':
if vgui_dest_cpu != 'x86':
# for 32-bit x86 it's expected to be under win32_vc6
# for others, it's expected to be under win32_vc6 subdirectory matching CPU arch (x86_64 for 64-bit CPUs)
libpath = os.path.join(libpath, conf.env.DEST_CPU)
libpath = os.path.join(libpath, vgui_dest_cpu)
conf.env.LIBPATH_VGUI = [libpath]
elif conf.env.DEST_OS == 'linux':
conf.env.LIB_VGUI = [':vgui.so']
if conf.env.DEST_CPU != 'x86':
libpath = os.path.join(libpath, conf.env.DEST_CPU)
if vgui_dest_cpu != 'x86':
libpath = os.path.join(libpath, vgui_dest_cpu)
conf.env.LIBPATH_VGUI = [libpath]
elif conf.env.DEST_OS == 'darwin':
if conf.env.DEST_CPU != 'x86':
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, conf.env.DEST_CPU, 'vgui.dylib')]
if vgui_dest_cpu != 'x86':
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, vgui_dest_cpu, 'vgui.dylib')]
else:
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, 'vgui.dylib')]
else:
# TODO: figure out what to do here
conf.env.LIB_VGUI = ['vgui']
conf.env.LIBPATH_VGUI = [os.path.join(libpath, conf.env.DEST_OS, conf.env.DEST_CPU)]
conf.env.LIBPATH_VGUI = [os.path.join(libpath, conf.env.DEST_OS, vgui_dest_cpu)]
conf.env.INCLUDES_VGUI = [os.path.abspath(os.path.join(vgui_dev, 'include'))]

10
waf vendored

File diff suppressed because one or more lines are too long

44
wscript
View File

@@ -128,7 +128,7 @@ REFDLLS = [
]
def options(opt):
opt.load('reconfigure compiler_optimizations xshlib xcompile compiler_cxx compiler_c sdl2 clang_compilation_database strip_on_install waf_unit_test msvs subproject')
opt.load('reconfigure compiler_optimizations xshlib xcompile compiler_cxx compiler_c sdl2 clang_compilation_database strip_on_install waf_unit_test msdev msvs subproject cmake')
grp = opt.add_option_group('Common options')
@@ -225,18 +225,20 @@ def configure(conf):
if conf.env.COMPILER_CC == 'msvc':
conf.load('msvc_pdb')
conf.load('msvs subproject clang_compilation_database strip_on_install waf_unit_test enforce_pic force_32bit')
conf.load('msvs msdev subproject clang_compilation_database strip_on_install waf_unit_test enforce_pic cmake force_32bit')
conf.env.MSVC_SUBSYSTEM = 'WINDOWS'
conf.env.CONSOLE_SUBSYSTEM = 'CONSOLE'
# Windows XP compatibility
if conf.env.MSVC_TARGETS[0] == 'amd64_x86' or conf.env.MSVC_TARGETS[0] == 'x86':
conf.env.MSVC_SUBSYSTEM += ',5.01'
conf.env.CONSOLE_SUBSYSTEM += ',5.01'
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
conf.env.CONSOLE_SUBSYSTEM = 'CONSOLE,5.01'
else:
conf.env.MSVC_SUBSYSTEM = 'WINDOWS'
conf.env.CONSOLE_SUBSYSTEM = 'CONSOLE'
# Set default options for some platforms
enforce_pic = True # modern defaults
# modify options dictionary early
if conf.env.DEST_OS == 'android':
conf.options.NO_VGUI = True # skip vgui
conf.options.NANOGL = True
conf.options.GLWES = False # deprecated
conf.options.GL4ES = True
@@ -244,12 +246,25 @@ def configure(conf):
conf.options.GL = False
elif conf.env.MAGX:
conf.options.SDL12 = True
conf.options.NO_VGUI = True
conf.options.GL = False
conf.options.LOW_MEMORY = 1
conf.options.NO_ASYNC_RESOLVE = True
enforce_pic = False
elif conf.env.DEST_OS == 'nswitch':
conf.options.NO_VGUI = True
conf.options.GL = True
conf.options.USE_STBTT = True
elif conf.env.DEST_OS == 'psvita':
conf.options.NO_VGUI = True
conf.options.GL = True
conf.options.USE_STBTT = True
# we'll specify -fPIC by hand for shared libraries only
enforce_pic = False
if conf.env.STATIC_LINKING:
enforce_pic = False # PIC may break full static builds
# psvita needs -fPIC set manually and static builds are incompatible with -fPIC
enforce_pic = conf.env.DEST_OS != 'psvita' and not conf.env.STATIC_LINKING
conf.check_pic(enforce_pic)
# NOTE: We restrict 64-bit builds ONLY for Win/Linux running on Intel architecture
@@ -263,8 +278,13 @@ def configure(conf):
else:
force_32bit = conf.options.FORCE32
# FIXME: move this whole logic to force_32bit.py, and ensure
# DEST_SIZEOF_VOID_P is always set
if force_32bit:
conf.force_32bit()
Logs.info('WARNING: will build engine for 32-bit target')
conf.force_32bit(True)
else:
conf.env.DEST_SIZEOF_VOID_P = 4 if conf.check_32bit() else 8
cflags, linkflags = conf.get_optimization_flags()
cxxflags = list(cflags) # optimization flags are common between C and C++ but we need a copy