Update to use ioq3 makefile, and share q_shared

This commit is contained in:
Scott Brooks 2009-07-04 02:29:42 +00:00
parent c468f8cb35
commit a95e29e3a4
21 changed files with 4148 additions and 6539 deletions

View file

@ -163,7 +163,6 @@ CGDIR=$(MOUNT_DIR)/cgame
BLIBDIR=$(MOUNT_DIR)/botlib
NDIR=$(MOUNT_DIR)/null
UIDIR=$(MOUNT_DIR)/ui
Q3UIDIR=$(MOUNT_DIR)/q3_ui
JPDIR=$(MOUNT_DIR)/jpeg-6b
SPEEXDIR=$(MOUNT_DIR)/libspeex
Q3ASMDIR=$(MOUNT_DIR)/tools/asm
@ -1746,18 +1745,26 @@ Q3GOBJ_ = \
$(B)/Boomstick/game/g_cmds.o \
$(B)/Boomstick/game/g_combat.o \
$(B)/Boomstick/game/g_items.o \
$(B)/Boomstick/game/g_matchmode.o \
$(B)/Boomstick/game/g_mem.o \
$(B)/Boomstick/game/g_misc.o \
$(B)/Boomstick/game/g_missile.o \
$(B)/Boomstick/game/g_mover.o \
$(B)/Boomstick/game/g_parser.o \
$(B)/Boomstick/game/g_scripts.o \
$(B)/Boomstick/game/g_session.o \
$(B)/Boomstick/game/g_spawn.o \
$(B)/Boomstick/game/g_svcmds.o \
$(B)/Boomstick/game/g_target.o \
$(B)/Boomstick/game/g_team.o \
$(B)/Boomstick/game/g_teamplay.o \
$(B)/Boomstick/game/g_trigger.o \
$(B)/Boomstick/game/g_unlagged.o \
$(B)/Boomstick/game/g_utils.o \
$(B)/Boomstick/game/g_weapon.o \
$(B)/Boomstick/game/rxn_game.o \
$(B)/Boomstick/game/zcam.o \
$(B)/Boomstick/game/zcam_target.o \
\
$(B)/Boomstick/qcommon/q_math.o \
$(B)/Boomstick/qcommon/q_shared.o
@ -1826,92 +1833,31 @@ $(B)/missionpack/vm/qagame.qvm: $(MPGVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM)
#############################################################################
## BASEQ3 UI
#############################################################################
Q3UIOBJ_ = \
$(B)/Boomstick/ui/ui_main.o \
$(B)/Boomstick/ui/bg_misc.o \
$(B)/Boomstick/ui/bg_lib.o \
$(B)/Boomstick/ui/ui_addbots.o \
$(B)/Boomstick/ui/ui_atoms.o \
$(B)/Boomstick/ui/ui_cdkey.o \
$(B)/Boomstick/ui/ui_cinematics.o \
$(B)/Boomstick/ui/ui_confirm.o \
$(B)/Boomstick/ui/ui_connect.o \
$(B)/Boomstick/ui/ui_controls2.o \
$(B)/Boomstick/ui/ui_credits.o \
$(B)/Boomstick/ui/ui_demo2.o \
$(B)/Boomstick/ui/ui_display.o \
$(B)/Boomstick/ui/ui_gameinfo.o \
$(B)/Boomstick/ui/ui_ingame.o \
$(B)/Boomstick/ui/ui_loadconfig.o \
$(B)/Boomstick/ui/ui_menu.o \
$(B)/Boomstick/ui/ui_mfield.o \
$(B)/Boomstick/ui/ui_mods.o \
$(B)/Boomstick/ui/ui_network.o \
$(B)/Boomstick/ui/ui_options.o \
$(B)/Boomstick/ui/ui_playermodel.o \
$(B)/Boomstick/ui/ui_players.o \
$(B)/Boomstick/ui/ui_playersettings.o \
$(B)/Boomstick/ui/ui_preferences.o \
$(B)/Boomstick/ui/ui_qmenu.o \
$(B)/Boomstick/ui/ui_removebots.o \
$(B)/Boomstick/ui/ui_saveconfig.o \
$(B)/Boomstick/ui/ui_serverinfo.o \
$(B)/Boomstick/ui/ui_servers2.o \
$(B)/Boomstick/ui/ui_setup.o \
$(B)/Boomstick/ui/ui_sound.o \
$(B)/Boomstick/ui/ui_sparena.o \
$(B)/Boomstick/ui/ui_specifyserver.o \
$(B)/Boomstick/ui/ui_splevel.o \
$(B)/Boomstick/ui/ui_sppostgame.o \
$(B)/Boomstick/ui/ui_spskill.o \
$(B)/Boomstick/ui/ui_startserver.o \
$(B)/Boomstick/ui/ui_team.o \
$(B)/Boomstick/ui/ui_teamorders.o \
$(B)/Boomstick/ui/ui_video.o \
\
$(B)/Boomstick/qcommon/q_math.o \
$(B)/Boomstick/qcommon/q_shared.o
Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm)
$(B)/Boomstick/ui$(ARCH).$(SHLIBEXT): $(Q3UIOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
$(B)/Boomstick/vm/ui.qvm: $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM)
$(echo_cmd) "Q3ASM $@"
$(Q)$(Q3ASM) -o $@ $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm
#############################################################################
## MISSIONPACK UI
#############################################################################
MPUIOBJ_ = \
$(B)/missionpack/ui/ui_main.o \
$(B)/missionpack/ui/ui_atoms.o \
$(B)/missionpack/ui/ui_gameinfo.o \
$(B)/missionpack/ui/ui_players.o \
$(B)/missionpack/ui/ui_shared.o \
$(B)/Boomstick/ui/ui_main.o \
$(B)/Boomstick/ui/ui_atoms.o \
$(B)/Boomstick/ui/ui_gameinfo.o \
$(B)/Boomstick/ui/ui_players.o \
$(B)/Boomstick/ui/ui_shared.o \
\
$(B)/missionpack/ui/bg_misc.o \
$(B)/missionpack/ui/bg_lib.o \
$(B)/Boomstick/ui/bg_misc.o \
$(B)/Boomstick/ui/bg_lib.o \
\
$(B)/missionpack/qcommon/q_math.o \
$(B)/missionpack/qcommon/q_shared.o
$(B)/Boomstick/qcommon/q_math.o \
$(B)/Boomstick/qcommon/q_shared.o
MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
MPUIOBJ = $(MPUIOBJ_) $(B)/Boomstick/ui/ui_syscalls.o
MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm)
$(B)/missionpack/ui$(ARCH).$(SHLIBEXT): $(MPUIOBJ)
$(B)/Boomstick/ui$(ARCH).$(SHLIBEXT): $(MPUIOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)
$(B)/missionpack/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM)
$(B)/Boomstick/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM)
$(echo_cmd) "Q3ASM $@"
$(Q)$(Q3ASM) -o $@ $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm
@ -2041,16 +1987,16 @@ $(B)/Boomstick/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC)
$(B)/Boomstick/ui/%.asm: $(Q3UIDIR)/%.c $(Q3LCC)
$(DO_UI_Q3LCC)
$(B)/missionpack/ui/bg_%.o: $(GDIR)/bg_%.c
$(B)/Boomstick/ui/bg_%.o: $(GDIR)/bg_%.c
$(DO_UI_CC_MISSIONPACK)
$(B)/missionpack/ui/%.o: $(UIDIR)/%.c
$(B)/Boomstick/ui/%.o: $(UIDIR)/%.c
$(DO_UI_CC_MISSIONPACK)
$(B)/missionpack/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC)
$(B)/Boomstick/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC)
$(DO_UI_Q3LCC_MISSIONPACK)
$(B)/missionpack/ui/%.asm: $(UIDIR)/%.c $(Q3LCC)
$(B)/Boomstick/ui/%.asm: $(UIDIR)/%.c $(Q3LCC)
$(DO_UI_Q3LCC_MISSIONPACK)

View file

@ -1191,7 +1191,7 @@ void QDECL CG_Printf(const char *msg, ...)
char text[1024];
va_start(argptr, msg);
vsprintf(text, msg, argptr);
Q_vsnprintf(text, sizeof(text), msg, argptr);
va_end(argptr);
trap_Print(text);
@ -1203,7 +1203,7 @@ void QDECL CG_Error(const char *msg, ...)
char text[1024];
va_start(argptr, msg);
vsprintf(text, msg, argptr);
Q_vsnprintf(text, sizeof(text), msg, argptr);
va_end(argptr);
trap_Error(text);
@ -1218,7 +1218,7 @@ void QDECL Com_Error(int level, const char *error, ...)
char text[1024];
va_start(argptr, error);
vsprintf(text, error, argptr);
Q_vsnprintf(text, sizeof(text), error, argptr);
va_end(argptr);
CG_Error("%s", text);
@ -1230,7 +1230,7 @@ void QDECL Com_Printf(const char *msg, ...)
char text[1024];
va_start(argptr, msg);
vsprintf(text, msg, argptr);
Q_vsnprintf(text, sizeof(text), msg, argptr);
va_end(argptr);
CG_Printf("%s", text);

View file

@ -51,7 +51,7 @@
*****************************************************************************/
#include "g_local.h"
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "botlib.h" //bot lib interface
#include "be_aas.h"
#include "be_ea.h"
@ -119,7 +119,7 @@ void QDECL BotAI_Print(int type, char *fmt, ...)
va_list ap;
va_start(ap, fmt);
vsprintf(str, fmt, ap);
Q_vsnprintf(str, sizeof(str), fmt, ap);
va_end(ap);
switch (type) {

File diff suppressed because it is too large Load diff

View file

@ -1,96 +1,123 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.7 2005/09/18 18:00:51 makro
// no message
//
// Revision 1.6 2005/09/13 02:33:17 jbravo
// Adding new callvote gametype:map
//
// Revision 1.5 2002/06/16 20:06:14 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
// Revision 1.4 2002/01/11 19:48:29 jbravo
// Formatted the source in non DOS format.
//
// Revision 1.3 2001/12/31 16:28:42 jbravo
// I made a Booboo with the Log tag.
//
//
//-----------------------------------------------------------------------------
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// bg_lib.h -- standard C library replacement routines used by code
// compiled for the virtual machine
// This file is NOT included on native builds
#if !defined( BG_LIB_H ) && defined( Q3_VM )
#define BG_LIB_H
//Ignore __attribute__ on non-gcc platforms
#ifndef __GNUC__
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
#ifndef NULL
#define NULL ((void *)0)
#endif
typedef int size_t;
typedef char *va_list;
typedef char * va_list;
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
#define va_end(ap) ( ap = (va_list)0 )
#define CHAR_BIT 8 /* number of bits in a char */
#define SCHAR_MIN (-128) /* minimum signed char value */
#define SCHAR_MAX 127 /* maximum signed char value */
#define UCHAR_MAX 0xff /* maximum unsigned char value */
#define CHAR_BIT 8 /* number of bits in a char */
#define SCHAR_MIN (-128) /* minimum signed char value */
#define SCHAR_MAX 127 /* maximum signed char value */
#define UCHAR_MAX 0xff /* maximum unsigned char value */
#define SHRT_MIN (-32768) /* minimum (signed) short value */
#define SHRT_MAX 32767 /* maximum (signed) short value */
#define USHRT_MAX 0xffff /* maximum unsigned short value */
#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */
#define INT_MAX 2147483647 /* maximum (signed) int value */
#define UINT_MAX 0xffffffff /* maximum unsigned int value */
#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */
#define LONG_MAX 2147483647L /* maximum (signed) long value */
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
#define SHRT_MIN (-32768) /* minimum (signed) short value */
#define SHRT_MAX 32767 /* maximum (signed) short value */
#define USHRT_MAX 0xffff /* maximum unsigned short value */
#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */
#define INT_MAX 2147483647 /* maximum (signed) int value */
#define UINT_MAX 0xffffffff /* maximum unsigned int value */
#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */
#define LONG_MAX 2147483647L /* maximum (signed) long value */
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
#define isalnum(c) (isalpha(c) || isdigit(c))
#define isalpha(c) (isupper(c) || islower(c))
#define isascii(c) ((c) > 0 && (c) <= 0x7f)
#define iscntrl(c) (((c) >= 0) && (((c) <= 0x1f) || ((c) == 0x7f)))
#define isdigit(c) ((c) >= '0' && (c) <= '9')
#define isgraph(c) ((c) != ' ' && isprint(c))
#define islower(c) ((c) >= 'a' && (c) <= 'z')
#define isprint(c) ((c) >= ' ' && (c) <= '~')
#define ispunct(c) (((c) > ' ' && (c) <= '~') && !isalnum(c))
#define isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || \
(c) == '\t' || (c) == '\v')
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define isxdigit(c) (isxupper(c) || isxlower(c))
#define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f'))
#define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F'))
// Misc functions
typedef int cmp_t(const void *, const void *);
void qsort(void *a, size_t n, size_t es, cmp_t * cmp);
void srand(unsigned seed);
int rand(void);
void qsort(void *a, size_t n, size_t es, cmp_t *cmp);
void srand( unsigned seed );
int rand( void );
// String functions
size_t strlen(const char *string);
char *strcat(char *strDestination, const char *strSource);
char *strcpy(char *strDestination, const char *strSource);
int strcmp(const char *string1, const char *string2);
char *strchr(const char *string, int c);
char *strstr(const char *string, const char *strCharSet);
char *strncpy(char *strDest, const char *strSource, size_t count);
char *strtok(char *s, const char *delim);
int tolower(int c);
int toupper(int c);
size_t strlen( const char *string );
char *strcat( char *strDestination, const char *strSource );
char *strcpy( char *strDestination, const char *strSource );
int strcmp( const char *string1, const char *string2 );
char *strchr( const char *string, int c );
char *strstr( const char *string, const char *strCharSet );
char *strncpy( char *strDest, const char *strSource, size_t count );
int tolower( int c );
int toupper( int c );
double atof(const char *string);
double _atof(const char **stringPtr);
int atoi(const char *string);
int _atoi(const char **stringPtr);
double atof( const char *string );
double _atof( const char **stringPtr );
int atoi( const char *string );
int _atoi( const char **stringPtr );
int vsprintf(char *buffer, const char *fmt, va_list argptr);
int sscanf(const char *buffer, const char *fmt, ...);
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr );
int Q_snprintf( char *buffer, size_t length, const char *fmt, ... ) __attribute__ ((format (printf, 3, 4)));
int sscanf( const char *buffer, const char *fmt, ... ) __attribute__ ((format (scanf, 2, 3)));
// Memory functions
void *memmove(void *dest, const void *src, size_t count);
void *memset(void *dest, int c, size_t count);
void *memcpy(void *dest, const void *src, size_t count);
void *memmove( void *dest, const void *src, size_t count );
void *memset( void *dest, int c, size_t count );
void *memcpy( void *dest, const void *src, size_t count );
// Math functions
double ceil(double x);
double floor(double x);
double sqrt(double x);
double sin(double x);
double cos(double x);
double atan2(double y, double x);
double tan(double x);
int abs(int n);
double fabs(double x);
double acos(double x);
double ceil( double x );
double floor( double x );
double sqrt( double x );
double sin( double x );
double cos( double x );
double atan2( double y, double x );
double tan( double x );
int abs( int n );
double fabs( double x );
double acos( double x );
#endif // BG_LIB_H

View file

@ -116,7 +116,7 @@
//
// bg_misc.c -- both games misc functions, all completely stateless
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "bg_public.h"
/*QUAKED item_***** ( 0 0 0 ) (-16 -16 -16) (16 16 16) suspended

View file

@ -149,7 +149,7 @@
// bg_pmove.c -- both games player movement code
// takes a playerstate and a usercmd as input and returns a modifed playerstate
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "bg_public.h"
#include "bg_local.h"

View file

@ -663,8 +663,10 @@ extern radio_msg_t female_radio_msgs[];
//#define CS_MAX (CS_BREAKABLES+RQ3_MAX_BREAKABLES)
#define CS_MAX (CS_MOVEPARENTS+1)
#if 0
#if (CS_MAX) > MAX_CONFIGSTRINGS
#error overflow: (CS_MAX) > MAX_CONFIGSTRINGS
#error overflow: (CS_MAX) > MAX_CONFIGSTRINGS
#endif
#endif
typedef enum {

View file

@ -50,7 +50,7 @@
//
// bg_slidemove.c -- part of bg_pmove functionality
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "bg_public.h"
#include "bg_local.h"

View file

@ -16,7 +16,7 @@
//
//
//-----------------------------------------------------------------------------
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "g_local.h"
#define MAX_ARENAS_TEXT 8192
//Ok, here is how it works, you feed it a buffer in the form

View file

@ -379,7 +379,7 @@
//
// g_local.h -- local definitions for game module
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "bg_public.h"
#include "g_public.h"

View file

@ -444,7 +444,7 @@
#include "g_local.h"
#include "zcam.h"
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "g_scripts.h"
int trap_RealTime(qtime_t * qtime);
@ -810,7 +810,7 @@ void QDECL G_Printf(const char *fmt, ...)
char text[1024];
va_start(argptr, fmt);
vsprintf(text, fmt, argptr);
Q_vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
trap_Printf(text);
@ -822,7 +822,7 @@ void QDECL G_Error(const char *fmt, ...)
char text[1024];
va_start(argptr, fmt);
vsprintf(text, fmt, argptr);
Q_vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
trap_Error(text);
@ -1537,7 +1537,7 @@ void QDECL Com_Error(int level, const char *error, ...)
char text[1024];
va_start(argptr, error);
vsprintf(text, error, argptr);
Q_vsnprintf(text, sizeof(text), error, argptr);
va_end(argptr);
G_Error("%s", text);
@ -1549,7 +1549,7 @@ void QDECL Com_Printf(const char *msg, ...)
char text[1024];
va_start(argptr, msg);
vsprintf(text, msg, argptr);
Q_vsnprintf(text, sizeof(text), msg, argptr);
va_end(argptr);
G_Printf("%s", text);
@ -2119,7 +2119,7 @@ void QDECL G_LogPrintf(const char *fmt, ...)
Com_sprintf(string, sizeof(string), "[%02i:%02i:%02i] ", now.tm_hour, now.tm_min, now.tm_sec);
va_start(argptr, fmt);
vsprintf(string + 11, fmt, argptr);
Q_vsnprintf(string + 11, sizeof(string), fmt, argptr);
va_end(argptr);
if (g_dedicated.integer) {

View file

@ -11,7 +11,7 @@
//
//-----------------------------------------------------------------------------
#include "q_shared.h"
#include "../qcommon/q_shared.h"
#include "g_parser.h"
char *Script_GetToken(char **str)

View file

@ -140,7 +140,7 @@ void QDECL PrintMsg(gentity_t * ent, const char *fmt, ...)
char *p;
va_start(argptr, fmt);
if (vsprintf(msg, fmt, argptr) > sizeof(msg)) {
if (Q_vsnprintf(msg, sizeof(msg), fmt, argptr) > sizeof(msg)) {
G_Error("PrintMsg overrun");
}
va_end(argptr);

View file

@ -37,7 +37,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
// q_math.c -- stateless support routines that are included in each code module
#include "q_shared.h"
#include "../qcommon/q_shared.h"
vec3_t vec3_origin = { 0, 0, 0 };
vec3_t axisDefault[3] = { {1, 0, 0}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -89,7 +89,7 @@ void QDECL Com_Error(int level, const char *error, ...)
char text[1024];
va_start(argptr, error);
vsprintf(text, error, argptr);
Q_vsnprintf(text, sizeof(text), error, argptr);
va_end(argptr);
trap_Error(va("%s", text));
@ -101,7 +101,7 @@ void QDECL Com_Printf(const char *msg, ...)
char text[1024];
va_start(argptr, msg);
vsprintf(text, msg, argptr);
Q_vsnprintf(text, sizeof(text), msg, argptr);
va_end(argptr);
trap_Print(va("%s", text));

View file

@ -425,7 +425,7 @@ void PC_SourceWarning(int handle, char *format, ...)
static char string[4096];
va_start(argptr, format);
vsprintf(string, format, argptr);
Q_vsnprintf(string, sizeof(string), format, argptr);
va_end(argptr);
filename[0] = '\0';
@ -448,7 +448,7 @@ void PC_SourceError(int handle, char *format, ...)
static char string[4096];
va_start(argptr, format);
vsprintf(string, format, argptr);
Q_vsnprintf(string, sizeof(string), format, argptr);
va_end(argptr);
filename[0] = '\0';