Add -exec commandline arg (to override every gamedir). Try to fix or diagnose other issues Maverick was having.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5931 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-07-01 01:16:47 +00:00
parent 853d1ef330
commit 713c5676ab
4 changed files with 24 additions and 17 deletions

View file

@ -2996,6 +2996,7 @@ struct capture_raw_ctx
qboolean FS_FixPath(char *path, size_t pathsize); qboolean FS_FixPath(char *path, size_t pathsize);
static void *QDECL capture_raw_begin (char *streamname, int videorate, int width, int height, int *sndkhz, int *sndchannels, int *sndbits) static void *QDECL capture_raw_begin (char *streamname, int videorate, int width, int height, int *sndkhz, int *sndchannels, int *sndbits)
{ {
char filename[MAX_OSPATH];
struct capture_raw_ctx *ctx = Z_Malloc(sizeof(*ctx)); struct capture_raw_ctx *ctx = Z_Malloc(sizeof(*ctx));
if (!strcmp(capturecodec.string, "png") || !strcmp(capturecodec.string, "jpeg") || !strcmp(capturecodec.string, "jpg") || !strcmp(capturecodec.string, "bmp") || !strcmp(capturecodec.string, "pcx") || !strcmp(capturecodec.string, "tga")) if (!strcmp(capturecodec.string, "png") || !strcmp(capturecodec.string, "jpeg") || !strcmp(capturecodec.string, "jpg") || !strcmp(capturecodec.string, "bmp") || !strcmp(capturecodec.string, "pcx") || !strcmp(capturecodec.string, "tga"))
@ -3014,10 +3015,13 @@ static void *QDECL capture_raw_begin (char *streamname, int videorate, int width
return NULL; return NULL;
} }
ctx->fsroot = FS_SYSTEM; ctx->fsroot = FS_SYSTEM;
if (FS_NativePath(ctx->videonameprefix, ctx->fsroot, filename, sizeof(filename)))
FS_CreatePath(filename, ctx->fsroot);
ctx->audio = NULL; ctx->audio = NULL;
if (*sndkhz) if (*sndkhz)
{ {
char filename[MAX_OSPATH];
if (*sndbits < 8) if (*sndbits < 8)
*sndbits = 8; *sndbits = 8;
if (*sndbits != 8) if (*sndbits != 8)
@ -3027,7 +3031,6 @@ static void *QDECL capture_raw_begin (char *streamname, int videorate, int width
if (*sndchannels < 1) if (*sndchannels < 1)
*sndchannels = 1; *sndchannels = 1;
Q_snprintfz(filename, sizeof(filename), "%saudio_%ichan_%ikhz_%ib.raw", ctx->videonameprefix, *sndchannels, *sndkhz/1000, *sndbits); Q_snprintfz(filename, sizeof(filename), "%saudio_%ichan_%ikhz_%ib.raw", ctx->videonameprefix, *sndchannels, *sndkhz/1000, *sndbits);
FS_CreatePath(filename, ctx->fsroot);
ctx->audio = FS_OpenVFS(filename, "wb", ctx->fsroot); ctx->audio = FS_OpenVFS(filename, "wb", ctx->fsroot);
} }
if (!ctx->audio) if (!ctx->audio)
@ -3066,7 +3069,7 @@ static void QDECL capture_raw_video (void *vctx, int frame, void *data, int stri
} }
else else
{ {
Con_Printf("%s: unable to query free disk space. Disabling\n", capturethrottlesize.name); Con_Printf("%s: unable to query free disk space for %s. Disabling\n", capturethrottlesize.name, filename);
capturethrottlesize.ival = capturethrottlesize.value = 0; capturethrottlesize.ival = capturethrottlesize.value = 0;
} }
} }

View file

@ -3001,8 +3001,6 @@ qboolean Sys_SetUpdatedBinary(const char *newbinary)
} }
qboolean Sys_EngineMayUpdate(void) qboolean Sys_EngineMayUpdate(void)
{ {
char *e;
if (!COM_CheckParm("-allowupdate")) if (!COM_CheckParm("-allowupdate"))
{ {
if (revision_number(true) <= 0) if (revision_number(true) <= 0)

View file

@ -5009,23 +5009,18 @@ This isn't really needed, but might make some thing nicer.
void COM_ParsePlusSets (qboolean docbuf) void COM_ParsePlusSets (qboolean docbuf)
{ {
int i; int i;
int c;
for (i=1 ; i<com_argc-2 ; i++) for (i=1 ; i<com_argc-2 ; i++)
{ {
if (!com_argv[i]) if (!com_argv[i])
continue; // NEXTSTEP sometimes clears appkit vars. continue; // NEXTSTEP sometimes clears appkit vars.
if (!com_argv[i+1]) for (c = 1; i+c < com_argc && com_argv[i+c] && *com_argv[i+c] != '-' && *com_argv[i+c] != '+'; c++)
continue; ;
if (!com_argv[i+2])
continue;
if (*com_argv[i+1] == '-' || *com_argv[i+1] == '+')
continue; //erm
if (*com_argv[i+2] == '-' || *com_argv[i+2] == '+')
continue; //erm
if (docbuf) if (docbuf)
{ {
if (!strcmp(com_argv[i], "+set") || !strcmp(com_argv[i], "+seta")) if (c == 3 && (!strcmp(com_argv[i], "+set") || !strcmp(com_argv[i], "+seta") ||
!strcmp(com_argv[i], "-set") || !strcmp(com_argv[i], "-seta")))
{ {
char buf[8192]; char buf[8192];
Cbuf_AddText(com_argv[i]+1, RESTRICT_LOCAL); Cbuf_AddText(com_argv[i]+1, RESTRICT_LOCAL);
@ -5035,10 +5030,18 @@ void COM_ParsePlusSets (qboolean docbuf)
Cbuf_AddText(COM_QuotedString(com_argv[i+2], buf, sizeof(buf), false), RESTRICT_LOCAL); Cbuf_AddText(COM_QuotedString(com_argv[i+2], buf, sizeof(buf), false), RESTRICT_LOCAL);
Cbuf_AddText("\n", RESTRICT_LOCAL); Cbuf_AddText("\n", RESTRICT_LOCAL);
} }
else if (c == 2 && !strcmp(com_argv[i], "-exec"))
{
char buf[8192];
Cbuf_AddText(com_argv[i]+1, RESTRICT_LOCAL);
Cbuf_AddText(" ", RESTRICT_LOCAL);
Cbuf_AddText(COM_QuotedString(com_argv[i+1], buf, sizeof(buf), false), RESTRICT_LOCAL);
Cbuf_AddText("\n", RESTRICT_LOCAL);
}
} }
else else
{ {
if (!strcmp(com_argv[i], "+set") || !strcmp(com_argv[i], "+seta")) if (c == 3 && (!strcmp(com_argv[i], "+set") || !strcmp(com_argv[i], "+seta")))
{ {
#if defined(Q2CLIENT) || defined(Q2SERVER) #if defined(Q2CLIENT) || defined(Q2SERVER)
if (!strcmp("basedir", com_argv[i+1])) if (!strcmp("basedir", com_argv[i+1]))
@ -5048,7 +5051,7 @@ void COM_ParsePlusSets (qboolean docbuf)
Cvar_Get(com_argv[i+1], com_argv[i+2], (!strcmp(com_argv[i], "+seta"))?CVAR_ARCHIVE:0, "Cvars set on commandline"); Cvar_Get(com_argv[i+1], com_argv[i+2], (!strcmp(com_argv[i], "+seta"))?CVAR_ARCHIVE:0, "Cvars set on commandline");
} }
} }
i+=2; i += c-1;
} }
} }

View file

@ -777,10 +777,13 @@ qboolean Sys_GetFreeDiskSpace(const char *path, quint64_t *freespace)
{ //symlinks means the path needs to be fairly full. it may also be a file, and relative to the working directory. { //symlinks means the path needs to be fairly full. it may also be a file, and relative to the working directory.
wchar_t ffs[MAX_OSPATH]; wchar_t ffs[MAX_OSPATH];
ULARGE_INTEGER freebytes; ULARGE_INTEGER freebytes;
unsigned int err;
if (GetDiskFreeSpaceExW(widen(ffs, sizeof(ffs), path), &freebytes, NULL, NULL)) if (GetDiskFreeSpaceExW(widen(ffs, sizeof(ffs), path), &freebytes, NULL, NULL))
{ {
*freespace = freebytes.QuadPart; *freespace = freebytes.QuadPart;
return true; return true;
} }
err = GetLastError();
Con_Printf("GetDiskFreeSpaceExW(%s) failed: %x\n", path, err);
return false; return false;
} }