From 79fce5580622509c73cdfb8a9b116ce7cda1ae9f Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 30 Nov 2005 00:48:29 +0000 Subject: [PATCH] Added Quake filesystem access. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1629 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- plugins/plugin.c | 20 ++++++++++++++++++++ plugins/plugin.h | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/plugins/plugin.c b/plugins/plugin.c index 2b08cf06f..425e5aa5d 100644 --- a/plugins/plugin.c +++ b/plugins/plugin.c @@ -148,6 +148,20 @@ BUILTIN(void, Menu_Control, (int mnum)); BUILTINR(int, Key_GetKeyCode, (char *keyname)); #undef ARGNAMES +#define ARGNAMES ,name,handle,mode +BUILTINR(int, FS_Open, (char *name, int *handle, int mode)); +#undef ARGNAMES +#define ARGNAMES ,handle +BUILTIN(void, FS_Close, (int handle)); +#undef ARGNAMES +#define ARGNAMES ,handle,data,len +BUILTIN(void, FS_Write, (int handle, void *data, int len)); +#undef ARGNAMES +#define ARGNAMES ,handle,data,len +BUILTIN(void, FS_Read, (int handle, void *data, int len)); +#undef ARGNAMES + + #define ARGNAMES ,ip,port BUILTINR(int, Net_TCPConnect, (char *ip, int port)); #undef ARGNAMES @@ -242,6 +256,12 @@ void Plug_InitStandardBuiltins(void) CHECKBUILTIN(Cvar_Register); CHECKBUILTIN(Cvar_Update); + //file system + CHECKBUILTIN(FS_Open); + CHECKBUILTIN(FS_Read); + CHECKBUILTIN(FS_Write); + CHECKBUILTIN(FS_Close); + //networking CHECKBUILTIN(Net_TCPConnect); CHECKBUILTIN(Net_TCPListen); diff --git a/plugins/plugin.h b/plugins/plugin.h index a3e1e5426..9fe599424 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -95,6 +95,11 @@ EBUILTIN(void, Draw_Colour3f, (float r, float g, float b)); EBUILTIN(void, Draw_Colour4f, (float r, float g, float b, float a)); EBUILTIN(void, SCR_CenterPrint, (char *s)); +EBUILTIN(int, FS_Open, (char *name, int *handle, int mode)); +EBUILTIN(void, FS_Close, (int handle)); +EBUILTIN(void, FS_Write, (int handle, void *data, int len)); +EBUILTIN(void, FS_Read, (int handle, void *data, int len)); + EBUILTIN(int, Net_TCPConnect, (char *ip, int port)); EBUILTIN(int, Net_TCPListen, (char *ip, int port, int maxcount)); EBUILTIN(int, Net_Accept, (int socket, char *address, int addresssize));