mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 17:12:15 +00:00
add QFS_Open and QFS_WOpen
This commit is contained in:
parent
de5bf80eb8
commit
33f08b6a43
3 changed files with 36 additions and 0 deletions
|
@ -62,6 +62,36 @@ check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
bi_QFS_Open (progs_t *pr)
|
||||||
|
{
|
||||||
|
QFile *file;
|
||||||
|
const char *path = P_GSTRING (pr, 0);
|
||||||
|
const char *mode = P_GSTRING (pr, 1);
|
||||||
|
|
||||||
|
if (!(file = QFS_Open (path, mode))) {
|
||||||
|
R_INT (pr) = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(R_INT (pr) = QFile_AllocHandle (pr, file)))
|
||||||
|
Qclose (file);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
bi_QFS_WOpen (progs_t *pr)
|
||||||
|
{
|
||||||
|
QFile *file;
|
||||||
|
const char *path = P_GSTRING (pr, 0);
|
||||||
|
int zip = P_INT (pr, 1);
|
||||||
|
|
||||||
|
if (!(file = QFS_WOpen (path, zip))) {
|
||||||
|
R_INT (pr) = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(R_INT (pr) = QFile_AllocHandle (pr, file)))
|
||||||
|
Qclose (file);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bi_QFS_Rename (progs_t *pr)
|
bi_QFS_Rename (progs_t *pr)
|
||||||
{
|
{
|
||||||
|
@ -149,6 +179,8 @@ bi_QFS_FilelistFree (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static builtin_t builtins[] = {
|
static builtin_t builtins[] = {
|
||||||
|
{"QFS_Open", bi_QFS_Open, -1},
|
||||||
|
{"QFS_WOpen", bi_QFS_WOpen, -1},
|
||||||
{"QFS_Rename", bi_QFS_Rename, -1},
|
{"QFS_Rename", bi_QFS_Rename, -1},
|
||||||
{"QFS_LoadFile", bi_QFS_LoadFile, -1},
|
{"QFS_LoadFile", bi_QFS_LoadFile, -1},
|
||||||
{"QFS_OpenFile", bi_QFS_OpenFile, -1},
|
{"QFS_OpenFile", bi_QFS_OpenFile, -1},
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
struct _qfslist_t = {};
|
struct _qfslist_t = {};
|
||||||
typedef struct _qfslist_t [] QFSlist;
|
typedef struct _qfslist_t [] QFSlist;
|
||||||
|
|
||||||
|
@extern QFile (string path, string mode) QFS_Open;
|
||||||
|
@extern QFile (string path, integer zip) QFS_WOpen;
|
||||||
@extern integer (string old, string new) QFS_Rename;
|
@extern integer (string old, string new) QFS_Rename;
|
||||||
@extern (void []) (string filename) QFS_LoadFile;
|
@extern (void []) (string filename) QFS_LoadFile;
|
||||||
@extern QFile (string filename) QFS_OpenFile;
|
@extern QFile (string filename) QFS_OpenFile;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "qfs.h"
|
#include "qfs.h"
|
||||||
|
|
||||||
|
QFile (string path, string mode) QFS_Open = #0;
|
||||||
|
QFile (string path, integer zip) QFS_WOpen = #0;
|
||||||
integer (string old, string new) QFS_Rename = #0;
|
integer (string old, string new) QFS_Rename = #0;
|
||||||
(void []) (string filename) QFS_LoadFile = #0;
|
(void []) (string filename) QFS_LoadFile = #0;
|
||||||
QFile (string filename) QFS_OpenFile = #0;
|
QFile (string filename) QFS_OpenFile = #0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue