You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
307 lines
11 KiB
C
307 lines
11 KiB
C
//
|
|
// G A M E.O.N.E - LOW LEVEL LIB V1.0
|
|
// Copyright (C) 2001 LEVEL ONE ENTERTAINMENT,
|
|
// Licensed under the terms of LGPL.
|
|
//:---------------------------------------------------------------------------
|
|
//:Description
|
|
//
|
|
// Headerfile for system platform drivers
|
|
//
|
|
|
|
#ifndef _DRIVER_H
|
|
#define _DRIVER_H
|
|
|
|
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
#pragma warning( disable : 4996 )
|
|
|
|
#pragma once
|
|
#define _LIB_BUILD
|
|
#pragma message("Building driver")
|
|
|
|
|
|
/************************************************************************/
|
|
// Direct X 5 driver
|
|
// Drivercode taken from lowlevellib-1.0 for windows32
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WIN32_DX5)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "win32_dx5/sys_dx5.h"
|
|
#endif //SYS_PLATFORM_WIN32_DX5
|
|
|
|
/************************************************************************/
|
|
// Direct X 5 - plugin dll driver
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WIN32_PLUGIN)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "win32_plugin/sys_dx5plugin.h"
|
|
#endif //SYS_PLATFORM_WIN32_PLUGIN
|
|
|
|
/************************************************************************/
|
|
// GP2X driver
|
|
// using the "GP2X minimal library v0.B by rlyeh, (c) 2005."
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_GP2X_MINIMAL)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "gp2x_minimal/sys_minimal.h"
|
|
#endif //SYS_PLATFORM_GP2X_MINIMAL
|
|
|
|
|
|
/************************************************************************/
|
|
// GP2X driver
|
|
// using the "SDL 1.1 2005/11/03"
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_GP2X_SDL)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "gp2x_sdl/sys_sdl.h"
|
|
#endif //SYS_PLATFORM_GP2X_SDL
|
|
|
|
|
|
/************************************************************************/
|
|
// Generic Windows32 TEST DRIVER for GP2X MODE
|
|
//
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WIN32_GP2X)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "win32_gp2x/sys_w32gp2x.h"
|
|
#endif //SYS_PLATFORM_WIN32_GP2X
|
|
|
|
|
|
/************************************************************************/
|
|
// Win32 GDI Driver
|
|
// to support MFC, compile with Multithreaded DLL runtime
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WIN32_GDI)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "win32_gdi/sys_gdi.h"
|
|
#endif //SYS_PLATFORM_WIN32_GDI
|
|
|
|
|
|
/************************************************************************/
|
|
// WINDOWS CE PPC DRIVER
|
|
//
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WCE_PPC)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "wce_ppc/sys_ppc.h"
|
|
#endif //SYS_PLATFORM_WCE_PPC
|
|
|
|
|
|
/************************************************************************/
|
|
// First WINDOWS CE PPC DRIVER
|
|
//
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WCE_2002)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "wce_2002/sys_2002.h"
|
|
#endif //SYS_PLATFORM_WCE_2002
|
|
|
|
|
|
/************************************************************************/
|
|
// OPENGL Driver
|
|
//
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_WIN32_OPENGL)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "win32_ogl/sys_opengl.h"
|
|
#endif //SYS_PLATFORM_WCE_2002
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
// Generic driver
|
|
// This driver is a codebase for new driver implementations
|
|
/************************************************************************/
|
|
#if defined(SYS_PLATFORM_GENERIC)
|
|
#define SYS_PLATFORM_DEFINED
|
|
#include "generic/sys_generic.h"
|
|
#endif //SYS_PLATFORM_GENERIC
|
|
|
|
|
|
|
|
#if !defined(SYS_PLATFORM_DEFINED)
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#pragma message("ACHTUNG!!!!!!!!!!!!!!!!!!!! SYS_PLATFORM_???? !!!!!!!!!!! nicht gesetzt" )
|
|
#endif
|
|
|
|
|
|
#include "../llmem.h"
|
|
#include "../ll2d_srect.h"
|
|
#include "../llqueue.h"
|
|
#include "../llgfx_sscreen.h"
|
|
#include "../llgfx_stexture.h"
|
|
#include "../llsound.h"
|
|
#include "../llinput.h"
|
|
#include "../llfile.h"
|
|
#include "../llgfx_blit.h"
|
|
#include "../os_main.h"
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* DRIVER INTERFACE */
|
|
/************************************************************************/
|
|
|
|
// Context=Window handle, otherwise 0
|
|
void drv_irq_Init(void *context);
|
|
void drv_sound_Init(void *context);
|
|
void drv_input_Init(void *context);
|
|
|
|
void drv_irq_Exit();
|
|
void drv_sound_Exit();
|
|
void drv_input_Exit();
|
|
|
|
|
|
void * drv_mem_alloc( int size );
|
|
void drv_mem_free( void * ptr );
|
|
|
|
/*
|
|
* SOUND
|
|
*/
|
|
#define LLSOUND_ONESHOT (0)
|
|
#define LLSOUND_LOOP (0x1)
|
|
#define LLSOUND_STREAM (0x2)
|
|
void * drv_sound_LoadSoundBuffer(int stream, int mode);
|
|
void * drv_sound_CreateSoundBuffer(int size, int numchannels, int bitspersample, int samplefrequency );
|
|
int drv_sound_FillSoundBuffer(void *sndObj, int bytepos, int bytes, void* samples);
|
|
int drv_sound_LockSoundBuffer(void *sndObj, int bytepos, int bytes, void** ptr1, int *size1, void** ptr2, int *size2);
|
|
void drv_sound_UnlockSoundBuffer(void *sndObj, void *ptr1, int size1, void *ptr2, int size2);
|
|
void * drv_sound_CloneSoundBuffer(void * sndObj);
|
|
void drv_sound_ReleaseSoundBuffer( void * sndObj );
|
|
float drv_sound_GetPlayLength(void * sndObj);
|
|
float drv_sound_GetPlayTime(void * sndObj);
|
|
int drv_sound_GetPlayPosition(void * sndObj);
|
|
void drv_sound_SetPlayBackPosition(void * sndObj, float sec);
|
|
void drv_sound_SetPlayBackPosition(void * sndObj, int playpos);
|
|
void drv_sound_SetVolume( void * sndObj, float vol);
|
|
void drv_sound_SetFrequency( void * sndObj, int Hz);
|
|
void drv_sound_SetPan( void * sndObj, float panlr, float panfb);
|
|
int drv_sound_GetStatus(void * sndObj);
|
|
int drv_sound_Play(void * sndObj, int mode);
|
|
int drv_sound_Stop(void * sndObj);
|
|
void drv_sound_Init(void * context);
|
|
void drv_sound_Exit();
|
|
|
|
|
|
/*
|
|
* GFX
|
|
*/
|
|
void drv_gfx_Init(void *context);
|
|
void drv_gfx_Exit();
|
|
int drv_gfx_SetDisplayMode (int w, int h, int bpp, bool want_fullscreen, int refreshrate=0);
|
|
void drv_gfx_ReleaseMode();
|
|
void drv_gfx_FlipScreen (void * GFXOBJ, bool wait);
|
|
void * drv_gfx_CreateGfx (int width,int height);
|
|
void drv_gfx_DeleteGfx (void * GFXOBJ );
|
|
void drv_gfx_EnableColorKey (void * GFXOBJ);
|
|
void drv_gfx_DisableColorKey (void * GFXOBJ );
|
|
void drv_gfx_SetColorKey (void * GFXOBJ, TxU32 RGBColorValue);
|
|
void drv_gfx_SetZOrder(void * GFXOBJ, float z);
|
|
void drv_gfx_SetOrigin (void * GFXOBJ, float xoffset, float yoffset );
|
|
void * drv_gfx_GetGFXptr (void * GFXOBJ, llgfx_sSURFACE *surfacedesc );
|
|
void drv_gfx_UnGetGFXptr (void * GFXOBJ);
|
|
void * drv_gfx_GetMaskptr (void * GFXOBJ, llgfx_sSURFACE *surfacedesc );
|
|
void drv_gfx_UnGetMaskptr (void * GFXOBJ);
|
|
void drv_gfx_WaitVBI();
|
|
void * drv_gfx_GetBackBuffer();
|
|
void * drv_gfx_GetFrontBuffer();
|
|
void * drv_gfx_GetStretchBuffer();
|
|
|
|
/*
|
|
* Blitter
|
|
*/
|
|
int drv_blit_BLIT (void *GFXOBJDEST, void *GFXOBJSRC, float x, float y, s_rect *rect, int blitflags, s_blitfx *blitfx );
|
|
int drv_blit_s (void *GFXOBJDEST, void *GFXOBJSRC, int x, int y, s_rect *rect, int blitflags, s_blitfx *blitfx );
|
|
int drv_blit_Fx (void *GFXOBJDEST, void *GFXOBJSRC, int x, int y, s_rect *rect, int blitflags, TxU8 alpha, TxU32 color);
|
|
int drv_blit_Mask (void *GFXOBJDEST, void *GFXOBJSRC, int x, int y, s_rect *rect);
|
|
int drv_blit_BLITFast (void *GFXOBJDEST, void *GFXOBJSRC);
|
|
int drv_blit_Clear (void *GFXOBJ, TxU32 color, s_rect *dstrect );
|
|
int drv_blit_c (void *GFXOBJ, TxU32 color, s_rect *dstrect, int blitflags, s_blitfx *blitfx );
|
|
int drv_blit_Stretch (void *GFXOBJDEST, s_rect *dst_rect,
|
|
void *GFXOBJSRC, s_rect *src_rect,
|
|
s_rect *src_rect_uc, float x_scale, float y_scale);
|
|
int drv_blit_StretchMask( void *GFXOBJDEST, s_rect *dst_rect,
|
|
void *GFXOBJSRC, s_rect *src_rect,
|
|
s_rect *src_rect_uc, float x_scale, float y_scale);
|
|
int drv_blit_Rotate270( void *DOBJ, void *SOBJ, s_rect *src_rect, bool mask=false );
|
|
int drv_blit_Rotate90( void *DOBJ, void *SOBJ, s_rect *src_rect, bool mask=false );
|
|
|
|
|
|
/*
|
|
* TIMER
|
|
*/
|
|
void drv_irq_Init(void *context);
|
|
void drv_irq_Exit();
|
|
int drv_irq_GetTime();
|
|
void drv_irq_Sleep(int milliseconds);
|
|
void drv_irq_ResetTime();
|
|
float drv_irq_GetDeltaTime();
|
|
|
|
|
|
/*
|
|
* FILE IO
|
|
*/
|
|
int drv_fileread( void *ioBuf, int iNum, void *filehandle );
|
|
int drv_filewrite( void *ioBuf, int iNum, void *filehandle );
|
|
void * drv_fileopen( const char *filename, int mode );
|
|
int drv_fileexist( const char *filename );
|
|
void drv_fileclose( void *filehandle );
|
|
int drv_filesize( void *filehandle );
|
|
int drv_fileseek( void *filehandle, int iPos, int offset );
|
|
int drv_fileftell( void *filehandle);
|
|
|
|
int drv_path_cur_dir( char * buffer, int bufsize );
|
|
int drv_path_app_path( char * buffer, int bufsize );
|
|
int drv_path_app_dir( char * buffer, int bufsize );
|
|
int drv_path_app_name( char * buffer, int bufsize );
|
|
int drv_path_app_ext( char * buffer, int bufsize );
|
|
int drv_path_temp_dir( char * buffer, int bufsize );
|
|
int drv_path_temp_name( char * buffer, int bufsize );
|
|
|
|
void * drv_gotoUrl(const char * path);
|
|
void * drv_openProcess(const char * path);
|
|
|
|
int drv_tex_ReadTexture( llfile_sMAPFILE *stream, s_texture * texture, const char * filename );
|
|
int drv_tex_SaveScreenShot( const char *filename, s_texture * texture); // TXFMT_ARGB
|
|
|
|
|
|
/*
|
|
* INPUT
|
|
*/
|
|
extern TxU8 llinput_Keys[256];
|
|
extern int llinput_MouseX;
|
|
extern int llinput_MouseY;
|
|
extern int llinput_MouseZ;
|
|
extern int llinput_MouseRelX;
|
|
extern int llinput_MouseRelY;
|
|
extern int llinput_MouseRelZ;
|
|
extern TxU8 llinput_MouseBtn1;
|
|
extern TxU8 llinput_MouseBtn2;
|
|
extern TxU8 llinput_MouseBtn3;
|
|
extern TxU8 llinput_MouseBtn4;
|
|
extern queue<char> Input_Devices;
|
|
void drv_input_Update (); //no msg wait
|
|
void drv_input_Poll (); //msg wait
|
|
void drv_input_mouse_GetPosition( int *buffer );
|
|
void drv_input_mouse_SetPosition( int xpos, int ypos );
|
|
void drv_input_mouse_GetButtonStates( TxU8 *buffer, int bufsize );
|
|
void drv_input_keyboard_GetKeyStates( TxU8 *keybuffer, int bufsize );
|
|
void drv_input_keyboard_GetInput( TxU8 *inputbuffer, int bufsize );
|
|
int drv_input_joystick_getdata();
|
|
int drv_input_joystick_getstate();
|
|
void * drv_input_GetEvent(const char *devicename);
|
|
void drv_input_ResetEvent(const char *devicename);
|
|
void * drv_input_GetState(int eventid, const char *devicename);
|
|
|
|
|
|
#endif // ifndef _DRIVER_H
|