| 1 | /* |
| 2 | GP2X minimal library v0.5 by rlyeh, 2005. |
| 3 | |
| 4 | + GP2X video library with double buffering. |
| 5 | + GP2X soundring buffer library with double buffering. |
| 6 | + GP2X joystick library. |
| 7 | |
| 8 | Thanks to Squidge, Robster, snaff and NK, for the help & previous work! :-) |
| 9 | |
| 10 | |
| 11 | What's new |
| 12 | ========== |
| 13 | |
| 14 | 0.5: patched sound for real stereo (using NK's solution); better init code. |
| 15 | |
| 16 | 0.4: lots of cleanups; sound is threaded now, double buffered too; 8 bpp video support; better exiting code. |
| 17 | |
| 18 | 0.3: shorter library; improved joystick diagonal detection. |
| 19 | |
| 20 | 0.2: better code layout; public release. |
| 21 | |
| 22 | 0.1: beta release |
| 23 | */ |
| 24 | |
| 25 | /* .h by Hermes/PS2Reality*/ |
| 26 | |
| 27 | #if !defined(GP2XMINILIB) |
| 28 | #define GP2XMINILIB |
| 29 | |
| 30 | enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40, |
| 31 | GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11, |
| 32 | GP2X_A=1<<12, GP2X_B=1<<13, GP2X_X=1<<14, GP2X_Y=1<<15, |
| 33 | GP2X_VOL_UP=1<<22, GP2X_VOL_DOWN=1<<23, GP2X_PUSH=1<<27, }; |
| 34 | |
| 35 | #define gp2x_video_color15(R,G,B,A) (((R&0xF8)<<8)|((G&0xF8)<<3)|((B&0xF8)>>3)|(A<<5)) |
| 36 | #define gp2x_video_color8 (C,R,G,B) gp2x_palette[C][0]=(G<<8)|B,gp2x_palette[C][1]=R; |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | extern unsigned short *gp2x_memregs, *gp2x_screen15, *gp2x_logvram15[2], gp2x_sound_buffer[4+(44100*2)*4]; //*2=stereo, *4=max buffers |
| 43 | |
| 44 | |
| 45 | |
| 46 | extern unsigned long gp2x_dev[4]; |
| 47 | |
| 48 | |
| 49 | void gp2x_video_flip(void); |
| 50 | void gp2x_video_setpalette(void); |
| 51 | unsigned long gp2x_joystick_read(void); |
| 52 | void *gp2x_sound_play(void *blah); |
| 53 | void gp2x_deinit(void); |
| 54 | void gp2x_init(int bpp, int rate, int bits, int stereo, int Hz); |
| 55 | |
| 56 | |
| 57 | |
| 58 | #endif |