summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/menu.c')
-rw-r--r--apps/plugins/rockboy/menu.c66
1 files changed, 37 insertions, 29 deletions
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index ca15cba7b9..e358bafbb9 100644
--- a/apps/plugins/rockboy/menu.c
+++ b/apps/plugins/rockboy/menu.c
@@ -38,11 +38,14 @@ static void munge_name(char *buf, size_t bufsiz);
38 38
39int getbutton(char *text) 39int getbutton(char *text)
40{ 40{
41 rb->lcd_putsxy(0, 0, text); 41 int fw, fh;
42 rb->lcd_clear_display();
43 rb->font_getstringsize(text, &fw, &fh,0);
44 rb->lcd_putsxy(LCD_WIDTH/2-fw/2, LCD_HEIGHT/2-fh/2, text);
42 rb->lcd_update(); 45 rb->lcd_update();
43 rb->sleep(30); 46 rb->sleep(30);
44 47
45 while (rb->button_get(false) != BUTTON_NONE) 48 while (rb->button_get(false) != BUTTON_NONE)
46 rb->yield(); 49 rb->yield();
47 50
48 int button; 51 int button;
@@ -51,31 +54,24 @@ int getbutton(char *text)
51 button = rb->button_get(true); 54 button = rb->button_get(true);
52 button=button&0x00000FFF; 55 button=button&0x00000FFF;
53 56
54 switch(button) 57 return button;
55 {
56 case MENU_BUTTON_LEFT:
57 case MENU_BUTTON_RIGHT:
58 case MENU_BUTTON_UP:
59 case MENU_BUTTON_DOWN:
60 break;
61 default:
62 return button;
63 break;
64 }
65 } 58 }
66} 59}
67 60
68void setupkeys(void) 61void setupkeys(void)
69{ 62{
70 options.A=getbutton("Press A"); 63 options.UP=getbutton ("Press Up");
64 options.DOWN=getbutton ("Press Down");
65 options.LEFT=getbutton ("Press Left");
66 options.RIGHT=getbutton ("Press Right");
71 67
72 options.B=getbutton("Press B"); 68 options.A=getbutton ("Press A");
73 69 options.B=getbutton ("Press B");
74 options.START=getbutton("Press Start");
75 70
71 options.START=getbutton ("Press Start");
76 options.SELECT=getbutton("Press Select"); 72 options.SELECT=getbutton("Press Select");
77 73
78 options.MENU=getbutton("Press Menu"); 74 options.MENU=getbutton ("Press Menu");
79} 75}
80 76
81/* 77/*
@@ -330,12 +326,17 @@ static void do_opt_menu(void)
330 }; 326 };
331 327
332 static const struct opt_items fullscreen[]= { 328 static const struct opt_items fullscreen[]= {
333 { "Unscaled", -1 },
334 { "Scaled", -1 }, 329 { "Scaled", -1 },
335 { "Scaled - Maintain Ratio", -1 }, 330 { "Scaled - Maintain Ratio", -1 },
331#if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144)
332 { "Unscaled", -1 },
333#endif
336 }; 334 };
337 335
338 static const struct opt_items frameskip[]= { 336 static const struct opt_items frameskip[]= {
337 { "0 Max", -1 },
338 { "1 Max", -1 },
339 { "2 Max", -1 },
339 { "3 Max", -1 }, 340 { "3 Max", -1 },
340 { "4 Max", -1 }, 341 { "4 Max", -1 },
341 { "5 Max", -1 }, 342 { "5 Max", -1 },
@@ -368,7 +369,8 @@ static void do_opt_menu(void)
368 { "Max Frameskip", NULL }, 369 { "Max Frameskip", NULL },
369 { "Sound" , NULL }, 370 { "Sound" , NULL },
370 { "Stats" , NULL }, 371 { "Stats" , NULL },
371 { "Screen Options" , NULL }, 372 { "Screen Size" , NULL },
373 { "Screen Rotate" , NULL },
372 { "Set Keys (Buggy)", NULL }, 374 { "Set Keys (Buggy)", NULL },
373#ifdef HAVE_LCD_COLOR 375#ifdef HAVE_LCD_COLOR
374 { "Set Palette" , NULL }, 376 { "Set Palette" , NULL },
@@ -377,6 +379,8 @@ static void do_opt_menu(void)
377 379
378 m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); 380 m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
379 381
382 options.dirty=1; /* Just assume that the settings have been changed */
383
380 while(!done) 384 while(!done)
381 { 385 {
382 386
@@ -385,9 +389,8 @@ static void do_opt_menu(void)
385 switch (result) 389 switch (result)
386 { 390 {
387 case 0: /* Frameskip */ 391 case 0: /* Frameskip */
388 options.maxskip-=3; 392 rb->set_option(items[0].desc, &options.maxskip, INT, frameskip,
389 rb->set_option(items[0].desc, &options.maxskip, INT, frameskip, 4, NULL ); 393 sizeof(frameskip)/sizeof(*frameskip), NULL );
390 options.maxskip+=3;
391 break; 394 break;
392 case 1: /* Sound */ 395 case 1: /* Sound */
393 if(options.sound>1) options.sound=1; 396 if(options.sound>1) options.sound=1;
@@ -397,16 +400,21 @@ static void do_opt_menu(void)
397 case 2: /* Stats */ 400 case 2: /* Stats */
398 rb->set_option(items[2].desc, &options.showstats, INT, onoff, 2, NULL ); 401 rb->set_option(items[2].desc, &options.showstats, INT, onoff, 2, NULL );
399 break; 402 break;
400 case 3: /* Fullscreen */ 403 case 3: /* Screen Size */
401 rb->set_option(items[3].desc, &options.fullscreen, INT, fullscreen, 3, NULL ); 404 rb->set_option(items[3].desc, &options.fullscreen, INT, fullscreen,
402 setvidmode(options.fullscreen); 405 sizeof(fullscreen)/sizeof(*fullscreen), NULL );
406 setvidmode();
407 break;
408 case 4: /* Screen rotate */
409 rb->set_option(items[4].desc, &options.rotate, INT, onoff, 2, NULL );
410 setvidmode();
403 break; 411 break;
404 case 4: /* Keys */ 412 case 5: /* Keys */
405 setupkeys(); 413 setupkeys();
406 break; 414 break;
407#ifdef HAVE_LCD_COLOR 415#ifdef HAVE_LCD_COLOR
408 case 5: /* Palette */ 416 case 6: /* Palette */
409 rb->set_option(items[5].desc, &options.pal, INT, palette, 17, NULL ); 417 rb->set_option(items[6].desc, &options.pal, INT, palette, 17, NULL );
410 set_pal(); 418 set_pal();
411 break; 419 break;
412#endif 420#endif