Use the QVM build toolchain from ioq3

This commit is contained in:
Izuru Yakumo
2025-07-15 15:09:05 -03:00
parent 733fac10f2
commit e8a6db7830
32 changed files with 1982 additions and 1955 deletions

View File

@@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "cpp.h"
extern int lcc_getopt(int, char *const *, const char *);
@@ -64,11 +65,22 @@ setup(int argc, char **argv)
fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0);
if ((fd = open(fp, 0)) <= 0)
error(FATAL, "Can't open input file %s", fp);
#ifdef WIN32
_setmode(fd, _O_BINARY);
#endif
}
if (optind+1<argc) {
int fdo = creat(argv[optind+1], 0666);
int fdo;
#ifdef WIN32
fdo = creat(argv[optind+1], _S_IREAD | _S_IWRITE);
#else
fdo = creat(argv[optind+1], 0666);
#endif
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
#ifdef WIN32
_setmode(fdo, _O_BINARY);
#endif
dup2(fdo, 1);
}
if(Mflag)
@@ -99,7 +111,8 @@ char *basepath( char *fname )
/* memmove is defined here because some vendors don't provide it at
all and others do a terrible job (like calling malloc) */
// -- ouch, that hurts -- ln
#ifndef MACOS_X /* always use the system memmove() on Mac OS X. --ryan. */
/* always use the system memmove() on Mac OS X. --ryan. */
#if !defined(__APPLE__) && !defined(_MSC_VER)
#ifdef memmove
#undef memmove
#endif
@@ -109,7 +122,7 @@ memmove(void *dp, const void *sp, size_t n)
unsigned char *cdp, *csp;
if (n<=0)
return 0;
return dp;
cdp = dp;
csp = (unsigned char *)sp;
if (cdp < csp) {
@@ -123,6 +136,6 @@ memmove(void *dp, const void *sp, size_t n)
*--cdp = *--csp;
} while (--n);
}
return 0;
return dp;
}
#endif