2004-08-23 00:15:46 +00:00
|
|
|
#ifndef _VM_H
|
|
|
|
#define _VM_H
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define EXPORT_FN __cdecl
|
|
|
|
#else
|
|
|
|
#define EXPORT_FN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-09-08 01:55:56 +00:00
|
|
|
typedef int (EXPORT_FN *sys_calldll_t) (int arg, ...);
|
2007-09-03 22:37:13 +00:00
|
|
|
typedef int (*sys_callqvm_t) (void *offset, unsigned int mask, int fn, const int *arg);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
typedef struct vm_s vm_t;
|
|
|
|
|
|
|
|
// for syscall users
|
2007-09-03 22:37:13 +00:00
|
|
|
#define VM_LONG(x) (*(int*)&(x))
|
2004-08-23 00:15:46 +00:00
|
|
|
#define VM_FLOAT(x) (*(float*)&(x))
|
|
|
|
#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);
|
2005-09-08 01:55:56 +00:00
|
|
|
vm_t *VM_Create(vm_t *vm, const char *name, sys_calldll_t syscalldll, sys_callqvm_t syscallqvm);
|
2004-08-23 00:15:46 +00:00
|
|
|
void VM_Destroy(vm_t *vm);
|
|
|
|
qboolean VM_Restart(vm_t *vm);
|
|
|
|
int VARGS VM_Call(vm_t *vm, int instruction, ...);
|
2005-03-10 03:55:18 +00:00
|
|
|
void *VM_MemoryBase(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
|
2004-10-13 07:24:59 +00:00
|
|
|
qboolean Plug_Menu_Event(int eventtype, int param);
|
2004-11-23 00:37:02 +00:00
|
|
|
qboolean Plugin_ExecuteString(void);
|
2004-10-13 07:24:59 +00:00
|
|
|
void Plug_ResChanged(void);
|
|
|
|
void Plug_Tick(void);
|
|
|
|
void Plug_Init(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2004-10-13 07:24:59 +00:00
|
|
|
void Plug_SBar(void);
|
2004-11-23 00:37:02 +00:00
|
|
|
void Plug_DrawReloadImages(void);
|
2005-10-07 02:14:22 +00:00
|
|
|
int Plug_ConnectionlessClientPacket(char *buffer, int size);
|
2006-02-11 14:51:36 +00:00
|
|
|
|
|
|
|
qboolean Plug_ChatMessage(char *buffer, int talkernum, int tpflags);
|
|
|
|
qboolean Plug_ServerMessage(char *buffer, int messagelevel);
|
|
|
|
qboolean Plug_CenterPrintMessage(char *buffer, int clientnum);
|
2004-10-26 23:06:29 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-09-14 04:17:20 +00:00
|
|
|
#ifdef VM_UI
|
|
|
|
qboolean UI_Command(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void UI_Init (void);
|
2005-08-26 22:56:51 +00:00
|
|
|
void UI_Restart_f(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void UI_Stop (void);
|
|
|
|
qboolean UI_Q2LayoutChanged(void);
|
|
|
|
void UI_StringChanged(int num);
|
|
|
|
void UI_MousePosition(int xpos, int ypos);
|
|
|
|
int UI_MenuState(void);
|
|
|
|
qboolean UI_KeyPress(int key, qboolean down);
|
|
|
|
void UI_Reset(void);
|
|
|
|
void UI_DrawMenu(void);
|
|
|
|
qboolean UI_DrawStatusBar(int scores);
|
|
|
|
qboolean UI_DrawIntermission(void);
|
|
|
|
qboolean UI_DrawFinale(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
|
|
|
|
#define VM_FS_APPEND2 3 //I don't know, don't ask me. look at q3 source
|
|
|
|
int VM_fopen (char *name, int *handle, int fmode, int owner);
|
|
|
|
int VM_FRead (char *dest, int quantity, int fnum, int owner);
|
|
|
|
void VM_fclose (int fnum, int owner);
|
|
|
|
void VM_fcloseall (int owner);
|
|
|
|
int VM_GetFileList(char *path, char *ext, char *output, int buffersize);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef VM_CG
|
|
|
|
void CG_Stop (void);
|
|
|
|
void CG_Start (void);
|
|
|
|
int CG_Refresh(void);
|
2005-02-12 18:56:04 +00:00
|
|
|
qboolean CG_Command(void);
|
2005-09-14 04:17:20 +00:00
|
|
|
qboolean CG_KeyPress(int key, int down);
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|