2007-01-29 01:18:16 +00:00
|
|
|
// Base services interface declaration
|
|
|
|
// for the Build Engine
|
|
|
|
// by Jonathon Fowler (jonof@edgenetwk.com)
|
|
|
|
|
|
|
|
#ifndef __baselayer_h__
|
|
|
|
#define __baselayer_h__
|
|
|
|
|
2008-02-16 22:27:08 +00:00
|
|
|
#include "compat.h"
|
2008-07-24 11:16:20 +00:00
|
|
|
#include "osd.h"
|
2008-02-16 22:27:08 +00:00
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-06-13 21:06:45 +00:00
|
|
|
#define SYSTEM_POOL_SIZE (256 * 1048576)
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t _buildargc;
|
2007-08-17 03:16:46 +00:00
|
|
|
extern const char **_buildargv;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
extern char quitevent, appactive;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t vsync;
|
2008-07-22 21:03:09 +00:00
|
|
|
|
2006-07-01 01:40:18 +00:00
|
|
|
// NOTE: these are implemented in game-land so they may be overridden in game specific ways
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t startwin_open(void);
|
|
|
|
extern int32_t startwin_close(void);
|
|
|
|
extern int32_t startwin_puts(const char *);
|
|
|
|
extern int32_t startwin_settitle(const char *);
|
|
|
|
extern int32_t startwin_idle(void *);
|
2006-07-01 01:40:18 +00:00
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
// video
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t xres, yres, bpp, fullscreen, bytesperline, imageSize;
|
2008-02-16 22:27:08 +00:00
|
|
|
extern intptr_t frameplace;
|
2007-01-29 01:18:16 +00:00
|
|
|
extern char offscreenrendering;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern void (*baselayer_onvideomodechange)(int32_t);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm);
|
2008-02-24 00:46:57 +00:00
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
struct glinfo {
|
|
|
|
const char *vendor;
|
|
|
|
const char *renderer;
|
|
|
|
const char *version;
|
|
|
|
const char *extensions;
|
|
|
|
|
2009-09-30 01:26:13 +00:00
|
|
|
float maxanisotropy;
|
|
|
|
char bgra;
|
|
|
|
char clamptoedge;
|
|
|
|
char texcompr;
|
|
|
|
char texnpot;
|
|
|
|
char multisample;
|
|
|
|
char nvmultisamplehint;
|
2007-01-29 01:18:16 +00:00
|
|
|
char arbfp;
|
|
|
|
char depthtex;
|
|
|
|
char shadow;
|
|
|
|
char fbos;
|
|
|
|
char rect;
|
|
|
|
char multitex;
|
|
|
|
char envcombine;
|
2007-03-08 03:07:10 +00:00
|
|
|
char vbos;
|
2008-07-22 21:03:09 +00:00
|
|
|
char vsync;
|
2009-02-05 08:56:59 +00:00
|
|
|
char sm4;
|
2009-09-30 01:26:13 +00:00
|
|
|
char occlusionqueries;
|
|
|
|
char glsl;
|
2008-02-24 00:46:57 +00:00
|
|
|
char dumped;
|
2007-01-29 01:18:16 +00:00
|
|
|
};
|
2009-07-09 02:29:48 +00:00
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
extern struct glinfo glinfo;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern void setvsync(int32_t sync);
|
2007-01-29 01:18:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
extern char inputdevices;
|
|
|
|
|
|
|
|
// keys
|
|
|
|
#define KEYFIFOSIZ 64
|
|
|
|
extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
|
2008-07-02 01:32:53 +00:00
|
|
|
extern char scantoasc[128];
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
// mouse
|
2009-01-09 09:29:17 +00:00
|
|
|
extern volatile int32_t mousex, mousey, mouseb;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
// joystick
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t *joyaxis, *joyhat, joyb;
|
2007-01-29 01:18:16 +00:00
|
|
|
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t joyaxespresent;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t qsetmode;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t initsystem(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
void uninitsystem(void);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t flushlogwindow;
|
2007-01-29 01:18:16 +00:00
|
|
|
void initprintf(const char *, ...);
|
|
|
|
void debugprintf(const char *,...);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t handleevents(void);
|
2006-12-21 12:53:11 +00:00
|
|
|
extern inline void idle(void);
|
2009-08-05 22:37:48 +00:00
|
|
|
extern inline void idle_waitevent(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
typedef void (*KeyPressCallback)(int32_t,int32_t);
|
|
|
|
typedef void (*MousePressCallback)(int32_t,int32_t);
|
|
|
|
typedef void (*JoyPressCallback)(int32_t,int32_t);
|
|
|
|
int32_t initinput(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
void uninitinput(void);
|
|
|
|
void releaseallbuttons(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
void setkeypresscallback(void (*callback)(int32_t,int32_t));
|
|
|
|
void setmousepresscallback(void (*callback)(int32_t,int32_t));
|
|
|
|
void setjoypresscallback(void (*callback)(int32_t,int32_t));
|
|
|
|
const char *getkeyname(int32_t num);
|
|
|
|
const char *getjoyname(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat
|
|
|
|
char *strtolower(char *str, int32_t len);
|
|
|
|
|
|
|
|
char bgetchar(void);
|
|
|
|
int32_t bkbhit(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
void bflushchars(void);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t initmouse(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
void uninitmouse(void);
|
|
|
|
void grabmouse(char a);
|
2009-01-09 09:29:17 +00:00
|
|
|
void readmousexy(int32_t *x, int32_t *y);
|
|
|
|
void readmousebstatus(int32_t *b);
|
|
|
|
void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur);
|
|
|
|
void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t inittimer(int32_t);
|
2007-01-29 01:18:16 +00:00
|
|
|
void uninittimer(void);
|
|
|
|
void sampletimer(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
uint32_t getticks(void);
|
|
|
|
int32_t gettimerfreq(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
void (*installusertimercallback(void (*callback)(void)))(void);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced);
|
|
|
|
int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs);
|
2007-01-29 01:18:16 +00:00
|
|
|
void getvalidmodes(void);
|
|
|
|
void resetvideomode(void);
|
|
|
|
|
|
|
|
void begindrawing(void);
|
|
|
|
void enddrawing(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
void showframe(int32_t);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t setpalette(int32_t start, int32_t num);
|
|
|
|
//int32_t getpalette(int32_t start, int32_t num, char *dapal);
|
|
|
|
int32_t setgamma(void);
|
2008-07-21 03:06:34 +00:00
|
|
|
double vid_gamma, vid_contrast, vid_brightness;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2008-07-21 09:05:53 +00:00
|
|
|
#define DEFAULT_GAMMA 1.0
|
2008-07-24 02:07:22 +00:00
|
|
|
#define DEFAULT_CONTRAST 1.0
|
|
|
|
#define DEFAULT_BRIGHTNESS 0.0
|
2008-07-20 11:03:57 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t wm_msgbox(char *name, char *fmt, ...);
|
|
|
|
int32_t wm_ynbox(char *name, char *fmt, ...);
|
2007-01-29 01:18:16 +00:00
|
|
|
void wm_setapptitle(char *name);
|
|
|
|
|
|
|
|
// baselayer.c
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t baselayer_init();
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2007-10-24 07:12:50 +00:00
|
|
|
void makeasmwriteable(void);
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // __baselayer_h__
|
|
|
|
|