mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-12 13:12:07 +00:00
* (bug 3610) Server sending unnecessary newline with SV_ConSay_F (Tyler Schwend
<TylerSchwend@gmail.com>) * (bug 3623) COMMAND is mapped to the ALT key (Matthias <Kapffer@macbay.de>) * (bug 3665) Typo error in FS_FOpenFileByMode function (TsT <tst2006@gmail.com>) * (bug 3669) Some files left out of Solaris Packages (Vincent Cojot <vincent@cojot.name>) * (bug 3680) server quit messages (Ben Millwood) * (bug 3682) Maps with >1024 models cause a segfault (misantropia <bnoordhuis@gmail.com>) * (bug 3683) R_FindShader(): negative lightmap indexes cause stray pointers (misantropia <bnoordhuis@gmail.com>) * (bug 3688) q3asm potential segfault fix and other changes (TsT <tst2006@gmail.com>) * (bug 3695) Not allowing to write file with lib extention (.dll/.so/...) (TsT <tst2006@gmail.com>) * (bug 3696) make-macosx-ub.sh outdated by revision 1340; test for Tiger not working (Matthias <Kapffer@macbay.de>) * (bug 3698) #error reported as warning in q3cpp (and no #warning support) (Ben Millwood) * (bug 3703) restoring the valued pre-SDL window behaviour (/dev/humancontroller <devhc97@gmail.com>)
This commit is contained in:
parent
956ce9bf12
commit
2c0861c1ce
13 changed files with 145 additions and 73 deletions
|
@ -331,8 +331,9 @@ do the apropriate things.
|
||||||
*/
|
*/
|
||||||
void Com_Quit_f( void ) {
|
void Com_Quit_f( void ) {
|
||||||
// don't try to shutdown if we are in a recursive error
|
// don't try to shutdown if we are in a recursive error
|
||||||
|
char *p = Cmd_Args( );
|
||||||
if ( !com_errorEntered ) {
|
if ( !com_errorEntered ) {
|
||||||
SV_Shutdown ("Server quit");
|
SV_Shutdown (p[0] ? p : "Server quit");
|
||||||
CL_Shutdown ();
|
CL_Shutdown ();
|
||||||
Com_Shutdown ();
|
Com_Shutdown ();
|
||||||
FS_Shutdown(qtrue);
|
FS_Shutdown(qtrue);
|
||||||
|
|
|
@ -494,6 +494,24 @@ static qboolean FS_CreatePath (char *OSPath) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
FS_FilenameIsExecutable
|
||||||
|
|
||||||
|
ERR_FATAL if trying to maniuplate a file with the platform library extension
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
static void FS_FilenameIsExecutable( const char *filename, const char *function )
|
||||||
|
{
|
||||||
|
// Check if the filename ends with the library extension
|
||||||
|
if( !Q_stricmp( filename + strlen( filename ) - strlen( DLL_EXT ), DLL_EXT ) )
|
||||||
|
{
|
||||||
|
Com_Error( ERR_FATAL, "%s: Not allowed to write '%s' due to %s extension\n",
|
||||||
|
function, filename, DLL_EXT );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
FS_CopyFile
|
FS_CopyFile
|
||||||
|
@ -508,6 +526,8 @@ static void FS_CopyFile( char *fromOSPath, char *toOSPath ) {
|
||||||
|
|
||||||
Com_Printf( "copy %s to %s\n", fromOSPath, toOSPath );
|
Com_Printf( "copy %s to %s\n", fromOSPath, toOSPath );
|
||||||
|
|
||||||
|
FS_FilenameIsExecutable( toOSPath, __FUNCTION__ );
|
||||||
|
|
||||||
if (strstr(fromOSPath, "journal.dat") || strstr(fromOSPath, "journaldata.dat")) {
|
if (strstr(fromOSPath, "journal.dat") || strstr(fromOSPath, "journaldata.dat")) {
|
||||||
Com_Printf( "Ignoring journal files\n");
|
Com_Printf( "Ignoring journal files\n");
|
||||||
return;
|
return;
|
||||||
|
@ -549,6 +569,8 @@ FS_Remove
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void FS_Remove( const char *osPath ) {
|
void FS_Remove( const char *osPath ) {
|
||||||
|
FS_FilenameIsExecutable( osPath, __FUNCTION__ );
|
||||||
|
|
||||||
remove( osPath );
|
remove( osPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,6 +581,8 @@ FS_HomeRemove
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void FS_HomeRemove( const char *homePath ) {
|
void FS_HomeRemove( const char *homePath ) {
|
||||||
|
FS_FilenameIsExecutable( homePath, __FUNCTION__ );
|
||||||
|
|
||||||
remove( FS_BuildOSPath( fs_homepath->string,
|
remove( FS_BuildOSPath( fs_homepath->string,
|
||||||
fs_gamedir, homePath ) );
|
fs_gamedir, homePath ) );
|
||||||
}
|
}
|
||||||
|
@ -636,6 +660,8 @@ fileHandle_t FS_SV_FOpenFileWrite( const char *filename ) {
|
||||||
Com_Printf( "FS_SV_FOpenFileWrite: %s\n", ospath );
|
Com_Printf( "FS_SV_FOpenFileWrite: %s\n", ospath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_FilenameIsExecutable( ospath, __FUNCTION__ );
|
||||||
|
|
||||||
if( FS_CreatePath( ospath ) ) {
|
if( FS_CreatePath( ospath ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -745,6 +771,8 @@ void FS_SV_Rename( const char *from, const char *to ) {
|
||||||
Com_Printf( "FS_SV_Rename: %s --> %s\n", from_ospath, to_ospath );
|
Com_Printf( "FS_SV_Rename: %s --> %s\n", from_ospath, to_ospath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_FilenameIsExecutable( to_ospath, __FUNCTION__ );
|
||||||
|
|
||||||
if (rename( from_ospath, to_ospath )) {
|
if (rename( from_ospath, to_ospath )) {
|
||||||
// Failed, try copying it and deleting the original
|
// Failed, try copying it and deleting the original
|
||||||
FS_CopyFile ( from_ospath, to_ospath );
|
FS_CopyFile ( from_ospath, to_ospath );
|
||||||
|
@ -777,6 +805,8 @@ void FS_Rename( const char *from, const char *to ) {
|
||||||
Com_Printf( "FS_Rename: %s --> %s\n", from_ospath, to_ospath );
|
Com_Printf( "FS_Rename: %s --> %s\n", from_ospath, to_ospath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_FilenameIsExecutable( to_ospath, __FUNCTION__ );
|
||||||
|
|
||||||
if (rename( from_ospath, to_ospath )) {
|
if (rename( from_ospath, to_ospath )) {
|
||||||
// Failed, try copying it and deleting the original
|
// Failed, try copying it and deleting the original
|
||||||
FS_CopyFile ( from_ospath, to_ospath );
|
FS_CopyFile ( from_ospath, to_ospath );
|
||||||
|
@ -838,6 +868,8 @@ fileHandle_t FS_FOpenFileWrite( const char *filename ) {
|
||||||
Com_Printf( "FS_FOpenFileWrite: %s\n", ospath );
|
Com_Printf( "FS_FOpenFileWrite: %s\n", ospath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_FilenameIsExecutable( ospath, __FUNCTION__ );
|
||||||
|
|
||||||
if( FS_CreatePath( ospath ) ) {
|
if( FS_CreatePath( ospath ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -884,6 +916,8 @@ fileHandle_t FS_FOpenFileAppend( const char *filename ) {
|
||||||
Com_Printf( "FS_FOpenFileAppend: %s\n", ospath );
|
Com_Printf( "FS_FOpenFileAppend: %s\n", ospath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_FilenameIsExecutable( ospath, __FUNCTION__ );
|
||||||
|
|
||||||
if( FS_CreatePath( ospath ) ) {
|
if( FS_CreatePath( ospath ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3397,7 +3431,7 @@ int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Com_Error( ERR_FATAL, "FSH_FOpenFile: bad mode" );
|
Com_Error( ERR_FATAL, "FS_FOpenFileByMode: bad mode" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1321,6 +1321,9 @@ static void R_LoadSubmodels( lump_t *l ) {
|
||||||
model = R_AllocModel();
|
model = R_AllocModel();
|
||||||
|
|
||||||
assert( model != NULL ); // this should never happen
|
assert( model != NULL ); // this should never happen
|
||||||
|
if ( model == NULL ) {
|
||||||
|
ri.Error(ERR_DROP, "R_LoadSubmodels: R_AllocModel() failed");
|
||||||
|
}
|
||||||
|
|
||||||
model->type = MOD_BRUSH;
|
model->type = MOD_BRUSH;
|
||||||
model->bmodel = out;
|
model->bmodel = out;
|
||||||
|
|
|
@ -322,10 +322,12 @@ typedef struct {
|
||||||
|
|
||||||
struct shaderCommands_s;
|
struct shaderCommands_s;
|
||||||
|
|
||||||
#define LIGHTMAP_2D -4 // shader is for 2D rendering
|
// any change in the LIGHTMAP_* defines here MUST be reflected in
|
||||||
#define LIGHTMAP_BY_VERTEX -3 // pre-lit triangle models
|
// R_FindShader() in tr_bsp.c
|
||||||
#define LIGHTMAP_WHITEIMAGE -2
|
#define LIGHTMAP_2D -4 // shader is for 2D rendering
|
||||||
#define LIGHTMAP_NONE -1
|
#define LIGHTMAP_BY_VERTEX -3 // pre-lit triangle models
|
||||||
|
#define LIGHTMAP_WHITEIMAGE -2
|
||||||
|
#define LIGHTMAP_NONE -1
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CT_FRONT_SIDED,
|
CT_FRONT_SIDED,
|
||||||
|
|
|
@ -1432,7 +1432,6 @@ static qboolean ParseShader( char **text )
|
||||||
// stage definition
|
// stage definition
|
||||||
else if ( token[0] == '{' )
|
else if ( token[0] == '{' )
|
||||||
{
|
{
|
||||||
// 20051019 misantropia -- fix buffer overrun.
|
|
||||||
if ( s >= MAX_SHADER_STAGES ) {
|
if ( s >= MAX_SHADER_STAGES ) {
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s\n", shader.name );
|
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s\n", shader.name );
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
@ -2447,6 +2446,10 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
|
||||||
// lightmaps
|
// lightmaps
|
||||||
if ( lightmapIndex >= 0 && lightmapIndex >= tr.numLightmaps ) {
|
if ( lightmapIndex >= 0 && lightmapIndex >= tr.numLightmaps ) {
|
||||||
lightmapIndex = LIGHTMAP_BY_VERTEX;
|
lightmapIndex = LIGHTMAP_BY_VERTEX;
|
||||||
|
} else if ( lightmapIndex < LIGHTMAP_2D ) {
|
||||||
|
// negative lightmap indexes cause stray pointers (think tr.lightmaps[lightmapIndex])
|
||||||
|
ri.Printf( PRINT_WARNING, "WARNING: shader '%s' has invalid lightmap index of %d\n", name, lightmapIndex );
|
||||||
|
lightmapIndex = LIGHTMAP_BY_VERTEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
COM_StripExtension(name, strippedName, sizeof(strippedName));
|
COM_StripExtension(name, strippedName, sizeof(strippedName));
|
||||||
|
@ -2581,7 +2584,7 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_
|
||||||
|
|
||||||
hash = generateHashValue(name, FILE_HASH_SIZE);
|
hash = generateHashValue(name, FILE_HASH_SIZE);
|
||||||
|
|
||||||
// 20051020 misantropia -- probably not necessary since this function
|
// probably not necessary since this function
|
||||||
// only gets called from tr_font.c with lightmapIndex == LIGHTMAP_2D
|
// only gets called from tr_font.c with lightmapIndex == LIGHTMAP_2D
|
||||||
// but better safe than sorry.
|
// but better safe than sorry.
|
||||||
if ( lightmapIndex >= tr.numLightmaps ) {
|
if ( lightmapIndex >= tr.numLightmaps ) {
|
||||||
|
|
|
@ -136,7 +136,8 @@ static const char *IN_TranslateSDLToQ3Key(SDL_keysym *keysym, int *key)
|
||||||
case SDLK_RCTRL: *key = K_CTRL; break;
|
case SDLK_RCTRL: *key = K_CTRL; break;
|
||||||
|
|
||||||
case SDLK_RMETA:
|
case SDLK_RMETA:
|
||||||
case SDLK_LMETA:
|
case SDLK_LMETA: *key = K_COMMAND; break;
|
||||||
|
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
case SDLK_LALT: *key = K_ALT; break;
|
case SDLK_LALT: *key = K_ALT; break;
|
||||||
|
|
||||||
|
@ -288,18 +289,17 @@ static void IN_ActivateMouse( void )
|
||||||
|
|
||||||
if( !mouseActive )
|
if( !mouseActive )
|
||||||
{
|
{
|
||||||
SDL_WM_GrabInput( SDL_GRAB_ON );
|
|
||||||
SDL_ShowCursor( 0 );
|
SDL_ShowCursor( 0 );
|
||||||
|
|
||||||
#ifdef MACOS_X_CURSOR_HACK
|
#ifdef MACOS_X_CURSOR_HACK
|
||||||
// This is a bug in the current SDL/macosx...have to toggle it a few
|
// This is a bug in the current SDL/macosx...have to toggle it a few
|
||||||
// times to get the cursor to hide.
|
// times to get the cursor to hide.
|
||||||
SDL_ShowCursor( 1 );
|
SDL_ShowCursor( 1 );
|
||||||
SDL_ShowCursor( 0 );
|
SDL_ShowCursor( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
SDL_WM_GrabInput( SDL_GRAB_ON );
|
||||||
}
|
}
|
||||||
|
|
||||||
// in_nograb makes no sense unless fullscreen
|
// in_nograb makes no sense in fullscreen mode
|
||||||
if( !r_fullscreen->integer )
|
if( !r_fullscreen->integer )
|
||||||
{
|
{
|
||||||
if( in_nograb->modified || !mouseActive )
|
if( in_nograb->modified || !mouseActive )
|
||||||
|
@ -347,8 +347,9 @@ static void IN_DeactivateMouse( void )
|
||||||
|
|
||||||
if( mouseActive )
|
if( mouseActive )
|
||||||
{
|
{
|
||||||
SDL_ShowCursor( 1 );
|
|
||||||
SDL_WM_GrabInput( SDL_GRAB_OFF );
|
SDL_WM_GrabInput( SDL_GRAB_OFF );
|
||||||
|
SDL_WarpMouse( glConfig.vidWidth >> 1, glConfig.vidHeight >> 1 );
|
||||||
|
SDL_ShowCursor( 1 );
|
||||||
|
|
||||||
mouseActive = qfalse;
|
mouseActive = qfalse;
|
||||||
}
|
}
|
||||||
|
@ -719,6 +720,15 @@ static void IN_ProcessEvents( void )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SDL_ACTIVEEVENT:
|
||||||
|
if( e.active.state == SDL_APPINPUTFOCUS ) {
|
||||||
|
if( e.active.gain )
|
||||||
|
IN_ActivateMouse();
|
||||||
|
else
|
||||||
|
IN_DeactivateMouse();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
Sys_Quit();
|
Sys_Quit();
|
||||||
break;
|
break;
|
||||||
|
@ -741,8 +751,10 @@ void IN_Frame (void)
|
||||||
{
|
{
|
||||||
IN_JoyMove( );
|
IN_JoyMove( );
|
||||||
|
|
||||||
// Release the mouse if the console if down and we're windowed
|
// Release the mouse if the console is down in windowed mode
|
||||||
if( ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) && !r_fullscreen->integer )
|
// or if the window loses focus due to task switching
|
||||||
|
if( ( ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) && !r_fullscreen->integer ) ||
|
||||||
|
!( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
|
||||||
IN_DeactivateMouse( );
|
IN_DeactivateMouse( );
|
||||||
else
|
else
|
||||||
IN_ActivateMouse( );
|
IN_ActivateMouse( );
|
||||||
|
|
|
@ -966,7 +966,7 @@ static void SV_ConSay_f(void) {
|
||||||
|
|
||||||
strcat(text, p);
|
strcat(text, p);
|
||||||
|
|
||||||
SV_SendServerCommand(NULL, "chat \"%s\n\"", text);
|
SV_SendServerCommand(NULL, "chat \"%s\"", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ typedef enum {
|
||||||
DATASEG, // initialized 32 bit data, will be byte swapped
|
DATASEG, // initialized 32 bit data, will be byte swapped
|
||||||
LITSEG, // strings
|
LITSEG, // strings
|
||||||
BSSSEG, // 0 filled
|
BSSSEG, // 0 filled
|
||||||
JTRGSEG, // psuedo-segment that contains only jump table targets
|
JTRGSEG, // pseudo-segment that contains only jump table targets
|
||||||
NUM_SEGMENTS
|
NUM_SEGMENTS
|
||||||
} segmentName_t;
|
} segmentName_t;
|
||||||
|
|
||||||
|
@ -226,16 +226,14 @@ int opcodesHash[ NUM_SOURCE_OPS ];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
static int vreport (const char* fmt, va_list vp)
|
||||||
vreport (const char* fmt, va_list vp)
|
|
||||||
{
|
{
|
||||||
if (options.verbose != qtrue)
|
if (options.verbose != qtrue)
|
||||||
return 0;
|
return 0;
|
||||||
return vprintf(fmt, vp);
|
return vprintf(fmt, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int report (const char *fmt, ...)
|
||||||
report (const char *fmt, ...)
|
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
int retval;
|
int retval;
|
||||||
|
@ -248,16 +246,14 @@ report (const char *fmt, ...)
|
||||||
|
|
||||||
/* The chain-and-bucket hash table. -PH */
|
/* The chain-and-bucket hash table. -PH */
|
||||||
|
|
||||||
void
|
static void hashtable_init (hashtable_t *H, int buckets)
|
||||||
hashtable_init (hashtable_t *H, int buckets)
|
|
||||||
{
|
{
|
||||||
H->buckets = buckets;
|
H->buckets = buckets;
|
||||||
H->table = calloc(H->buckets, sizeof(*(H->table)));
|
H->table = calloc(H->buckets, sizeof(*(H->table)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashtable_t *
|
static hashtable_t *hashtable_new (int buckets)
|
||||||
hashtable_new (int buckets)
|
|
||||||
{
|
{
|
||||||
hashtable_t *H;
|
hashtable_t *H;
|
||||||
|
|
||||||
|
@ -268,8 +264,7 @@ hashtable_new (int buckets)
|
||||||
|
|
||||||
/* No destroy/destructor. No need. */
|
/* No destroy/destructor. No need. */
|
||||||
|
|
||||||
void
|
static void hashtable_add (hashtable_t *H, int hashvalue, void *datum)
|
||||||
hashtable_add (hashtable_t *H, int hashvalue, void *datum)
|
|
||||||
{
|
{
|
||||||
hashchain_t *hc, **hb;
|
hashchain_t *hc, **hb;
|
||||||
|
|
||||||
|
@ -293,15 +288,13 @@ hashtable_add (hashtable_t *H, int hashvalue, void *datum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashchain_t *
|
static hashchain_t *hashtable_get (hashtable_t *H, int hashvalue)
|
||||||
hashtable_get (hashtable_t *H, int hashvalue)
|
|
||||||
{
|
{
|
||||||
hashvalue = (abs(hashvalue) % H->buckets);
|
hashvalue = (abs(hashvalue) % H->buckets);
|
||||||
return (H->table[hashvalue]);
|
return (H->table[hashvalue]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void hashtable_stats (hashtable_t *H)
|
||||||
hashtable_stats (hashtable_t *H)
|
|
||||||
{
|
{
|
||||||
int len, empties, longest, nodes;
|
int len, empties, longest, nodes;
|
||||||
int i;
|
int i;
|
||||||
|
@ -341,8 +334,7 @@ hashtable_stats (hashtable_t *H)
|
||||||
/* Kludge. */
|
/* Kludge. */
|
||||||
/* Check if symbol already exists. */
|
/* Check if symbol already exists. */
|
||||||
/* Returns 0 if symbol does NOT already exist, non-zero otherwise. */
|
/* Returns 0 if symbol does NOT already exist, non-zero otherwise. */
|
||||||
int
|
static int hashtable_symbol_exists (hashtable_t *H, int hash, char *sym)
|
||||||
hashtable_symbol_exists (hashtable_t *H, int hash, char *sym)
|
|
||||||
{
|
{
|
||||||
hashchain_t *hc;
|
hashchain_t *hc;
|
||||||
symbol_t *s;
|
symbol_t *s;
|
||||||
|
@ -372,8 +364,7 @@ hashtable_symbol_exists (hashtable_t *H, int hash, char *sym)
|
||||||
|
|
||||||
|
|
||||||
/* Comparator function for quicksorting. */
|
/* Comparator function for quicksorting. */
|
||||||
int
|
static int symlist_cmp (const void *e1, const void *e2)
|
||||||
symlist_cmp (const void *e1, const void *e2)
|
|
||||||
{
|
{
|
||||||
const symbol_t *a, *b;
|
const symbol_t *a, *b;
|
||||||
|
|
||||||
|
@ -389,8 +380,7 @@ symlist_cmp (const void *e1, const void *e2)
|
||||||
However, qsort(3) already exists, and I'm really lazy.
|
However, qsort(3) already exists, and I'm really lazy.
|
||||||
-PH
|
-PH
|
||||||
*/
|
*/
|
||||||
void
|
static void sort_symbols ()
|
||||||
sort_symbols ()
|
|
||||||
{
|
{
|
||||||
int i, elems;
|
int i, elems;
|
||||||
symbol_t *s;
|
symbol_t *s;
|
||||||
|
@ -439,7 +429,7 @@ sort_symbols ()
|
||||||
|
|
||||||
This function is one big evil hack to work around this problem.
|
This function is one big evil hack to work around this problem.
|
||||||
*/
|
*/
|
||||||
int atoiNoCap (const char *s)
|
static int atoiNoCap (const char *s)
|
||||||
{
|
{
|
||||||
INT64 l;
|
INT64 l;
|
||||||
union {
|
union {
|
||||||
|
@ -465,7 +455,7 @@ HashString
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
/* Default hash function of Kazlib 1.19, slightly modified. */
|
/* Default hash function of Kazlib 1.19, slightly modified. */
|
||||||
unsigned int HashString (const char *key)
|
static unsigned int HashString (const char *key)
|
||||||
{
|
{
|
||||||
static unsigned long randbox[] = {
|
static unsigned long randbox[] = {
|
||||||
0x49848f1bU, 0xe6255dbaU, 0x36da5bdcU, 0x47bf94e9U,
|
0x49848f1bU, 0xe6255dbaU, 0x36da5bdcU, 0x47bf94e9U,
|
||||||
|
@ -494,7 +484,7 @@ unsigned int HashString (const char *key)
|
||||||
CodeError
|
CodeError
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void CodeError( char *fmt, ... ) {
|
static void CodeError( char *fmt, ... ) {
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
errorCount++;
|
errorCount++;
|
||||||
|
@ -511,7 +501,7 @@ void CodeError( char *fmt, ... ) {
|
||||||
EmitByte
|
EmitByte
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void EmitByte( segment_t *seg, int v ) {
|
static void EmitByte( segment_t *seg, int v ) {
|
||||||
if ( seg->imageUsed >= MAX_IMAGE ) {
|
if ( seg->imageUsed >= MAX_IMAGE ) {
|
||||||
Error( "MAX_IMAGE" );
|
Error( "MAX_IMAGE" );
|
||||||
}
|
}
|
||||||
|
@ -524,7 +514,7 @@ void EmitByte( segment_t *seg, int v ) {
|
||||||
EmitInt
|
EmitInt
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void EmitInt( segment_t *seg, int v ) {
|
static void EmitInt( segment_t *seg, int v ) {
|
||||||
if ( seg->imageUsed >= MAX_IMAGE - 4) {
|
if ( seg->imageUsed >= MAX_IMAGE - 4) {
|
||||||
Error( "MAX_IMAGE" );
|
Error( "MAX_IMAGE" );
|
||||||
}
|
}
|
||||||
|
@ -542,7 +532,7 @@ DefineSymbol
|
||||||
Symbols can only be defined on pass 0
|
Symbols can only be defined on pass 0
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void DefineSymbol( char *sym, int value ) {
|
static void DefineSymbol( char *sym, int value ) {
|
||||||
/* Hand optimization by PhaethonH */
|
/* Hand optimization by PhaethonH */
|
||||||
symbol_t *s;
|
symbol_t *s;
|
||||||
char expanded[MAX_LINE_LENGTH];
|
char expanded[MAX_LINE_LENGTH];
|
||||||
|
@ -598,7 +588,7 @@ LookupSymbol
|
||||||
Symbols can only be evaluated on pass 1
|
Symbols can only be evaluated on pass 1
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
int LookupSymbol( char *sym ) {
|
static int LookupSymbol( char *sym ) {
|
||||||
symbol_t *s;
|
symbol_t *s;
|
||||||
char expanded[MAX_LINE_LENGTH];
|
char expanded[MAX_LINE_LENGTH];
|
||||||
int hash;
|
int hash;
|
||||||
|
@ -646,7 +636,7 @@ If a full line isn't parsed, returns NULL
|
||||||
Otherwise returns the updated parse pointer
|
Otherwise returns the updated parse pointer
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
char *ExtractLine( char *data ) {
|
static char *ExtractLine( char *data ) {
|
||||||
/* Goal:
|
/* Goal:
|
||||||
Given a string `data', extract one text line into buffer `lineBuffer' that
|
Given a string `data', extract one text line into buffer `lineBuffer' that
|
||||||
is no longer than MAX_LINE_LENGTH characters long. Return value is
|
is no longer than MAX_LINE_LENGTH characters long. Return value is
|
||||||
|
@ -688,7 +678,7 @@ Parse
|
||||||
Parse a token out of linebuffer
|
Parse a token out of linebuffer
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
qboolean Parse( void ) {
|
static qboolean Parse( void ) {
|
||||||
/* Hand-optimized by PhaethonH */
|
/* Hand-optimized by PhaethonH */
|
||||||
const char *p, *q;
|
const char *p, *q;
|
||||||
|
|
||||||
|
@ -724,7 +714,7 @@ qboolean Parse( void ) {
|
||||||
ParseValue
|
ParseValue
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
int ParseValue( void ) {
|
static int ParseValue( void ) {
|
||||||
Parse();
|
Parse();
|
||||||
return atoiNoCap( token );
|
return atoiNoCap( token );
|
||||||
}
|
}
|
||||||
|
@ -735,7 +725,7 @@ int ParseValue( void ) {
|
||||||
ParseExpression
|
ParseExpression
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
int ParseExpression(void) {
|
static int ParseExpression(void) {
|
||||||
/* Hand optimization, PhaethonH */
|
/* Hand optimization, PhaethonH */
|
||||||
int i, j;
|
int i, j;
|
||||||
char sym[MAX_LINE_LENGTH];
|
char sym[MAX_LINE_LENGTH];
|
||||||
|
@ -806,7 +796,7 @@ Note that the lit segment is read-write in the VM, so strings
|
||||||
aren't read only as in some architectures.
|
aren't read only as in some architectures.
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void HackToSegment( segmentName_t seg ) {
|
static void HackToSegment( segmentName_t seg ) {
|
||||||
if ( currentSegment == &segment[seg] ) {
|
if ( currentSegment == &segment[seg] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1165,7 +1155,7 @@ AssembleLine
|
||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void AssembleLine( void ) {
|
static void AssembleLine( void ) {
|
||||||
hashchain_t *hc;
|
hashchain_t *hc;
|
||||||
sourceOps_t *op;
|
sourceOps_t *op;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1320,7 +1310,7 @@ void InitTables( void ) {
|
||||||
WriteMapFile
|
WriteMapFile
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void WriteMapFile( void ) {
|
static void WriteMapFile( void ) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
symbol_t *s;
|
symbol_t *s;
|
||||||
char imageName[MAX_OS_PATH];
|
char imageName[MAX_OS_PATH];
|
||||||
|
@ -1352,7 +1342,7 @@ void WriteMapFile( void ) {
|
||||||
WriteVmFile
|
WriteVmFile
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void WriteVmFile( void ) {
|
static void WriteVmFile( void ) {
|
||||||
char imageName[MAX_OS_PATH];
|
char imageName[MAX_OS_PATH];
|
||||||
vmHeader_t header;
|
vmHeader_t header;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -1431,7 +1421,7 @@ void WriteVmFile( void ) {
|
||||||
Assemble
|
Assemble
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Assemble( void ) {
|
static void Assemble( void ) {
|
||||||
int i;
|
int i;
|
||||||
char filename[MAX_OS_PATH];
|
char filename[MAX_OS_PATH];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -1498,7 +1488,7 @@ ParseOptionFile
|
||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void ParseOptionFile( const char *filename ) {
|
static void ParseOptionFile( const char *filename ) {
|
||||||
char expanded[MAX_OS_PATH];
|
char expanded[MAX_OS_PATH];
|
||||||
char *text, *text_p;
|
char *text, *text_p;
|
||||||
|
|
||||||
|
@ -1526,6 +1516,19 @@ void ParseOptionFile( const char *filename ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowHelp( char *argv0 ) {
|
||||||
|
Error("Usage: %s [OPTION]... [FILES]...\n\
|
||||||
|
Assemble LCC bytecode assembly to Q3VM bytecode.\n\
|
||||||
|
\n\
|
||||||
|
-o OUTPUT Write assembled output to file OUTPUT.qvm\n\
|
||||||
|
-f LISTFILE Read options and list of files to assemble from LISTFILE.q3asm\n\
|
||||||
|
-b BUCKETS Set symbol hash table to BUCKETS buckets\n\
|
||||||
|
-v Verbose compilation report\n\
|
||||||
|
-vq3 Produce a qvm file compatible with Q3 1.32b\n\
|
||||||
|
-h --help -? Show this help\n\
|
||||||
|
", argv0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
main
|
main
|
||||||
|
@ -1538,15 +1541,7 @@ int main( int argc, char **argv ) {
|
||||||
// _chdir( "/quake3/jccode/cgame/lccout" ); // hack for vc profiler
|
// _chdir( "/quake3/jccode/cgame/lccout" ); // hack for vc profiler
|
||||||
|
|
||||||
if ( argc < 2 ) {
|
if ( argc < 2 ) {
|
||||||
Error("Usage: %s [OPTION]... [FILES]...\n\
|
ShowHelp( argv[0] );
|
||||||
Assemble LCC bytecode assembly to Q3VM bytecode.\n\
|
|
||||||
\n\
|
|
||||||
-o OUTPUT Write assembled output to file OUTPUT.qvm\n\
|
|
||||||
-f LISTFILE Read options and list of files to assemble from LISTFILE\n\
|
|
||||||
-b BUCKETS Set symbol hash table to BUCKETS buckets\n\
|
|
||||||
-v Verbose compilation report\n\
|
|
||||||
-vq3 Produce a qvm file compatible with Q3 1.32b\n\
|
|
||||||
", argv[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start = I_FloatTime ();
|
start = I_FloatTime ();
|
||||||
|
@ -1559,6 +1554,12 @@ Assemble LCC bytecode assembly to Q3VM bytecode.\n\
|
||||||
if ( argv[i][0] != '-' ) {
|
if ( argv[i][0] != '-' ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if( !strcmp( argv[ i ], "-h" ) ||
|
||||||
|
!strcmp( argv[ i ], "--help" ) ||
|
||||||
|
!strcmp( argv[ i ], "-?") ) {
|
||||||
|
ShowHelp( argv[0] );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !strcmp( argv[i], "-o" ) ) {
|
if ( !strcmp( argv[i], "-o" ) ) {
|
||||||
if ( i == argc - 1 ) {
|
if ( i == argc - 1 ) {
|
||||||
Error( "-o must preceed a filename" );
|
Error( "-o must preceed a filename" );
|
||||||
|
@ -1615,6 +1616,10 @@ Motivation: not wanting to scrollback for pages to find asm error.
|
||||||
asmFileNames[ numAsmFiles ] = copystring( argv[ i ] );
|
asmFileNames[ numAsmFiles ] = copystring( argv[ i ] );
|
||||||
numAsmFiles++;
|
numAsmFiles++;
|
||||||
}
|
}
|
||||||
|
// In some case it Segfault without this check
|
||||||
|
if ( numAsmFiles == 0 ) {
|
||||||
|
Error( "No file to assemble\n" );
|
||||||
|
}
|
||||||
|
|
||||||
InitTables();
|
InitTables();
|
||||||
Assemble();
|
Assemble();
|
||||||
|
|
|
@ -204,9 +204,14 @@ control(Tokenrow *trp)
|
||||||
error(WARNING, "Syntax error in #endif");
|
error(WARNING, "Syntax error in #endif");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KWARNING:
|
||||||
|
trp->tp = tp+1;
|
||||||
|
error(WARNING, "#warning directive: %r", trp);
|
||||||
|
break;
|
||||||
|
|
||||||
case KERROR:
|
case KERROR:
|
||||||
trp->tp = tp+1;
|
trp->tp = tp+1;
|
||||||
error(WARNING, "#error directive: %r", trp);
|
error(ERROR, "#error directive: %r", trp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KLINE:
|
case KLINE:
|
||||||
|
|
|
@ -24,7 +24,7 @@ enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP,
|
||||||
DSHARP1, NAME1, DEFINED, UMINUS };
|
DSHARP1, NAME1, DEFINED, UMINUS };
|
||||||
|
|
||||||
enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
|
enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
|
||||||
KUNDEF, KLINE, KERROR, KPRAGMA, KDEFINED,
|
KUNDEF, KLINE, KWARNING, KERROR, KPRAGMA, KDEFINED,
|
||||||
KLINENO, KFILE, KDATE, KTIME, KSTDC, KEVAL };
|
KLINENO, KFILE, KDATE, KTIME, KSTDC, KEVAL };
|
||||||
|
|
||||||
#define ISDEFINED 01 /* has #defined value */
|
#define ISDEFINED 01 /* has #defined value */
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct kwtab {
|
||||||
{"define", KDEFINE, ISKW},
|
{"define", KDEFINE, ISKW},
|
||||||
{"undef", KUNDEF, ISKW},
|
{"undef", KUNDEF, ISKW},
|
||||||
{"line", KLINE, ISKW},
|
{"line", KLINE, ISKW},
|
||||||
|
{"warning", KWARNING, ISKW},
|
||||||
{"error", KERROR, ISKW},
|
{"error", KERROR, ISKW},
|
||||||
{"pragma", KPRAGMA, ISKW},
|
{"pragma", KPRAGMA, ISKW},
|
||||||
{"eval", KEVAL, ISKW},
|
{"eval", KEVAL, ISKW},
|
||||||
|
|
|
@ -7,8 +7,7 @@ ICNS=misc/quake3.icns
|
||||||
DESTDIR=build/release-darwin-ub
|
DESTDIR=build/release-darwin-ub
|
||||||
BASEDIR=baseq3
|
BASEDIR=baseq3
|
||||||
MPACKDIR=missionpack
|
MPACKDIR=missionpack
|
||||||
Q3_VERSION=`grep "\#define Q3_VERSION" code/qcommon/q_shared.h | \
|
Q3_VERSION=`grep '^VERSION=' Makefile | sed -e 's/.*=\(.*\)/\1/'`
|
||||||
sed -e 's/.*".* \([^ ]*\)"/\1/'`;
|
|
||||||
|
|
||||||
BIN_OBJ="
|
BIN_OBJ="
|
||||||
build/release-darwin-ppc/ioquake3-smp.ppc
|
build/release-darwin-ppc/ioquake3-smp.ppc
|
||||||
|
@ -38,10 +37,7 @@ if [ ! -f Makefile ]; then
|
||||||
echo "This script must be run from the ioquake3 build directory";
|
echo "This script must be run from the ioquake3 build directory";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TIGERHOST=0
|
TIGERHOST=`uname -r | grep ^8.`
|
||||||
if uname -r | grep ^8. > /dev/null; then
|
|
||||||
TIGERHOST=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# we want to use the oldest available SDK for max compatiblity
|
# we want to use the oldest available SDK for max compatiblity
|
||||||
unset PPC_CLIENT_SDK
|
unset PPC_CLIENT_SDK
|
||||||
|
@ -190,7 +186,7 @@ fi
|
||||||
cp $ICNS $DESTDIR/$APPBUNDLE/Contents/Resources/ioquake3.icns || exit 1;
|
cp $ICNS $DESTDIR/$APPBUNDLE/Contents/Resources/ioquake3.icns || exit 1;
|
||||||
echo $PKGINFO > $DESTDIR/$APPBUNDLE/Contents/PkgInfo
|
echo $PKGINFO > $DESTDIR/$APPBUNDLE/Contents/PkgInfo
|
||||||
echo "
|
echo "
|
||||||
<?xml version=\"1.0\" encoding="UTF-8"?>
|
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||||
<!DOCTYPE plist
|
<!DOCTYPE plist
|
||||||
PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
|
PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
|
||||||
\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
|
\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
|
||||||
|
|
|
@ -85,7 +85,7 @@ if [ -d ${BUILD_DIR} ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for EXEC_SO in cgamesparc.so qagamesparc.so uisparc.so
|
for EXEC_SO in cgamesparc.so qagamesparc.so uisparc.so cgamei386.so qagamei386.so uii386.so
|
||||||
do
|
do
|
||||||
if [ -f ${BUILD_DIR}/baseq3/${EXEC_SO} ]; then
|
if [ -f ${BUILD_DIR}/baseq3/${EXEC_SO} ]; then
|
||||||
${INSTALL_BIN} ${BUILD_DIR}/baseq3/${EXEC_SO} ${PKG_BUILD_DIR}/baseq3/${EXEC_SO}
|
${INSTALL_BIN} ${BUILD_DIR}/baseq3/${EXEC_SO} ${PKG_BUILD_DIR}/baseq3/${EXEC_SO}
|
||||||
|
@ -95,6 +95,16 @@ if [ -d ${BUILD_DIR} ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for EXEC_VM in cgame.qvm qagame.qvm ui.qvm
|
||||||
|
do
|
||||||
|
if [ -f ${BUILD_DIR}/baseq3/vm/${EXEC_VM} ]; then
|
||||||
|
${INSTALL_BIN} ${BUILD_DIR}/baseq3/vm/${EXEC_VM} ${PKG_BUILD_DIR}/baseq3/vm/${EXEC_VM}
|
||||||
|
fi
|
||||||
|
if [ -f ${BUILD_DIR}/missionpack/vm/${EXEC_VM} ]; then
|
||||||
|
${INSTALL_BIN} ${BUILD_DIR}/missionpack/vm/${EXEC_VM} ${PKG_BUILD_DIR}/missionpack/vm/${EXEC_VM}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
${PKGPROTO} ${PKG_BUILD_DIR}=quake3 | \
|
${PKGPROTO} ${PKG_BUILD_DIR}=quake3 | \
|
||||||
${NAWK} '{ print $1,$2,$3,$4 }' >> ${PKG_SRC_DIR}/prototype
|
${NAWK} '{ print $1,$2,$3,$4 }' >> ${PKG_SRC_DIR}/prototype
|
||||||
${PKGMK} -o -p "${PKG_MAINT_ID}${BUILD_DATE}" \
|
${PKGMK} -o -p "${PKG_MAINT_ID}${BUILD_DATE}" \
|
||||||
|
|
Loading…
Reference in a new issue