diff options
author | Johannes Schwarz <ubuntuxer@rockbox.org> | 2009-06-26 17:59:33 +0000 |
---|---|---|
committer | Johannes Schwarz <ubuntuxer@rockbox.org> | 2009-06-26 17:59:33 +0000 |
commit | 73d25744fb01844cc28402dfc4b48a030d270579 (patch) | |
tree | 34a3e43d7160f263178928553644cf3392a6341b /apps | |
parent | c2565c9bcf02b8b9fe0311a15a731dde449c1552 (diff) | |
download | rockbox-73d25744fb01844cc28402dfc4b48a030d270579.tar.gz rockbox-73d25744fb01844cc28402dfc4b48a030d270579.zip |
FS#10283 simplify plugins' menus by using stringlist with callback (by Teruaki Kawashima - some minor changes by myself)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21523 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/menu.c | 3 | ||||
-rw-r--r-- | apps/plugins/calendar.c | 27 | ||||
-rw-r--r-- | apps/plugins/chopper.c | 28 | ||||
-rw-r--r-- | apps/plugins/keybox.c | 26 | ||||
-rw-r--r-- | apps/plugins/mazezam.c | 59 | ||||
-rw-r--r-- | apps/plugins/solitaire.c | 57 | ||||
-rw-r--r-- | apps/plugins/xobox.c | 108 |
7 files changed, 124 insertions, 184 deletions
diff --git a/apps/menu.c b/apps/menu.c index c49650d941..653dc09aec 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -81,7 +81,8 @@ static void get_menu_callback(const struct menu_item_ex *m, | |||
81 | static int get_menu_selection(int selected_item, const struct menu_item_ex *menu) | 81 | static int get_menu_selection(int selected_item, const struct menu_item_ex *menu) |
82 | { | 82 | { |
83 | int type = (menu->flags&MENU_TYPE_MASK); | 83 | int type = (menu->flags&MENU_TYPE_MASK); |
84 | if (type == MT_MENU && (selected_item<current_subitems_count)) | 84 | if ((type == MT_MENU || type == MT_RETURN_ID) |
85 | && (selected_item<current_subitems_count)) | ||
85 | return current_subitems[selected_item]; | 86 | return current_subitems[selected_item]; |
86 | return selected_item; | 87 | return selected_item; |
87 | } | 88 | } |
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 72b572e7eb..873a09b970 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -627,8 +627,9 @@ static void add_memo(struct shown *shown, int type) | |||
627 | 627 | ||
628 | static int edit_menu_cb(int action, const struct menu_item_ex *this_item) | 628 | static int edit_menu_cb(int action, const struct menu_item_ex *this_item) |
629 | { | 629 | { |
630 | (void) this_item; | 630 | int i = (intptr_t)this_item; |
631 | if (action == ACTION_REQUEST_MENUITEM && memos_in_shown_memory <= 0) | 631 | if (action == ACTION_REQUEST_MENUITEM |
632 | && memos_in_shown_memory <= 0 && (i==0 || i==1)) | ||
632 | return ACTION_EXIT_MENUITEM; | 633 | return ACTION_EXIT_MENUITEM; |
633 | return action; | 634 | return action; |
634 | } | 635 | } |
@@ -638,24 +639,10 @@ static bool edit_memo(int change, struct shown *shown) | |||
638 | bool exit = false; | 639 | bool exit = false; |
639 | int selected = 0; | 640 | int selected = 0; |
640 | 641 | ||
641 | MENUITEM_RETURNVALUE(edit_menu_remove, "Remove", 0, | 642 | MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb, |
642 | edit_menu_cb, Icon_NOICON); | 643 | "Remove", "Edit", |
643 | MENUITEM_RETURNVALUE(edit_menu_edit, "Edit", 1, | 644 | "New Weekly", "New Monthly", |
644 | edit_menu_cb, Icon_NOICON); | 645 | "New Yearly", "New One off"); |
645 | MENUITEM_RETURNVALUE(edit_menu_weekly, "New Weekly", 2, | ||
646 | NULL, Icon_NOICON); | ||
647 | MENUITEM_RETURNVALUE(edit_menu_monthly, "New Monthly", 3, | ||
648 | NULL, Icon_NOICON); | ||
649 | MENUITEM_RETURNVALUE(edit_menu_yearly, "New Yearly", 4, | ||
650 | NULL, Icon_NOICON); | ||
651 | MENUITEM_RETURNVALUE(edit_menu_oneoff, "New One off", 5, | ||
652 | NULL, Icon_NOICON); | ||
653 | |||
654 | MAKE_MENU(edit_menu, "Edit menu", | ||
655 | NULL, Icon_NOICON, | ||
656 | &edit_menu_remove, &edit_menu_edit, | ||
657 | &edit_menu_weekly, &edit_menu_monthly, | ||
658 | &edit_menu_yearly, &edit_menu_oneoff); | ||
659 | 646 | ||
660 | while (!exit) | 647 | while (!exit) |
661 | { | 648 | { |
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 2c1ee477eb..54a1ae0bfe 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c | |||
@@ -700,9 +700,17 @@ static void chopDrawScene(void) | |||
700 | rb->lcd_update(); | 700 | rb->lcd_update(); |
701 | } | 701 | } |
702 | 702 | ||
703 | static bool _ingame; | ||
704 | static int chopMenuCb(int action, const struct menu_item_ex *this_item) | ||
705 | { | ||
706 | if(action == ACTION_REQUEST_MENUITEM | ||
707 | && !_ingame && ((intptr_t)this_item)==0) | ||
708 | return ACTION_EXIT_MENUITEM; | ||
709 | return action; | ||
710 | } | ||
703 | static int chopMenu(int menunum) | 711 | static int chopMenu(int menunum) |
704 | { | 712 | { |
705 | int result = (menunum==0)?0:1; | 713 | int result = 0; |
706 | int res = 0; | 714 | int res = 0; |
707 | bool menu_quit = false; | 715 | bool menu_quit = false; |
708 | 716 | ||
@@ -711,8 +719,10 @@ static int chopMenu(int menunum) | |||
711 | { "Steep", -1 }, | 719 | { "Steep", -1 }, |
712 | }; | 720 | }; |
713 | 721 | ||
714 | MENUITEM_STRINGLIST(menu,"Chopper Menu",NULL,"Start New Game","Resume Game", | 722 | MENUITEM_STRINGLIST(menu,"Chopper Menu",chopMenuCb, |
723 | "Resume Game","Start New Game", | ||
715 | "Level","Playback Control","Quit"); | 724 | "Level","Playback Control","Quit"); |
725 | _ingame = (menunum!=0); | ||
716 | 726 | ||
717 | #ifdef HAVE_LCD_COLOR | 727 | #ifdef HAVE_LCD_COLOR |
718 | rb->lcd_set_foreground(LCD_WHITE); | 728 | rb->lcd_set_foreground(LCD_WHITE); |
@@ -727,18 +737,14 @@ static int chopMenu(int menunum) | |||
727 | while (!menu_quit) { | 737 | while (!menu_quit) { |
728 | switch(rb->do_menu(&menu, &result, NULL, false)) | 738 | switch(rb->do_menu(&menu, &result, NULL, false)) |
729 | { | 739 | { |
730 | case 0: /* Start New Game */ | 740 | case 0: /* Resume Game */ |
731 | menu_quit=true; | 741 | menu_quit=true; |
732 | chopper_load(true); | ||
733 | res = -1; | 742 | res = -1; |
734 | break; | 743 | break; |
735 | case 1: /* Resume Game */ | 744 | case 1: /* Start New Game */ |
736 | if(menunum==1) { | 745 | menu_quit=true; |
737 | menu_quit=true; | 746 | chopper_load(true); |
738 | res = -1; | 747 | res = -1; |
739 | } else if(menunum==0){ | ||
740 | rb->splash(HZ, "No game to resume"); | ||
741 | } | ||
742 | break; | 748 | break; |
743 | case 2: | 749 | case 2: |
744 | rb->set_option("Level", &iLevelMode, INT, levels, 2, NULL); | 750 | rb->set_option("Level", &iLevelMode, INT, levels, 2, NULL); |
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 5d625a33a2..08d5131eff 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c | |||
@@ -71,7 +71,6 @@ static uint32_t salt; | |||
71 | static union hash pwhash; | 71 | static union hash pwhash; |
72 | static bool data_changed = false; | 72 | static bool data_changed = false; |
73 | 73 | ||
74 | static int context_item_cb(int action, const struct menu_item_ex *this_item); | ||
75 | static void encrypt_buffer(char *buf, size_t size, uint32_t *key); | 74 | static void encrypt_buffer(char *buf, size_t size, uint32_t *key); |
76 | static void decrypt_buffer(char *buf, size_t size, uint32_t *key); | 75 | static void decrypt_buffer(char *buf, size_t size, uint32_t *key); |
77 | 76 | ||
@@ -105,35 +104,22 @@ static void decrypt(uint32_t* v, uint32_t* k) | |||
105 | v[0]=v0; v[1]=v1; | 104 | v[0]=v0; v[1]=v1; |
106 | } | 105 | } |
107 | 106 | ||
108 | MENUITEM_RETURNVALUE(context_add_entry, "Add entry", 0, | ||
109 | NULL, Icon_NOICON); | ||
110 | MENUITEM_RETURNVALUE(context_edit_title, "Edit title", 1, | ||
111 | &context_item_cb, Icon_NOICON); | ||
112 | MENUITEM_RETURNVALUE(context_edit_name, "Edit user name", 2, | ||
113 | &context_item_cb, Icon_NOICON); | ||
114 | MENUITEM_RETURNVALUE(context_edit_password, "Edit password", 3, | ||
115 | &context_item_cb, Icon_NOICON); | ||
116 | MENUITEM_RETURNVALUE(context_delete_entry, "Delete entry", 4, | ||
117 | &context_item_cb, Icon_NOICON); | ||
118 | MENUITEM_RETURNVALUE(context_debug, "debug", 5, | ||
119 | &context_item_cb, Icon_NOICON); | ||
120 | |||
121 | MAKE_MENU(context_m, "Context menu", | ||
122 | context_item_cb, Icon_NOICON, | ||
123 | &context_add_entry, &context_edit_title, &context_edit_name, | ||
124 | &context_edit_password, &context_delete_entry); | ||
125 | |||
126 | static int context_item_cb(int action, const struct menu_item_ex *this_item) | 107 | static int context_item_cb(int action, const struct menu_item_ex *this_item) |
127 | { | 108 | { |
128 | if (action == ACTION_REQUEST_MENUITEM | 109 | if (action == ACTION_REQUEST_MENUITEM |
129 | && pw_list.num_entries == 0 | 110 | && pw_list.num_entries == 0 |
130 | && this_item != &context_add_entry) | 111 | && ((intptr_t)this_item) != 0) |
131 | { | 112 | { |
132 | return ACTION_EXIT_MENUITEM; | 113 | return ACTION_EXIT_MENUITEM; |
133 | } | 114 | } |
134 | return action; | 115 | return action; |
135 | } | 116 | } |
136 | 117 | ||
118 | MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb, | ||
119 | "Add entry", | ||
120 | "Edit title", "Edit user name", "Edit password", | ||
121 | "Delete entry") | ||
122 | |||
137 | static char * kb_list_cb(int selected_item, void *data, | 123 | static char * kb_list_cb(int selected_item, void *data, |
138 | char *buffer, size_t buffer_len) | 124 | char *buffer, size_t buffer_len) |
139 | { | 125 | { |
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 2e79567740..ac7e651fbc 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c | |||
@@ -52,13 +52,12 @@ const struct button_mapping *plugin_contexts[] | |||
52 | #define MAZEZAM_TEXT_WELLDONE_OPTION "Goodbye" | 52 | #define MAZEZAM_TEXT_WELLDONE_OPTION "Goodbye" |
53 | #define MAZEZAM_TEXT_MAZEZAM_MENU "MazezaM Menu" | 53 | #define MAZEZAM_TEXT_MAZEZAM_MENU "MazezaM Menu" |
54 | #define MAZEZAM_TEXT_RETRY_LEVEL "Retry level" | 54 | #define MAZEZAM_TEXT_RETRY_LEVEL "Retry level" |
55 | #define MAZEZAM_TEXT_AUDIO_PLAYBACK "Audio playback" | 55 | #define MAZEZAM_TEXT_AUDIO_PLAYBACK "Playback Control" |
56 | #define MAZEZAM_TEXT_QUIT "Quit" | 56 | #define MAZEZAM_TEXT_QUIT "Quit" |
57 | #define MAZEZAM_TEXT_BACK "Return" | 57 | #define MAZEZAM_TEXT_BACK "Resume Game" |
58 | #define MAZEZAM_TEXT_MAIN_MENU "MazezaM" | 58 | #define MAZEZAM_TEXT_MAIN_MENU "MazezaM" |
59 | #define MAZEZAM_TEXT_CONTINUE "Play from checkpoint" | 59 | #define MAZEZAM_TEXT_CONTINUE "Play from checkpoint" |
60 | #define MAZEZAM_TEXT_PLAY_GAME "Play game" | 60 | #define MAZEZAM_TEXT_PLAY_NEW_GAME "Start New Game" |
61 | #define MAZEZAM_TEXT_PLAY_NEW_GAME "Play new game" | ||
62 | 61 | ||
63 | #define MAZEZAM_START_LIVES 3 /* how many lives at game start */ | 62 | #define MAZEZAM_START_LIVES 3 /* how many lives at game start */ |
64 | #define MAZEZAM_FIRST_CHECKPOINT 3 /* The level at the first checkpoint */ | 63 | #define MAZEZAM_FIRST_CHECKPOINT 3 /* The level at the first checkpoint */ |
@@ -838,31 +837,16 @@ static void resume_save_data (struct resume_data *r, struct resume_data *old) | |||
838 | } | 837 | } |
839 | 838 | ||
840 | /***************************************************************************** | 839 | /***************************************************************************** |
841 | * Offer a main menu with no continue option | 840 | * Manages the main menu |
842 | ******************************************************************************/ | ||
843 | static int main_menu_without_continue(int* start_selection) | ||
844 | { | ||
845 | MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,NULL, | ||
846 | MAZEZAM_TEXT_PLAY_GAME, | ||
847 | MAZEZAM_TEXT_QUIT); | ||
848 | return rb->do_menu(&menu, start_selection, NULL, false); | ||
849 | } | ||
850 | |||
851 | /***************************************************************************** | ||
852 | * Offer a main menu with a continue option | ||
853 | ******************************************************************************/ | 841 | ******************************************************************************/ |
854 | static int main_menu_with_continue(int* start_selection) | 842 | static bool have_continue; |
843 | static int main_menu_cb(int action, const struct menu_item_ex *this_item) | ||
855 | { | 844 | { |
856 | MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,NULL, | 845 | if(action == ACTION_REQUEST_MENUITEM |
857 | MAZEZAM_TEXT_CONTINUE, | 846 | && !have_continue && ((intptr_t)this_item)==0) |
858 | MAZEZAM_TEXT_PLAY_NEW_GAME, | 847 | return ACTION_EXIT_MENUITEM; |
859 | MAZEZAM_TEXT_QUIT); | 848 | return action; |
860 | return rb->do_menu(&menu, start_selection, NULL, false); | ||
861 | } | 849 | } |
862 | |||
863 | /***************************************************************************** | ||
864 | * Manages the main menu | ||
865 | ******************************************************************************/ | ||
866 | static void main_menu(void) | 850 | static void main_menu(void) |
867 | { | 851 | { |
868 | /* The initial option is "play game" */ | 852 | /* The initial option is "play game" */ |
@@ -873,11 +857,14 @@ static void main_menu(void) | |||
873 | /* Load data */ | 857 | /* Load data */ |
874 | resume_load_data(&r_data, &old_data); | 858 | resume_load_data(&r_data, &old_data); |
875 | 859 | ||
860 | MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb, | ||
861 | MAZEZAM_TEXT_CONTINUE, | ||
862 | MAZEZAM_TEXT_PLAY_NEW_GAME, | ||
863 | MAZEZAM_TEXT_QUIT); | ||
864 | |||
876 | while (state >= STATE_IN_APPLICATION) { | 865 | while (state >= STATE_IN_APPLICATION) { |
877 | if (r_data.level == 0) | 866 | have_continue = (r_data.level != 0); |
878 | choice = main_menu_without_continue(&start_selection); | 867 | choice = rb->do_menu(&menu, &start_selection, NULL, false); |
879 | else | ||
880 | choice = main_menu_with_continue(&start_selection); | ||
881 | 868 | ||
882 | switch(choice) { | 869 | switch(choice) { |
883 | case 0: /* Continue */ | 870 | case 0: /* Continue */ |
@@ -885,14 +872,10 @@ static void main_menu(void) | |||
885 | game_loop(&r_data); | 872 | game_loop(&r_data); |
886 | break; | 873 | break; |
887 | 874 | ||
888 | case 1: /* Quit or Play new game */ | 875 | case 1: /* Play new game */ |
889 | if (r_data.level == 0) | 876 | r_data.level = 0; |
890 | state = STATE_QUIT; | 877 | state = STATE_IN_GAME; |
891 | else { /* Play new game */ | 878 | game_loop(&r_data); |
892 | r_data.level = 0; | ||
893 | state = STATE_IN_GAME; | ||
894 | game_loop(&r_data); | ||
895 | } | ||
896 | break; | 879 | break; |
897 | 880 | ||
898 | case MENU_ATTACHED_USB: | 881 | case MENU_ATTACHED_USB: |
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index a8beb58719..f4a04fe086 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -782,22 +782,33 @@ void solitaire_init(void); | |||
782 | /* menu return codes */ | 782 | /* menu return codes */ |
783 | enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; | 783 | enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; |
784 | 784 | ||
785 | static bool _ingame; | ||
786 | int solitaire_menu_cb(int action, const struct menu_item_ex *this_item) | ||
787 | { | ||
788 | int i = (intptr_t)this_item; | ||
789 | if( action == ACTION_REQUEST_MENUITEM ) | ||
790 | { | ||
791 | if((!_ingame && (i==0 || i==5)) || ( _ingame && i==2 )) | ||
792 | return ACTION_EXIT_MENUITEM; | ||
793 | } | ||
794 | return action; | ||
795 | } | ||
796 | |||
785 | int solitaire_menu(bool in_game) | 797 | int solitaire_menu(bool in_game) |
786 | { | 798 | { |
787 | int selected = 0; | 799 | int selected = 0; |
788 | int result = -1; | 800 | int result = -1; |
789 | 801 | ||
790 | MENUITEM_STRINGLIST(menu, "Solitaire Menu", NULL, | 802 | MENUITEM_STRINGLIST(menu, "Solitaire Menu", solitaire_menu_cb, |
791 | "Start Game", "Draw Cards Option", | 803 | "Resume Game", "Start New Game", |
792 | "Help", "Audio Playback", "Quit"); | 804 | "Draw Cards Option", |
793 | MENUITEM_STRINGLIST(menu_in_game, "Solitaire Menu", NULL, | 805 | "Help", "Playback Control", |
794 | "Resume Game", "Restart Game", "Help", | 806 | "Save and Quit", "Quit"); |
795 | "Audio Playback", "Save and Quit", "Quit"); | 807 | _ingame = in_game; |
796 | 808 | ||
797 | while (result < 0) | 809 | while (result < 0) |
798 | { | 810 | { |
799 | switch (rb->do_menu(in_game? &menu_in_game: &menu, | 811 | switch (rb->do_menu(&menu, &selected, NULL, false)) |
800 | &selected, NULL, false)) | ||
801 | { | 812 | { |
802 | default: | 813 | default: |
803 | result = MENU_RESUME; | 814 | result = MENU_RESUME; |
@@ -812,36 +823,30 @@ int solitaire_menu(bool in_game) | |||
812 | break; | 823 | break; |
813 | 824 | ||
814 | case 1: | 825 | case 1: |
815 | if (in_game) | 826 | solitaire_init(); |
816 | { | 827 | result = MENU_RESUME; |
817 | solitaire_init(); | ||
818 | result = MENU_RESUME; | ||
819 | } | ||
820 | else | ||
821 | { | ||
822 | if (rb->set_option("Draw Cards Option", &sol.draw_type, | ||
823 | INT, drawcards, 2, NULL)) | ||
824 | result = MENU_USB; | ||
825 | } | ||
826 | break; | 828 | break; |
827 | 829 | ||
828 | case 2: | 830 | case 2: |
829 | if (solitaire_help() == HELP_USB) | 831 | if (rb->set_option("Draw Cards Option", &sol.draw_type, |
832 | INT, drawcards, 2, NULL)) | ||
830 | result = MENU_USB; | 833 | result = MENU_USB; |
831 | break; | 834 | break; |
832 | 835 | ||
833 | case 3: | 836 | case 3: |
837 | if (solitaire_help() == HELP_USB) | ||
838 | result = MENU_USB; | ||
839 | break; | ||
840 | |||
841 | case 4: | ||
834 | playback_control(NULL); | 842 | playback_control(NULL); |
835 | break; | 843 | break; |
836 | 844 | ||
837 | case 4: | 845 | case 5: |
838 | if( in_game ) | 846 | result = MENU_SAVE_AND_QUIT; |
839 | result = MENU_SAVE_AND_QUIT; | ||
840 | else | ||
841 | result = MENU_QUIT; | ||
842 | break; | 847 | break; |
843 | 848 | ||
844 | case 5: | 849 | case 6: |
845 | result = MENU_QUIT; | 850 | result = MENU_QUIT; |
846 | break; | 851 | break; |
847 | } | 852 | } |
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 82e1511f70..b26c16eabf 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c | |||
@@ -920,77 +920,49 @@ static void init_game (void) | |||
920 | } | 920 | } |
921 | 921 | ||
922 | /* the main menu */ | 922 | /* the main menu */ |
923 | static bool _ingame; | ||
924 | static int xobox_menu_cb(int action, const struct menu_item_ex *this_item) | ||
925 | { | ||
926 | if(action == ACTION_REQUEST_MENUITEM | ||
927 | && !_ingame && ((intptr_t)this_item)==0) | ||
928 | return ACTION_EXIT_MENUITEM; | ||
929 | return action; | ||
930 | } | ||
931 | |||
923 | static int xobox_menu(bool ingame) | 932 | static int xobox_menu(bool ingame) |
924 | { | 933 | { |
925 | rb->button_clear_queue(); | 934 | rb->button_clear_queue(); |
926 | int choice = 0; | 935 | |
927 | if (ingame) { | 936 | int selection = 0; |
928 | MENUITEM_STRINGLIST (main_menu, "Xobox Menu", NULL, | 937 | MENUITEM_STRINGLIST(main_menu, "Xobox Menu", xobox_menu_cb, |
929 | "Resume Game", | 938 | "Resume Game", "Start New Game", |
930 | "Restart Level", | 939 | "Speed", "Difficulty", |
931 | "Speed", | 940 | "Playback Control", "Quit"); |
932 | "Difficulty", | 941 | _ingame = ingame; |
933 | "Playback Control", | 942 | |
934 | "Quit"); | 943 | while (true) { |
935 | 944 | switch (rb->do_menu(&main_menu, &selection, NULL, false)) { | |
936 | while (true) { | 945 | case 0: |
937 | choice = rb->do_menu(&main_menu, &choice, NULL, false); | 946 | return 0; |
938 | switch (choice) { | 947 | case 1: |
939 | case 0: | 948 | init_game (); |
940 | return 0; | 949 | return 0; |
941 | case 1: | 950 | case 2: |
942 | init_game (); | 951 | rb->set_int ("Speed", "", UNIT_INT, &speed, NULL, 1, 1, 10, NULL); |
943 | return 0; | 952 | break; |
944 | case 2: | 953 | case 3: |
945 | rb->set_int ("Speed", "", UNIT_INT, &speed, NULL, 1, 1, 10, NULL); | 954 | rb->set_int ("Difficulty", "", UNIT_INT, &difficulty, NULL, |
946 | break; | 955 | 5, 50, 95, NULL); |
947 | case 3: | 956 | break; |
948 | rb->set_int ("Difficulty", "", UNIT_INT, &difficulty, NULL, | 957 | case 4: |
949 | 5, 50, 95, NULL); | 958 | playback_control(NULL); |
950 | break; | 959 | break; |
951 | case 4: | 960 | case 5: |
952 | playback_control(NULL); | 961 | return 1; |
953 | break; | 962 | case MENU_ATTACHED_USB: |
954 | case 5: | 963 | return 1; |
955 | return 1; | 964 | default: |
956 | case MENU_ATTACHED_USB: | 965 | break; |
957 | return 1; | ||
958 | default: | ||
959 | break; | ||
960 | } | ||
961 | } | ||
962 | } | ||
963 | else { | ||
964 | MENUITEM_STRINGLIST (main_menu, "Xobox Menu", NULL, | ||
965 | "Start Game", | ||
966 | "Speed", | ||
967 | "Difficulty", | ||
968 | "Playback Control", | ||
969 | "Quit"); | ||
970 | |||
971 | while (true) { | ||
972 | choice = rb->do_menu(&main_menu, &choice, NULL, false); | ||
973 | switch (choice) { | ||
974 | case 0: | ||
975 | init_game (); | ||
976 | return 0; | ||
977 | case 1: | ||
978 | rb->set_int ("Speed", "", UNIT_INT, &speed, NULL, 1, 1, 10, NULL); | ||
979 | break; | ||
980 | case 2: | ||
981 | rb->set_int ("Difficulty", "", UNIT_INT, &difficulty, NULL, | ||
982 | 5, 50, 95, NULL); | ||
983 | break; | ||
984 | case 3: | ||
985 | playback_control(NULL); | ||
986 | break; | ||
987 | case 4: | ||
988 | return 1; | ||
989 | case MENU_ATTACHED_USB: | ||
990 | return 1; | ||
991 | default: | ||
992 | break; | ||
993 | } | ||
994 | } | 966 | } |
995 | } | 967 | } |
996 | } | 968 | } |