2004-08-23 00:15:46 +00:00
|
|
|
#ifndef _VM_H
|
|
|
|
#define _VM_H
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2009-07-14 23:42:54 +00:00
|
|
|
#define EXPORT_FN __cdecl
|
2004-08-23 00:15:46 +00:00
|
|
|
#else
|
2009-07-14 23:42:54 +00:00
|
|
|
#define EXPORT_FN
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
2009-07-14 23:42:54 +00:00
|
|
|
typedef qintptr_t (EXPORT_FN *sys_calldll_t) (qintptr_t arg, ...);
|
2009-07-17 15:34:16 +00:00
|
|
|
typedef int (*sys_callqvm_t) (void *offset, quintptr_t mask, int fn, const int *arg);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
typedef struct vm_s vm_t;
|
|
|
|
|
|
|
|
// for syscall users
|
2009-07-14 23:42:54 +00:00
|
|
|
#define VM_LONG(x) (*(int*)&(x)) //note: on 64bit platforms, the later bits can contain junk
|
|
|
|
#define VM_FLOAT(x) (*(float*)&(x)) //note: on 64bit platforms, the later bits can contain junk
|
2004-08-23 00:15:46 +00:00
|
|
|
#define VM_POINTER(x) ((x)?(void*)((char *)offset+((x)%mask)):NULL)
|
2004-10-10 06:32:29 +00:00
|
|
|
#define VM_OOB(p,l) (p + l >= mask || VM_POINTER(p) < offset)
|
2004-08-23 00:15:46 +00:00
|
|
|
// ------------------------- * interface * -------------------------
|
|
|
|
|
|
|
|
void VM_PrintInfo(vm_t *vm);
|
2015-02-02 08:01:53 +00:00
|
|
|
vm_t *VM_CreateBuiltin(const char *name, sys_calldll_t syscalldll, qintptr_t (*init)(qintptr_t *args));
|
2019-02-24 08:32:45 +00:00
|
|
|
vm_t *VM_Create(const char *dllname, sys_calldll_t syscalldll, const char *qvmname, sys_callqvm_t syscallqvm);
|
2016-07-12 00:40:13 +00:00
|
|
|
const char *VM_GetFilename(vm_t *vm);
|
2004-08-23 00:15:46 +00:00
|
|
|
void VM_Destroy(vm_t *vm);
|
2013-05-11 14:02:55 +00:00
|
|
|
//qboolean VM_Restart(vm_t *vm);
|
2009-07-14 23:42:54 +00:00
|
|
|
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...);
|
|
|
|
qboolean VM_NonNative(vm_t *vm);
|
2005-03-10 03:55:18 +00:00
|
|
|
void *VM_MemoryBase(vm_t *vm);
|
2011-07-30 14:14:56 +00:00
|
|
|
quintptr_t VM_MemoryMask(vm_t *vm);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2004-10-13 07:24:59 +00:00
|
|
|
//plugin functions
|
2004-10-26 23:06:29 +00:00
|
|
|
#ifdef PLUGINS
|
2007-10-05 19:10:43 +00:00
|
|
|
qboolean Plug_CenterPrintMessage(char *buffer, int clientnum);
|
|
|
|
qboolean Plug_ChatMessage(char *buffer, int talkernum, int tpflags);
|
|
|
|
void Plug_Command_f(void);
|
|
|
|
int Plug_ConnectionlessClientPacket(char *buffer, int size);
|
2016-07-12 00:40:13 +00:00
|
|
|
qboolean Plug_ConsoleLink(char *text, char *info, const char *consolename);
|
2013-11-21 23:02:28 +00:00
|
|
|
qboolean Plug_ConsoleLinkMouseOver(float x, float y, char *text, char *info);
|
2007-10-05 19:10:43 +00:00
|
|
|
void Plug_DrawReloadImages(void);
|
2013-05-03 04:28:08 +00:00
|
|
|
void Plug_Initialise(qboolean fromgamedir);
|
2013-05-11 14:02:55 +00:00
|
|
|
void Plug_Shutdown(qboolean preliminary);
|
2007-10-05 19:10:43 +00:00
|
|
|
qboolean Plug_Menu_Event(int eventtype, int param);
|
|
|
|
void Plug_ResChanged(void);
|
2013-06-23 02:17:02 +00:00
|
|
|
void Plug_SBar(playerview_t *pv);
|
2007-10-05 19:10:43 +00:00
|
|
|
qboolean Plug_ServerMessage(char *buffer, int messagelevel);
|
|
|
|
void Plug_Tick(void);
|
|
|
|
qboolean Plugin_ExecuteString(void);
|
2019-06-21 03:59:46 +00:00
|
|
|
|
|
|
|
#ifdef ANDROID
|
|
|
|
#define PLUGINPREFIX "libplug_" //android is kinda annoying and only extracts specific files.
|
|
|
|
#else
|
|
|
|
#define PLUGINPREFIX "fteplug_" //this string defines what consitutes a plugin, as opposed to some other dll
|
|
|
|
#endif
|
2004-10-26 23:06:29 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
#define VM_TOSTRCACHE(a) VMQ3_StringToHandle(VM_POINTER(a))
|
|
|
|
#define VM_FROMSTRCACHE(a) VMQ3_StringFromHandle(a)
|
|
|
|
char *VMQ3_StringFromHandle(int handle);
|
|
|
|
int VMQ3_StringToHandle(char *str);
|
|
|
|
void VMQ3_FlushStringHandles(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-09-14 04:17:20 +00:00
|
|
|
#ifdef VM_UI
|
2019-02-01 08:29:14 +00:00
|
|
|
qboolean UI_IsRunning(void);
|
2005-09-14 04:17:20 +00:00
|
|
|
qboolean UI_Command(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void UI_Init (void);
|
2011-02-02 00:41:01 +00:00
|
|
|
void UI_Start (void);
|
|
|
|
void UI_Stop (void);
|
2009-11-04 21:16:50 +00:00
|
|
|
qboolean UI_OpenMenu(void);
|
2005-08-26 22:56:51 +00:00
|
|
|
void UI_Restart_f(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
qboolean UI_Q2LayoutChanged(void);
|
|
|
|
void UI_StringChanged(int num);
|
2019-01-29 07:18:07 +00:00
|
|
|
qboolean UI_MousePosition(float xpos, float ypos);
|
2004-08-23 00:15:46 +00:00
|
|
|
int UI_MenuState(void);
|
2009-07-25 11:05:06 +00:00
|
|
|
qboolean UI_KeyPress(int key, int unicode, qboolean down);
|
2004-08-23 00:15:46 +00:00
|
|
|
void UI_Reset(void);
|
|
|
|
void UI_DrawMenu(void);
|
|
|
|
qboolean UI_DrawStatusBar(int scores);
|
|
|
|
qboolean UI_DrawIntermission(void);
|
|
|
|
int UI_MenuState(void);
|
2006-02-11 14:51:36 +00:00
|
|
|
|
|
|
|
//sans botlib
|
2006-02-17 19:54:47 +00:00
|
|
|
struct pc_token_s;
|
2006-02-11 14:51:36 +00:00
|
|
|
int Script_LoadFile(char *filename);
|
|
|
|
void Script_Free(int handle);
|
|
|
|
int Script_Read(int handle, struct pc_token_s *token);
|
|
|
|
void Script_Get_File_And_Line(int handle, char *filename, int *line);
|
2005-09-14 04:17:20 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2007-09-02 19:55:17 +00:00
|
|
|
#define VM_FS_READ 0
|
|
|
|
#define VM_FS_WRITE 1
|
|
|
|
#define VM_FS_APPEND 2
|
2018-07-05 16:21:44 +00:00
|
|
|
#define VM_FS_APPEND_SYNC 3 //I don't know, don't ask me. look at q3 source
|
2016-08-25 00:12:14 +00:00
|
|
|
qofs_t VM_fopen (const char *name, int *handle, int fmode, int owner);
|
2007-09-02 19:55:17 +00:00
|
|
|
int VM_FRead (char *dest, int quantity, int fnum, int owner);
|
2016-08-25 00:12:14 +00:00
|
|
|
int VM_FWrite (const char *dest, int quantity, int fnum, int owner);
|
|
|
|
qboolean VM_FSeek (int fnum, qofs_t offset, int seektype, int owner);
|
|
|
|
qofs_t VM_FTell (int fnum, int owner);
|
2007-09-02 19:55:17 +00:00
|
|
|
void VM_fclose (int fnum, int owner);
|
|
|
|
void VM_fcloseall (int owner);
|
2016-08-25 00:12:14 +00:00
|
|
|
int VM_GetFileList(const char *path, const char *ext, char *output, int buffersize);
|
2007-09-02 19:55:17 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef VM_CG
|
|
|
|
void CG_Stop (void);
|
|
|
|
void CG_Start (void);
|
2014-03-30 08:55:06 +00:00
|
|
|
qboolean CG_VideoRestarted(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
int CG_Refresh(void);
|
2005-02-12 18:56:04 +00:00
|
|
|
qboolean CG_Command(void);
|
2009-07-25 11:05:06 +00:00
|
|
|
qboolean CG_KeyPress(int key, int unicode, int down);
|
2019-01-29 23:43:50 +00:00
|
|
|
unsigned int CG_GatherLoopingSounds(vec3_t *positions, unsigned int *entnums, sfx_t **sounds, unsigned int max);
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
2007-09-17 20:35:39 +00:00
|
|
|
typedef struct {
|
|
|
|
int handle;
|
|
|
|
int modificationCount;
|
|
|
|
float value;
|
|
|
|
int integer;
|
|
|
|
char string[256];
|
2013-05-03 04:28:08 +00:00
|
|
|
} q3vmcvar_t;
|
|
|
|
int VMQ3_Cvar_Register(q3vmcvar_t *v, char *name, char *defval, int flags);
|
|
|
|
int VMQ3_Cvar_Update(q3vmcvar_t *v);
|
2007-09-17 20:35:39 +00:00
|
|
|
|
2019-07-02 04:12:20 +00:00
|
|
|
typedef struct {
|
|
|
|
int tm_sec;
|
|
|
|
int tm_min;
|
|
|
|
int tm_hour;
|
|
|
|
int tm_mday;
|
|
|
|
int tm_mon;
|
|
|
|
int tm_year;
|
|
|
|
int tm_wday;
|
|
|
|
int tm_yday;
|
|
|
|
int tm_isdst;
|
|
|
|
} q3time_t;
|
|
|
|
qint64_t Q3VM_GetRealtime(q3time_t *qtime);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|