diff options
Diffstat (limited to 'apps/plugins/rockboy/sys_rockbox.c')
-rw-r--r-- | apps/plugins/rockboy/sys_rockbox.c | 129 |
1 files changed, 39 insertions, 90 deletions
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c index fb118162b2..40f68681d8 100644 --- a/apps/plugins/rockboy/sys_rockbox.c +++ b/apps/plugins/rockboy/sys_rockbox.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include "rockmacros.h" | 20 | #include "rockmacros.h" |
21 | #include "fb.h" | 21 | #include "fb.h" |
22 | #include "input.h" | 22 | #include "input.h" |
23 | #include "rc.h" | ||
24 | #include "lcd-gb.h" | 23 | #include "lcd-gb.h" |
25 | #include "hw.h" | 24 | #include "hw.h" |
26 | #include "config.h" | 25 | #include "config.h" |
@@ -32,6 +31,13 @@ | |||
32 | #define ROCKBOY_PAD_UP BUTTON_MENU | 31 | #define ROCKBOY_PAD_UP BUTTON_MENU |
33 | #define ROCKBOY_PAD_DOWN BUTTON_PLAY | 32 | #define ROCKBOY_PAD_DOWN BUTTON_PLAY |
34 | 33 | ||
34 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) | ||
35 | |||
36 | #define ROCKBOY_PAD_LEFT BUTTON_LEFT | ||
37 | #define ROCKBOY_PAD_RIGHT BUTTON_RIGHT | ||
38 | #define ROCKBOY_PAD_UP BUTTON_SCROLL_UP | ||
39 | #define ROCKBOY_PAD_DOWN BUTTON_SCROLL_DOWN | ||
40 | |||
35 | #else | 41 | #else |
36 | 42 | ||
37 | #define ROCKBOY_PAD_LEFT BUTTON_LEFT | 43 | #define ROCKBOY_PAD_LEFT BUTTON_LEFT |
@@ -41,33 +47,10 @@ | |||
41 | 47 | ||
42 | #endif | 48 | #endif |
43 | 49 | ||
44 | rcvar_t joy_exports[] = | 50 | struct fb fb IBSS_ATTR; |
45 | { | ||
46 | RCV_END | ||
47 | }; | ||
48 | |||
49 | rcvar_t vid_exports[] = | ||
50 | { | ||
51 | RCV_END | ||
52 | }; | ||
53 | |||
54 | struct fb fb; | ||
55 | 51 | ||
56 | extern int debug_trace; | 52 | extern int debug_trace; |
57 | 53 | ||
58 | void vid_settitle(char *title) | ||
59 | { | ||
60 | rb->splash(HZ/2, true, title); | ||
61 | } | ||
62 | |||
63 | void joy_init(void) | ||
64 | { | ||
65 | } | ||
66 | |||
67 | void joy_close(void) | ||
68 | { | ||
69 | } | ||
70 | |||
71 | unsigned int oldbuttonstate = 0, newbuttonstate,holdbutton; | 54 | unsigned int oldbuttonstate = 0, newbuttonstate,holdbutton; |
72 | #ifdef HAVE_WHEEL_POSITION | 55 | #ifdef HAVE_WHEEL_POSITION |
73 | int oldwheel = -1, wheel; | 56 | int oldwheel = -1, wheel; |
@@ -179,10 +162,7 @@ void ev_poll(void) | |||
179 | if(pressed & options.MENU) { | 162 | if(pressed & options.MENU) { |
180 | #endif | 163 | #endif |
181 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 164 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
182 | (CONFIG_KEYPAD == IRIVER_H300_PAD) || \ | 165 | defined(HAVE_LCD_COLOR) |
183 | (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
184 | (CONFIG_KEYPAD == GIGABEAT_PAD) || \ | ||
185 | (CONFIG_KEYPAD == SANSA_E200_PAD) | ||
186 | #ifdef HAVE_WHEEL_POSITION | 166 | #ifdef HAVE_WHEEL_POSITION |
187 | rb->wheel_send_events(true); | 167 | rb->wheel_send_events(true); |
188 | #endif | 168 | #endif |
@@ -202,53 +182,36 @@ void ev_poll(void) | |||
202 | #endif | 182 | #endif |
203 | } | 183 | } |
204 | 184 | ||
205 | void vid_setpal(int i, int r, int g, int b) | 185 | /* New frameskip, makes more sense to me and performs as well */ |
186 | inline void vid_begin(void) | ||
206 | { | 187 | { |
207 | (void)i; | 188 | static int skip = 0; |
208 | (void)r; | 189 | if (skip<options.frameskip) |
209 | (void)g; | 190 | { |
210 | (void)b; | 191 | skip++; |
211 | } | 192 | fb.enabled=0; |
212 | 193 | } | |
213 | inline void vid_begin(void) // New frameskip, makes more sense to me and performs as well | 194 | else |
214 | { | 195 | { |
215 | static int skip = 0; | 196 | skip=0; |
216 | if (skip<options.frameskip) { | 197 | fb.enabled=1; |
217 | skip++; | 198 | } |
218 | fb.enabled=0; | ||
219 | } | ||
220 | else { | ||
221 | skip=0; | ||
222 | fb.enabled=1; | ||
223 | } | ||
224 | } | 199 | } |
225 | 200 | ||
226 | void vid_init(void) | 201 | void vid_init(void) |
227 | { | 202 | { |
228 | fb.h=144; | ||
229 | fb.w=160; | ||
230 | fb.pitch=160; | ||
231 | fb.enabled=1; | 203 | fb.enabled=1; |
232 | fb.dirty=0; | 204 | fb.ptr=rb->lcd_framebuffer; |
233 | fb.mode=3; | ||
234 | |||
235 | fb.ptr=rb->lcd_framebuffer; | ||
236 | 205 | ||
237 | #if defined(HAVE_LCD_COLOR) | 206 | #if defined(HAVE_LCD_COLOR) |
238 | fb.pelsize=2; // 16 bit framebuffer | 207 | fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */ |
239 | 208 | fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */ | |
240 | fb.indexed = 0; // no palette on lcd | 209 | fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */ |
241 | fb.cc[0].r = 3; // 8-5 (wasted bits on red) | 210 | fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */ |
242 | fb.cc[0].l = 11; //this is the offset to the R bits (16-5) | 211 | fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */ |
243 | fb.cc[1].r = 2; // 8-6 (wasted bits on green) | 212 | fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */ |
244 | fb.cc[1].l = 5; // This is the offset to the G bits (16-5-6) | 213 | #else |
245 | fb.cc[2].r = 3; // 8-5 (wasted bits on red) | 214 | fb.mode=3; |
246 | fb.cc[2].l = 0; // This is the offset to the B bits (16-5-6-5) | ||
247 | fb.cc[3].r = 0; // no alpha | ||
248 | fb.cc[3].l = 0; | ||
249 | fb.yuv = 0; // not in yuv format | ||
250 | #else // ***** NEED TO LOOK INTO THIS MORE FOR THE H100 (Should be able to get rid of some IFDEF's elsewhere) | ||
251 | fb.pelsize=1; // 8 bit framebuffer.. (too much.. but lowest gnuboy will support.. so yea... | ||
252 | #endif | 215 | #endif |
253 | } | 216 | } |
254 | 217 | ||
@@ -350,43 +313,29 @@ void vid_update(int scanline) | |||
350 | cnt++; | 313 | cnt++; |
351 | } | 314 | } |
352 | rb->lcd_update_rect(0, scanline & ~3, LCD_WIDTH, 4); | 315 | rb->lcd_update_rect(0, scanline & ~3, LCD_WIDTH, 4); |
353 | #elif defined(HAVE_LCD_COLOR) /* iriver H3x0, colour iPod */ | 316 | #elif defined(HAVE_LCD_COLOR) |
354 | // handled in lcd.c now | 317 | /* handled in lcd.c now */ |
355 | #endif /* LCD_HEIGHT */ | 318 | #endif /* LCD_HEIGHT */ |
356 | } | 319 | } |
357 | #endif | 320 | #endif |
358 | 321 | ||
359 | void vid_end(void) | ||
360 | { | ||
361 | } | ||
362 | |||
363 | long timerresult; | 322 | long timerresult; |
364 | 323 | ||
365 | void *sys_timer(void) | 324 | void *sys_timer(void) |
366 | {/* | 325 | { |
367 | timerresult=*rb->current_tick; | 326 | /*timerresult=*rb->current_tick; |
368 | return &timerresult;*/ | 327 | return &timerresult;*/ |
369 | return 0; | 328 | return 0; |
370 | } | 329 | } |
371 | 330 | ||
372 | // returns microseconds passed since sys_timer | 331 | /* returns microseconds passed since sys_timer */ |
373 | int sys_elapsed(long *oldtick) | 332 | int sys_elapsed(long *oldtick) |
374 | { | 333 | { |
375 | /* | 334 | /* int elap,mytime=microtick; |
376 | int elap,mytime=microtick; | ||
377 | 335 | ||
378 | elap=mytime-*oldtick; | 336 | elap=mytime-*oldtick; |
379 | *oldtick=mytime; | 337 | *oldtick=mytime; |
380 | return elap;*/ | 338 | return elap; */ |
381 | // return ((*rb->current_tick-(*oldtick))*1000000)/HZ; | 339 | /* return ((*rb->current_tick-(*oldtick))*1000000)/HZ; */ |
382 | return *oldtick; | 340 | return *oldtick; |
383 | } | 341 | } |
384 | |||
385 | void sys_sleep(int us) | ||
386 | { | ||
387 | if(us<=0) return; | ||
388 | int i=0; | ||
389 | while(i< us*11) | ||
390 | i++; | ||
391 | // if (us <= 0) return; | ||
392 | } | ||