bugfix2
[picodrive.git] / platform / common / common.h
CommitLineData
f579f7b8 1// platform specific things for common menu code
2
1fb0dd88 3/* TODO: get rid of this file */
4
f579f7b8 5#ifdef __GP2X__
6#include "../gp2x/gp2x.h"
7
217d08bc 8// TODO merge
9#define PBTN_UP (1 << 0)
10#define PBTN_DOWN (1 << 1)
11#define PBTN_LEFT (1 << 2)
12#define PBTN_RIGHT (1 << 3)
13
14#define PBTN_NORTH (1 << 4)
15#define PBTN_SOUTH (1 << 5)
16#define PBTN_WEST (1 << 6)
17#define PBTN_EAST (1 << 7)
18#define PBTN_L (1 << 8)
19#define PBTN_R (1 << 9)
20
21/* menu nav */
22#define PBTN_MOK PBTN_EAST
23#define PBTN_MBACK PBTN_SOUTH
24#define PBTN_MENU (1 << 10)
25
26#if 0
e5ab6faf 27#define PBTN_UP GP2X_UP
28#define PBTN_DOWN GP2X_DOWN
29#define PBTN_LEFT GP2X_LEFT
30#define PBTN_RIGHT GP2X_RIGHT
31
32#define PBTN_NORTH GP2X_Y
33#define PBTN_SOUTH GP2X_X
34#define PBTN_WEST GP2X_A
35#define PBTN_EAST GP2X_B
36#define PBTN_L GP2X_L
37#define PBTN_R GP2X_R
f579f7b8 38
b6820926 39/* menu nav */
40#define PBTN_MOK GP2X_B
41#define PBTN_MBACK GP2X_X
42#define PBTN_MENU GP2X_SELECT
217d08bc 43#endif
44#define GP2X_Y 0 /* FIXME */
b6820926 45
f579f7b8 46void gp2x_pd_clone_buffer2(void);
47void menu_darken_bg(void *dst, int pixels, int darker);
48void menu_flip(void);
49
50#define SCREEN_WIDTH 320
51#define SCREEN_HEIGHT 240
52#define SCREEN_BUFFER gp2x_screen
53
f579f7b8 54#define menu_draw_begin() \
55 gp2x_pd_clone_buffer2()
56#define clear_screen() \
57 memset(gp2x_screen, 0, 320*240*2)
58#define darken_screen() \
59 menu_darken_bg(gp2x_screen, 320*240, 0)
60#define menu_draw_end() \
61 menu_flip()
62
63// ------------------------------------
64
65#elif defined(__GIZ__)
66
84100c0f 67#include "../gizmondo/giz.h"
68
e5ab6faf 69#define PBTN_NORTH PBTN_STOP
70#define PBTN_SOUTH PBTN_PLAY
71#define PBTN_WEST PBTN_REW
72#define PBTN_EAST PBTN_FWD
84100c0f 73
84100c0f 74void menu_draw_begin(int use_bgbuff);
75void menu_darken_bg(void *dst, const void *src, int pixels, int darker);
76void menu_draw_end(void);
77
78#define SCREEN_WIDTH 321
79#define SCREEN_HEIGHT 240
80#define SCREEN_BUFFER ((giz_screen != NULL) ? giz_screen : menu_screen)
81extern void *menu_screen;
82extern void *giz_screen;
83
84100c0f 84#define menu_draw_begin() \
85 menu_draw_begin(1)
86#define clear_screen() \
87 memset(SCREEN_BUFFER, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2)
88#define darken_screen() \
89 menu_darken_bg(menu_screen, menu_screen, SCREEN_WIDTH*SCREEN_HEIGHT, 0)
f579f7b8 90
91// ------------------------------------
92
93#elif defined(PSP)
94
95#include "../psp/psp.h"
96
e5ab6faf 97#define PBTN_NORTH PBTN_TRIANGLE
98#define PBTN_SOUTH PBTN_X
99#define PBTN_WEST PBTN_SQUARE
100#define PBTN_EAST PBTN_CIRCLE
f579f7b8 101
f579f7b8 102void menu_draw_begin(void);
103void menu_darken_bg(void *dst, const void *src, int pixels, int darker);
104void menu_draw_end(void);
105
106#define SCREEN_WIDTH 512
107#define SCREEN_HEIGHT 272
108#define SCREEN_BUFFER psp_screen
109
f579f7b8 110#define clear_screen() \
111 memset(SCREEN_BUFFER, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2)
112#define darken_screen() \
113 menu_darken_bg(psp_screen, psp_screen, SCREEN_WIDTH*SCREEN_HEIGHT, 0)
114
3a3947cd 115// ------------------------------------
116
117#elif defined(PANDORA)
118
3b13ec65 119#define PBTN_UP (1 << 0)
120#define PBTN_DOWN (1 << 1)
121#define PBTN_LEFT (1 << 2)
122#define PBTN_RIGHT (1 << 3)
123
124#define PBTN_NORTH (1 << 4)
125#define PBTN_SOUTH (1 << 5)
126#define PBTN_WEST (1 << 6)
127#define PBTN_EAST (1 << 7)
128#define PBTN_L (1 << 8)
129#define PBTN_R (1 << 9)
3a3947cd 130
b6820926 131/* menu nav */
132#define PBTN_MOK PBTN_EAST
133#define PBTN_MBACK PBTN_SOUTH
134#define PBTN_MENU (1 << 10)
135
3a3947cd 136void gp2x_pd_clone_buffer2(void);
137void menu_darken_bg(void *dst, int pixels, int darker);
138void menu_flip(void);
139
b6820926 140extern void *gp2x_screen;
141
e55f0cbb 142#define SCREEN_WIDTH 800
143#define SCREEN_HEIGHT 480
3a3947cd 144#define SCREEN_BUFFER gp2x_screen
145
3a3947cd 146#define menu_draw_begin() \
147 gp2x_pd_clone_buffer2()
148#define clear_screen() \
e55f0cbb 149 memset(gp2x_screen, 0, 800*480*2)
3a3947cd 150#define darken_screen() \
e55f0cbb 151 menu_darken_bg(gp2x_screen, 800*480, 0)
3a3947cd 152#define menu_draw_end() \
153 menu_flip()
154
f579f7b8 155#endif