Index: apps/bootmenu-ipodclassic/bootoptionchooser.c |
— | — | @@ -1,230 +0,0 @@ |
2 | | -//
|
3 | | -//
|
4 | | -// Copyright 2011 TheSeven
|
5 | | -//
|
6 | | -//
|
7 | | -// This file is part of emCORE.
|
8 | | -//
|
9 | | -// emCORE is free software: you can redistribute it and/or
|
10 | | -// modify it under the terms of the GNU General Public License as
|
11 | | -// published by the Free Software Foundation, either version 2 of the
|
12 | | -// License, or (at your option) any later version.
|
13 | | -//
|
14 | | -// emCORE is distributed in the hope that it will be useful,
|
15 | | -// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 | | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
17 | | -// See the GNU General Public License for more details.
|
18 | | -//
|
19 | | -// You should have received a copy of the GNU General Public License along
|
20 | | -// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
21 | | -//
|
22 | | -//
|
23 | | -
|
24 | | -
|
25 | | -#include "emcoreapp.h"
|
26 | | -#include "libui.h"
|
27 | | -#include "bootoptionchooser.h"
|
28 | | -#include "main.h"
|
29 | | -#include "util.h"
|
30 | | -
|
31 | | -
|
32 | | -static struct chooser_renderer_list_itemdata bootoptionchooser_rparams_cancel =
|
33 | | -{
|
34 | | - .size = LIBUI_POINT(260, 10),
|
35 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
36 | | - .fill_color = 0xa0000000,
|
37 | | - .fill_color_selected = 0x60ffffff,
|
38 | | - .icon_pos = LIBUI_POINT(0, 0),
|
39 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
40 | | - LIBUI_POINT(0, 0)),
|
41 | | - .icon_opacity = 0,
|
42 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
43 | | - LIBUI_POINT(0, 0)),
|
44 | | - .icon_selected_opacity = 0,
|
45 | | - .text = "Cancel",
|
46 | | - .text_pos = LIBUI_POINT(1, 1),
|
47 | | - .text_color = 0xffffffff,
|
48 | | - .text_color_selected = 0xff7fffff
|
49 | | -};
|
50 | | -
|
51 | | -static struct chooser_renderer_list_itemdata bootoptionchooser_rparams_option_0 =
|
52 | | -{
|
53 | | - .size = LIBUI_POINT(260, 10),
|
54 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
55 | | - .fill_color = 0xa0000000,
|
56 | | - .fill_color_selected = 0x60ffffff,
|
57 | | - .icon_pos = LIBUI_POINT(0, 0),
|
58 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
59 | | - LIBUI_POINT(0, 0)),
|
60 | | - .icon_opacity = 0,
|
61 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
62 | | - LIBUI_POINT(0, 0)),
|
63 | | - .icon_selected_opacity = 0,
|
64 | | - .text = NULL,
|
65 | | - .text_pos = LIBUI_POINT(1, 1),
|
66 | | - .text_color = 0xffffffff,
|
67 | | - .text_color_selected = 0xff7fffff
|
68 | | -};
|
69 | | -
|
70 | | -static struct chooser_renderer_list_itemdata bootoptionchooser_rparams_option_1 =
|
71 | | -{
|
72 | | - .size = LIBUI_POINT(260, 10),
|
73 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
74 | | - .fill_color = 0xa0000000,
|
75 | | - .fill_color_selected = 0x60ffffff,
|
76 | | - .icon_pos = LIBUI_POINT(0, 0),
|
77 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
78 | | - LIBUI_POINT(0, 0)),
|
79 | | - .icon_opacity = 0,
|
80 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
81 | | - LIBUI_POINT(0, 0)),
|
82 | | - .icon_selected_opacity = 0,
|
83 | | - .text = NULL,
|
84 | | - .text_pos = LIBUI_POINT(1, 1),
|
85 | | - .text_color = 0xffffffff,
|
86 | | - .text_color_selected = 0xff7fffff
|
87 | | -};
|
88 | | -
|
89 | | -static struct chooser_renderer_list_itemdata bootoptionchooser_rparams_option_2 =
|
90 | | -{
|
91 | | - .size = LIBUI_POINT(260, 10),
|
92 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
93 | | - .fill_color = 0xa0000000,
|
94 | | - .fill_color_selected = 0x60ffffff,
|
95 | | - .icon_pos = LIBUI_POINT(0, 0),
|
96 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
97 | | - LIBUI_POINT(0, 0)),
|
98 | | - .icon_opacity = 0,
|
99 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
100 | | - LIBUI_POINT(0, 0)),
|
101 | | - .icon_selected_opacity = 0,
|
102 | | - .text = NULL,
|
103 | | - .text_pos = LIBUI_POINT(1, 1),
|
104 | | - .text_color = 0xffffffff,
|
105 | | - .text_color_selected = 0xff7fffff
|
106 | | -};
|
107 | | -
|
108 | | -static struct chooser_renderer_list_itemdata bootoptionchooser_rparams_option_3 =
|
109 | | -{
|
110 | | - .size = LIBUI_POINT(260, 10),
|
111 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
112 | | - .fill_color = 0xa0000000,
|
113 | | - .fill_color_selected = 0x60ffffff,
|
114 | | - .icon_pos = LIBUI_POINT(0, 0),
|
115 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
116 | | - LIBUI_POINT(0, 0)),
|
117 | | - .icon_opacity = 0,
|
118 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
119 | | - LIBUI_POINT(0, 0)),
|
120 | | - .icon_selected_opacity = 0,
|
121 | | - .text = NULL,
|
122 | | - .text_pos = LIBUI_POINT(1, 1),
|
123 | | - .text_color = 0xffffffff,
|
124 | | - .text_color_selected = 0xff7fffff
|
125 | | -};
|
126 | | -
|
127 | | -static struct chooser_renderer_list_params bootoptionchooser_rparams =
|
128 | | -{
|
129 | | - .version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
130 | | - .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
131 | | - .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
132 | | - LIBUI_POINT(320, 240)),
|
133 | | - .bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
134 | | - .bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
135 | | - LIBUI_POINT(0, 0)),
|
136 | | - .bg_opacity = 0,
|
137 | | - .fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
138 | | - LIBUI_POINT(0, 0)),
|
139 | | - .fill_color = 0,
|
140 | | - .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(30, 50)),
|
141 | | - LIBUI_POINT(260, 160)),
|
142 | | - .blit_dest = LIBUI_POINT(0, 0),
|
143 | | - .blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
144 | | - LIBUI_POINT(320, 240)),
|
145 | | - .preblit = update_display,
|
146 | | - .postblit = NULL
|
147 | | -};
|
148 | | -
|
149 | | -static struct chooser_action_handler_wheel_params bootoptionchooser_aparams =
|
150 | | -{
|
151 | | - .version = CHOOSER_ACTION_HANDLER_WHEEL_PARAMS_VERSION,
|
152 | | - .stepsperitem = 128,
|
153 | | - .eventfilter = NULL,
|
154 | | - .timeout_initial = TIMEOUT_BLOCK,
|
155 | | - .timeout_idle = TIMEOUT_BLOCK,
|
156 | | - .timeout_item = 0,
|
157 | | - .tick_force_redraw = false,
|
158 | | - .buttoncount = 5,
|
159 | | - .buttonmap =
|
160 | | - {
|
161 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_SELECT,
|
162 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NONE,
|
163 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_CANCEL,
|
164 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NEXT,
|
165 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_PREV
|
166 | | - }
|
167 | | -};
|
168 | | -
|
169 | | -static struct chooser_info bootoptionchooser =
|
170 | | -{
|
171 | | - .version = CHOOSER_INFO_VERSION,
|
172 | | - .actionhandler = NULL,
|
173 | | - .actionhandlerparams = &bootoptionchooser_aparams,
|
174 | | - .renderer = NULL,
|
175 | | - .rendererparams = &bootoptionchooser_rparams,
|
176 | | - .userparams = NULL,
|
177 | | - .tickinterval = 10000000,
|
178 | | - .itemcount = 5,
|
179 | | - .defaultitem = 0,
|
180 | | - .items =
|
181 | | - {
|
182 | | - {
|
183 | | - .user = (void*)-1,
|
184 | | - .actionparams = NULL,
|
185 | | - .renderparams = &bootoptionchooser_rparams_cancel
|
186 | | - },
|
187 | | - {
|
188 | | - .user = (void*)0,
|
189 | | - .actionparams = NULL,
|
190 | | - .renderparams = &bootoptionchooser_rparams_option_0
|
191 | | - },
|
192 | | - {
|
193 | | - .user = (void*)1,
|
194 | | - .actionparams = NULL,
|
195 | | - .renderparams = &bootoptionchooser_rparams_option_1
|
196 | | - },
|
197 | | - {
|
198 | | - .user = (void*)2,
|
199 | | - .actionparams = NULL,
|
200 | | - .renderparams = &bootoptionchooser_rparams_option_2
|
201 | | - },
|
202 | | - {
|
203 | | - .user = (void*)3,
|
204 | | - .actionparams = NULL,
|
205 | | - .renderparams = &bootoptionchooser_rparams_option_3
|
206 | | - }
|
207 | | - }
|
208 | | -};
|
209 | | -
|
210 | | -int run_bootoptionchooser(int selected_index, const char* n0, const char* n1,
|
211 | | - const char* n2, const char* n3)
|
212 | | -{
|
213 | | - bootoptionchooser.defaultitem = selected_index + 1;
|
214 | | - bootoptionchooser_rparams_option_0.text = n0;
|
215 | | - bootoptionchooser_rparams_option_1.text = n1;
|
216 | | - bootoptionchooser_rparams_option_2.text = n2;
|
217 | | - bootoptionchooser_rparams_option_3.text = n3;
|
218 | | - const struct chooser_item* result = ui->chooser_run(&bootoptionchooser);
|
219 | | - if (!result) return -1;
|
220 | | - return (int)result->user;
|
221 | | -}
|
222 | | -
|
223 | | -void bootoptionchooser_init()
|
224 | | -{
|
225 | | - bootoptionchooser.actionhandler = ui->chooser_action_handler_wheel;
|
226 | | - bootoptionchooser.renderer = ui->chooser_renderer_list;
|
227 | | - bootoptionchooser_rparams.copy_dest.buf.addr = framebuf;
|
228 | | - bootoptionchooser_rparams.copy_src.loc.buf.addr = bg;
|
229 | | - bootoptionchooser_rparams.viewport.loc.buf.addr = framebuf;
|
230 | | - bootoptionchooser_rparams.blit_src.loc.buf.addr = framebuf;
|
231 | | -}
|
Index: apps/bootmenu-ipodclassic/bootoptionchooser.h |
— | — | @@ -1,36 +0,0 @@ |
2 | | -//
|
3 | | -//
|
4 | | -// Copyright 2011 TheSeven
|
5 | | -//
|
6 | | -//
|
7 | | -// This file is part of emCORE.
|
8 | | -//
|
9 | | -// emCORE is free software: you can redistribute it and/or
|
10 | | -// modify it under the terms of the GNU General Public License as
|
11 | | -// published by the Free Software Foundation, either version 2 of the
|
12 | | -// License, or (at your option) any later version.
|
13 | | -//
|
14 | | -// emCORE is distributed in the hope that it will be useful,
|
15 | | -// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 | | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
17 | | -// See the GNU General Public License for more details.
|
18 | | -//
|
19 | | -// You should have received a copy of the GNU General Public License along
|
20 | | -// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
21 | | -//
|
22 | | -//
|
23 | | -
|
24 | | -
|
25 | | -#ifndef __APP_BOOTOPTIONCHOOSER_H__
|
26 | | -#define __APP_BOOTOPTIONCHOOSER_H__
|
27 | | -
|
28 | | -
|
29 | | -#include "emcoreapp.h"
|
30 | | -
|
31 | | -
|
32 | | -extern int run_bootoptionchooser(int selected_index, const char* n0, const char* n1,
|
33 | | - const char* n2, const char* n3);
|
34 | | -extern void bootoptionchooser_init();
|
35 | | -
|
36 | | -
|
37 | | -#endif
|
Index: apps/bootmenu-ipodclassic/toolchooser.c |
— | — | @@ -37,17 +37,16 @@ |
38 | 38 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
39 | 39 | .fill_color = 0xa0000000,
|
40 | 40 | .fill_color_selected = 0x60ffffff,
|
41 | | - .icon_pos = LIBUI_POINT(0, 0),
|
42 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
43 | | - LIBUI_POINT(0, 0)),
|
| 41 | + .icon_pos = LIBUI_POINT_NULL,
|
| 42 | + .icon = LIBUI_SURFACE_NULL,
|
44 | 43 | .icon_opacity = 0,
|
45 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
46 | | - LIBUI_POINT(0, 0)),
|
| 44 | + .icon_selected = LIBUI_SURFACE_NULL,
|
47 | 45 | .icon_selected_opacity = 0,
|
48 | 46 | .text = "Return to main menu",
|
49 | 47 | .text_pos = LIBUI_POINT(1, 1),
|
50 | 48 | .text_color = 0xffffffff,
|
51 | | - .text_color_selected = 0xff7fffff
|
| 49 | + .text_color_selected = 0xff7fffff,
|
| 50 | + .render = NULL
|
52 | 51 | };
|
53 | 52 |
|
54 | 53 | static struct chooser_renderer_list_itemdata toolchooser_rparams_umsboot =
|
— | — | @@ -56,17 +55,16 @@ |
57 | 56 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
58 | 57 | .fill_color = 0xa0000000,
|
59 | 58 | .fill_color_selected = 0x60ffffff,
|
60 | | - .icon_pos = LIBUI_POINT(0, 0),
|
61 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
62 | | - LIBUI_POINT(0, 0)),
|
| 59 | + .icon_pos = LIBUI_POINT_NULL,
|
| 60 | + .icon = LIBUI_SURFACE_NULL,
|
63 | 61 | .icon_opacity = 0,
|
64 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
65 | | - LIBUI_POINT(0, 0)),
|
| 62 | + .icon_selected = LIBUI_SURFACE_NULL,
|
66 | 63 | .icon_selected_opacity = 0,
|
67 | 64 | .text = "Run UMSboot",
|
68 | 65 | .text_pos = LIBUI_POINT(1, 1),
|
69 | 66 | .text_color = 0xffffffff,
|
70 | | - .text_color_selected = 0xff7fffff
|
| 67 | + .text_color_selected = 0xff7fffff,
|
| 68 | + .render = NULL
|
71 | 69 | };
|
72 | 70 |
|
73 | 71 | static struct chooser_renderer_list_itemdata toolchooser_rparams_rockbox_fallback =
|
— | — | @@ -75,17 +73,16 @@ |
76 | 74 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
77 | 75 | .fill_color = 0xa0000000,
|
78 | 76 | .fill_color_selected = 0x60ffffff,
|
79 | | - .icon_pos = LIBUI_POINT(0, 0),
|
80 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
81 | | - LIBUI_POINT(0, 0)),
|
| 77 | + .icon_pos = LIBUI_POINT_NULL,
|
| 78 | + .icon = LIBUI_SURFACE_NULL,
|
82 | 79 | .icon_opacity = 0,
|
83 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
84 | | - LIBUI_POINT(0, 0)),
|
| 80 | + .icon_selected = LIBUI_SURFACE_NULL,
|
85 | 81 | .icon_selected_opacity = 0,
|
86 | 82 | .text = "Run Rockbox fallback image",
|
87 | 83 | .text_pos = LIBUI_POINT(1, 1),
|
88 | 84 | .text_color = 0xffffffff,
|
89 | | - .text_color_selected = 0xff7fffff
|
| 85 | + .text_color_selected = 0xff7fffff,
|
| 86 | + .render = NULL
|
90 | 87 | };
|
91 | 88 |
|
92 | 89 | static struct chooser_renderer_list_itemdata toolchooser_rparams_clearcfg =
|
— | — | @@ -94,17 +91,16 @@ |
95 | 92 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
96 | 93 | .fill_color = 0xa0000000,
|
97 | 94 | .fill_color_selected = 0x60ffffff,
|
98 | | - .icon_pos = LIBUI_POINT(0, 0),
|
99 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
100 | | - LIBUI_POINT(0, 0)),
|
| 95 | + .icon_pos = LIBUI_POINT_NULL,
|
| 96 | + .icon = LIBUI_SURFACE_NULL,
|
101 | 97 | .icon_opacity = 0,
|
102 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
103 | | - LIBUI_POINT(0, 0)),
|
| 98 | + .icon_selected = LIBUI_SURFACE_NULL,
|
104 | 99 | .icon_selected_opacity = 0,
|
105 | 100 | .text = "Clear Rockbox configuration",
|
106 | 101 | .text_pos = LIBUI_POINT(1, 1),
|
107 | 102 | .text_color = 0xffffffff,
|
108 | | - .text_color_selected = 0xff7fffff
|
| 103 | + .text_color_selected = 0xff7fffff,
|
| 104 | + .render = NULL
|
109 | 105 | };
|
110 | 106 |
|
111 | 107 | static struct chooser_renderer_list_itemdata toolchooser_rparams_cleardb =
|
— | — | @@ -113,17 +109,16 @@ |
114 | 110 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
115 | 111 | .fill_color = 0xa0000000,
|
116 | 112 | .fill_color_selected = 0x60ffffff,
|
117 | | - .icon_pos = LIBUI_POINT(0, 0),
|
118 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
119 | | - LIBUI_POINT(0, 0)),
|
| 113 | + .icon_pos = LIBUI_POINT_NULL,
|
| 114 | + .icon = LIBUI_SURFACE_NULL,
|
120 | 115 | .icon_opacity = 0,
|
121 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
122 | | - LIBUI_POINT(0, 0)),
|
| 116 | + .icon_selected = LIBUI_SURFACE_NULL,
|
123 | 117 | .icon_selected_opacity = 0,
|
124 | 118 | .text = "Clear Rockbox database",
|
125 | 119 | .text_pos = LIBUI_POINT(1, 1),
|
126 | 120 | .text_color = 0xffffffff,
|
127 | | - .text_color_selected = 0xff7fffff
|
| 121 | + .text_color_selected = 0xff7fffff,
|
| 122 | + .render = NULL
|
128 | 123 | };
|
129 | 124 |
|
130 | 125 | static struct chooser_renderer_list_itemdata toolchooser_rparams_reformat =
|
— | — | @@ -132,17 +127,16 @@ |
133 | 128 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
134 | 129 | .fill_color = 0xa0000000,
|
135 | 130 | .fill_color_selected = 0x60ffffff,
|
136 | | - .icon_pos = LIBUI_POINT(0, 0),
|
137 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
138 | | - LIBUI_POINT(0, 0)),
|
| 131 | + .icon_pos = LIBUI_POINT_NULL,
|
| 132 | + .icon = LIBUI_SURFACE_NULL,
|
139 | 133 | .icon_opacity = 0,
|
140 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
141 | | - LIBUI_POINT(0, 0)),
|
| 134 | + .icon_selected = LIBUI_SURFACE_NULL,
|
142 | 135 | .icon_selected_opacity = 0,
|
143 | 136 | .text = "Reformat data partition",
|
144 | 137 | .text_pos = LIBUI_POINT(1, 1),
|
145 | 138 | .text_color = 0xffffffff,
|
146 | | - .text_color_selected = 0xff7fffff
|
| 139 | + .text_color_selected = 0xff7fffff,
|
| 140 | + .render = NULL
|
147 | 141 | };
|
148 | 142 |
|
149 | 143 | static struct chooser_renderer_list_itemdata toolchooser_rparams_settingchooser =
|
— | — | @@ -151,17 +145,16 @@ |
152 | 146 | .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
153 | 147 | .fill_color = 0xa0000000,
|
154 | 148 | .fill_color_selected = 0x60ffffff,
|
155 | | - .icon_pos = LIBUI_POINT(0, 0),
|
156 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
157 | | - LIBUI_POINT(0, 0)),
|
| 149 | + .icon_pos = LIBUI_POINT_NULL,
|
| 150 | + .icon = LIBUI_SURFACE_NULL,
|
158 | 151 | .icon_opacity = 0,
|
159 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
160 | | - LIBUI_POINT(0, 0)),
|
| 152 | + .icon_selected = LIBUI_SURFACE_NULL,
|
161 | 153 | .icon_selected_opacity = 0,
|
162 | 154 | .text = "Settings",
|
163 | 155 | .text_pos = LIBUI_POINT(1, 1),
|
164 | 156 | .text_color = 0xffffffff,
|
165 | | - .text_color_selected = 0xff7fffff
|
| 157 | + .text_color_selected = 0xff7fffff,
|
| 158 | + .render = NULL
|
166 | 159 | };
|
167 | 160 |
|
168 | 161 | static struct chooser_renderer_list_params toolchooser_rparams =
|
— | — | @@ -170,12 +163,10 @@ |
171 | 164 | .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
172 | 165 | .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
173 | 166 | LIBUI_POINT(320, 240)),
|
174 | | - .bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
175 | | - .bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
176 | | - LIBUI_POINT(0, 0)),
|
| 167 | + .bg_dest = LIBUI_LOCATION_NULL,
|
| 168 | + .bg_src = LIBUI_SURFACE_NULL,
|
177 | 169 | .bg_opacity = 0,
|
178 | | - .fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
179 | | - LIBUI_POINT(0, 0)),
|
| 170 | + .fill_dest = LIBUI_SURFACE_NULL,
|
180 | 171 | .fill_color = 0,
|
181 | 172 | .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(30, 50)),
|
182 | 173 | LIBUI_POINT(260, 160)),
|
— | — | @@ -194,7 +185,7 @@ |
195 | 186 | .timeout_initial = TIMEOUT_BLOCK,
|
196 | 187 | .timeout_idle = TIMEOUT_BLOCK,
|
197 | 188 | .timeout_item = 0,
|
198 | | - .tick_force_redraw = false,
|
| 189 | + .tick_force_redraw = true,
|
199 | 190 | .buttoncount = 5,
|
200 | 191 | .buttonmap =
|
201 | 192 | {
|
— | — | @@ -277,4 +268,6 @@ |
278 | 269 | toolchooser_rparams.copy_src.loc.buf.addr = bg;
|
279 | 270 | toolchooser_rparams.viewport.loc.buf.addr = framebuf;
|
280 | 271 | toolchooser_rparams.blit_src.loc.buf.addr = framebuf;
|
| 272 | + toolchooser_rparams_mainchooser.render = ui->chooser_renderer_list_show_arrow_left;
|
| 273 | + toolchooser_rparams_settingchooser.render = ui->chooser_renderer_list_show_arrow_right;
|
281 | 274 | }
|
Index: apps/bootmenu-ipodclassic/settings.c |
— | — | @@ -28,6 +28,8 @@ |
29 | 29 |
|
30 | 30 | struct settingdata settings_default =
|
31 | 31 | {
|
| 32 | + .magic = "emCOsett",
|
| 33 | + .app = "bootmenu",
|
32 | 34 | .version = SETTINGS_VERSION,
|
33 | 35 | .timeout_initial = 30000000,
|
34 | 36 | .timeout_idle = 300000000,
|
— | — | @@ -43,19 +45,56 @@ |
44 | 46 | memcpy(&settings, &settings_default, sizeof(settings));
|
45 | 47 | }
|
46 | 48 |
|
| 49 | +void setting_validate(void* setting)
|
| 50 | +{
|
| 51 | + if (setting == &settings.timeout_initial)
|
| 52 | + {
|
| 53 | + if (settings.timeout_initial < SETTINGS_TIMEOUT_INITIAL_MIN)
|
| 54 | + settings.timeout_initial = SETTINGS_TIMEOUT_INITIAL_MIN;
|
| 55 | + if (settings.timeout_initial > SETTINGS_TIMEOUT_INITIAL_MAX)
|
| 56 | + settings.timeout_initial = SETTINGS_TIMEOUT_INITIAL_MAX;
|
| 57 | + }
|
| 58 | + else if (setting == &settings.timeout_idle)
|
| 59 | + {
|
| 60 | + if (settings.timeout_idle < SETTINGS_TIMEOUT_IDLE_MIN)
|
| 61 | + settings.timeout_idle = SETTINGS_TIMEOUT_IDLE_MIN;
|
| 62 | + if (settings.timeout_idle > SETTINGS_TIMEOUT_IDLE_MAX)
|
| 63 | + settings.timeout_idle = SETTINGS_TIMEOUT_IDLE_MAX;
|
| 64 | + }
|
| 65 | + else if (setting == &settings.timeout_item)
|
| 66 | + {
|
| 67 | + if (settings.timeout_item < SETTINGS_TIMEOUT_ITEM_MIN)
|
| 68 | + settings.timeout_item = SETTINGS_TIMEOUT_ITEM_MIN;
|
| 69 | + if (settings.timeout_item > SETTINGS_TIMEOUT_ITEM_MAX)
|
| 70 | + settings.timeout_item = SETTINGS_TIMEOUT_ITEM_MAX;
|
| 71 | + }
|
| 72 | + else if (setting == &settings.default_item)
|
| 73 | + {
|
| 74 | + if (settings.default_item < SETTINGS_DEFAULT_ITEM_MIN)
|
| 75 | + settings.default_item = SETTINGS_DEFAULT_ITEM_MIN;
|
| 76 | + if (settings.default_item > SETTINGS_DEFAULT_ITEM_MAX)
|
| 77 | + settings.default_item = SETTINGS_DEFAULT_ITEM_MAX;
|
| 78 | + }
|
| 79 | + else if (setting == &settings.fastboot_item)
|
| 80 | + {
|
| 81 | + if (settings.fastboot_item < SETTINGS_FASTBOOT_ITEM_MIN)
|
| 82 | + settings.fastboot_item = SETTINGS_FASTBOOT_ITEM_MIN;
|
| 83 | + if (settings.fastboot_item > SETTINGS_FASTBOOT_ITEM_MAX)
|
| 84 | + settings.fastboot_item = SETTINGS_FASTBOOT_ITEM_MAX;
|
| 85 | + }
|
| 86 | +}
|
| 87 | +
|
47 | 88 | void settings_validate_all()
|
48 | 89 | {
|
49 | | - if (settings.version != SETTINGS_VERSION) settings_reset();
|
50 | | - if (settings.timeout_initial < 0) settings.timeout_initial = 0;
|
51 | | - if (settings.timeout_initial > 2000000000) settings.timeout_initial = 2000000000;
|
52 | | - if (settings.timeout_idle < 0) settings.timeout_idle = 0;
|
53 | | - if (settings.timeout_idle > 2000000000) settings.timeout_idle = 2000000000;
|
54 | | - if (settings.timeout_item < 0) settings.timeout_item = 0;
|
55 | | - if (settings.timeout_item > 3) settings.timeout_item = 3;
|
56 | | - if (settings.default_item < 0) settings.default_item = 0;
|
57 | | - if (settings.default_item > 3) settings.default_item = 3;
|
58 | | - if (settings.fastboot_item < 0) settings.fastboot_item = 0;
|
59 | | - if (settings.fastboot_item > 3) settings.fastboot_item = 3;
|
| 90 | + if (memcmp(settings.magic, settings_default.magic, sizeof(settings.magic))
|
| 91 | + || memcmp(settings.app, settings_default.app, sizeof(settings.app))
|
| 92 | + || settings.version != SETTINGS_VERSION)
|
| 93 | + settings_reset();
|
| 94 | + setting_validate(&settings.timeout_initial);
|
| 95 | + setting_validate(&settings.timeout_idle);
|
| 96 | + setting_validate(&settings.timeout_item);
|
| 97 | + setting_validate(&settings.default_item);
|
| 98 | + setting_validate(&settings.fastboot_item);
|
60 | 99 | }
|
61 | 100 |
|
62 | 101 | void settings_apply()
|
Index: apps/bootmenu-ipodclassic/settingchooser.c |
— | — | @@ -29,204 +29,158 @@ |
30 | 30 | #include "settings.h"
|
31 | 31 |
|
32 | 32 |
|
33 | | -static struct chooser_renderer_list_itemdata settingchooser_rparams_toolchooser =
|
| 33 | +int settingchooser_time_to_str(char* buf, int buflen, void* setting, int value)
|
34 | 34 | {
|
35 | | - .size = LIBUI_POINT(260, 10),
|
36 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
37 | | - .fill_color = 0xa0000000,
|
38 | | - .fill_color_selected = 0x60ffffff,
|
39 | | - .icon_pos = LIBUI_POINT(0, 0),
|
40 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
41 | | - LIBUI_POINT(0, 0)),
|
42 | | - .icon_opacity = 0,
|
43 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
44 | | - LIBUI_POINT(0, 0)),
|
45 | | - .icon_selected_opacity = 0,
|
46 | | - .text = "Return to tools menu",
|
47 | | - .text_pos = LIBUI_POINT(1, 1),
|
48 | | - .text_color = 0xffffffff,
|
49 | | - .text_color_selected = 0xff7fffff
|
50 | | -};
|
| 35 | + if (value < SETTINGS_TIMEOUT_CUTOFF) return snprintf(buf, buflen, "%s", "Never");
|
| 36 | + return snprintf(buf, buflen, "%dsec", value / 1000000);
|
| 37 | +}
|
51 | 38 |
|
52 | | -static struct chooser_renderer_list_itemdata settingchooser_rparams_timeout_initial =
|
| 39 | +static struct settingchooser_select_options settings_timeout_item_options =
|
53 | 40 | {
|
54 | | - .size = LIBUI_POINT(260, 10),
|
55 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
56 | | - .fill_color = 0xa0000000,
|
57 | | - .fill_color_selected = 0x60ffffff,
|
58 | | - .icon_pos = LIBUI_POINT(0, 0),
|
59 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
60 | | - LIBUI_POINT(0, 0)),
|
61 | | - .icon_opacity = 0,
|
62 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
63 | | - LIBUI_POINT(0, 0)),
|
64 | | - .icon_selected_opacity = 0,
|
65 | | - .text = "Initial timeout",
|
66 | | - .text_pos = LIBUI_POINT(1, 1),
|
67 | | - .text_color = 0xffffffff,
|
68 | | - .text_color_selected = 0xff7fffff
|
| 41 | + .optioncount = 4,
|
| 42 | + .options =
|
| 43 | + {
|
| 44 | + SETTINGCHOOSER_SELECT_OPTION("Power off", "Power off", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 45 | + SETTINGCHOOSER_SELECT_OPTION("Rockbox", "Rockbox", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 46 | + SETTINGCHOOSER_SELECT_OPTION("UMSboot", "UMSboot", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 47 | + SETTINGCHOOSER_SELECT_OPTION("Console", "emCORE console", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL)
|
| 48 | + }
|
69 | 49 | };
|
70 | 50 |
|
71 | | -static struct chooser_renderer_list_itemdata settingchooser_rparams_timeout_idle =
|
| 51 | +static struct settingchooser_select_options settings_default_item_options =
|
72 | 52 | {
|
73 | | - .size = LIBUI_POINT(260, 10),
|
74 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
75 | | - .fill_color = 0xa0000000,
|
76 | | - .fill_color_selected = 0x60ffffff,
|
77 | | - .icon_pos = LIBUI_POINT(0, 0),
|
78 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
79 | | - LIBUI_POINT(0, 0)),
|
80 | | - .icon_opacity = 0,
|
81 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
82 | | - LIBUI_POINT(0, 0)),
|
83 | | - .icon_selected_opacity = 0,
|
84 | | - .text = "Idle timeout",
|
85 | | - .text_pos = LIBUI_POINT(1, 1),
|
86 | | - .text_color = 0xffffffff,
|
87 | | - .text_color_selected = 0xff7fffff
|
| 53 | + .optioncount = 4,
|
| 54 | + .options =
|
| 55 | + {
|
| 56 | + SETTINGCHOOSER_SELECT_OPTION("Power off", "Power off", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 57 | + SETTINGCHOOSER_SELECT_OPTION("Rockbox", "Rockbox", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 58 | + SETTINGCHOOSER_SELECT_OPTION("Console", "emCORE console", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 59 | + SETTINGCHOOSER_SELECT_OPTION("Tools", "Tools", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL)
|
| 60 | + }
|
88 | 61 | };
|
89 | 62 |
|
90 | | -static struct chooser_renderer_list_itemdata settingchooser_rparams_timeout_item =
|
| 63 | +static struct settingchooser_select_options settings_fastboot_item_options =
|
91 | 64 | {
|
92 | | - .size = LIBUI_POINT(260, 10),
|
93 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
94 | | - .fill_color = 0xa0000000,
|
95 | | - .fill_color_selected = 0x60ffffff,
|
96 | | - .icon_pos = LIBUI_POINT(0, 0),
|
97 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
98 | | - LIBUI_POINT(0, 0)),
|
99 | | - .icon_opacity = 0,
|
100 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
101 | | - LIBUI_POINT(0, 0)),
|
102 | | - .icon_selected_opacity = 0,
|
103 | | - .text = "Timeout boot option",
|
104 | | - .text_pos = LIBUI_POINT(1, 1),
|
105 | | - .text_color = 0xffffffff,
|
106 | | - .text_color_selected = 0xff7fffff
|
| 65 | + .optioncount = 4,
|
| 66 | + .options =
|
| 67 | + {
|
| 68 | + SETTINGCHOOSER_SELECT_OPTION("Disabled", "Disabled", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 69 | + SETTINGCHOOSER_SELECT_OPTION("Rockbox", "Rockbox", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 70 | + SETTINGCHOOSER_SELECT_OPTION("UMSboot", "UMSboot", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL),
|
| 71 | + SETTINGCHOOSER_SELECT_OPTION("Console", "emCORE console", LIBUI_SURFACE_NULL, LIBUI_SURFACE_NULL)
|
| 72 | + }
|
107 | 73 | };
|
108 | 74 |
|
109 | | -static struct chooser_renderer_list_itemdata settingchooser_rparams_default_item =
|
| 75 | +static struct settingchooser_info settingchooser =
|
110 | 76 | {
|
111 | | - .size = LIBUI_POINT(260, 10),
|
112 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
113 | | - .fill_color = 0xa0000000,
|
114 | | - .fill_color_selected = 0x60ffffff,
|
115 | | - .icon_pos = LIBUI_POINT(0, 0),
|
116 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
117 | | - LIBUI_POINT(0, 0)),
|
118 | | - .icon_opacity = 0,
|
119 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
| 77 | + .version = SETTINGCHOOSER_INFO_VERSION,
|
| 78 | + .rendererparams =
|
| 79 | + {
|
| 80 | + .version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
| 81 | + .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| 82 | + .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| 83 | + LIBUI_POINT(320, 240)),
|
| 84 | + .bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
| 85 | + .bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
| 86 | + LIBUI_POINT(0, 0)),
|
| 87 | + .bg_opacity = 0,
|
| 88 | + .fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
120 | 89 | LIBUI_POINT(0, 0)),
|
121 | | - .icon_selected_opacity = 0,
|
122 | | - .text = "Default boot option",
|
123 | | - .text_pos = LIBUI_POINT(1, 1),
|
124 | | - .text_color = 0xffffffff,
|
125 | | - .text_color_selected = 0xff7fffff
|
126 | | -};
|
127 | | -
|
128 | | -static struct chooser_renderer_list_itemdata settingchooser_rparams_fastboot_item =
|
129 | | -{
|
130 | | - .size = LIBUI_POINT(260, 10),
|
131 | | - .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
132 | | - .fill_color = 0xa0000000,
|
133 | | - .fill_color_selected = 0x60ffffff,
|
134 | | - .icon_pos = LIBUI_POINT(0, 0),
|
135 | | - .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
136 | | - LIBUI_POINT(0, 0)),
|
137 | | - .icon_opacity = 0,
|
138 | | - .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
139 | | - LIBUI_POINT(0, 0)),
|
140 | | - .icon_selected_opacity = 0,
|
141 | | - .text = "Fastboot boot option",
|
142 | | - .text_pos = LIBUI_POINT(1, 1),
|
143 | | - .text_color = 0xffffffff,
|
144 | | - .text_color_selected = 0xff7fffff
|
145 | | -};
|
146 | | -
|
147 | | -static struct chooser_renderer_list_params settingchooser_rparams =
|
148 | | -{
|
149 | | - .version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
150 | | - .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
151 | | - .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
152 | | - LIBUI_POINT(320, 240)),
|
153 | | - .bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
154 | | - .bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
155 | | - LIBUI_POINT(0, 0)),
|
156 | | - .bg_opacity = 0,
|
157 | | - .fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
158 | | - LIBUI_POINT(0, 0)),
|
159 | | - .fill_color = 0,
|
160 | | - .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(30, 50)),
|
161 | | - LIBUI_POINT(260, 160)),
|
162 | | - .blit_dest = LIBUI_POINT(0, 0),
|
163 | | - .blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
164 | | - LIBUI_POINT(320, 240)),
|
165 | | - .preblit = update_display,
|
166 | | - .postblit = NULL
|
167 | | -};
|
168 | | -
|
169 | | -static struct chooser_action_handler_wheel_params settingchooser_aparams =
|
170 | | -{
|
171 | | - .version = CHOOSER_ACTION_HANDLER_WHEEL_PARAMS_VERSION,
|
172 | | - .stepsperitem = 128,
|
173 | | - .eventfilter = NULL,
|
174 | | - .timeout_initial = TIMEOUT_BLOCK,
|
175 | | - .timeout_idle = TIMEOUT_BLOCK,
|
176 | | - .timeout_item = 0,
|
177 | | - .tick_force_redraw = false,
|
178 | | - .buttoncount = 5,
|
179 | | - .buttonmap =
|
| 90 | + .fill_color = 0,
|
| 91 | + .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(30, 50)),
|
| 92 | + LIBUI_POINT(260, 160)),
|
| 93 | + .blit_dest = LIBUI_POINT(0, 0),
|
| 94 | + .blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| 95 | + LIBUI_POINT(320, 240)),
|
| 96 | + .preblit = update_display,
|
| 97 | + .postblit = NULL
|
| 98 | + },
|
| 99 | + .itemparams =
|
180 | 100 | {
|
181 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_SELECT,
|
182 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NONE,
|
183 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_CANCEL,
|
184 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NEXT,
|
185 | | - CHOOSER_ACTION_HANDLER_WHEEL_ACTION_PREV
|
186 | | - }
|
187 | | -};
|
188 | | -
|
189 | | -static struct chooser_info settingchooser =
|
190 | | -{
|
191 | | - .version = CHOOSER_INFO_VERSION,
|
192 | | - .actionhandler = NULL,
|
193 | | - .actionhandlerparams = &settingchooser_aparams,
|
194 | | - .renderer = NULL,
|
195 | | - .rendererparams = &settingchooser_rparams,
|
196 | | - .userparams = NULL,
|
| 101 | + .size = LIBUI_POINT(260, 10),
|
| 102 | + .fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(260, 10)),
|
| 103 | + .fill_color = 0xa0000000,
|
| 104 | + .fill_color_selected = 0x60ffffff,
|
| 105 | + .fill_color_active = 0x60003f3f,
|
| 106 | + .icon_pos = LIBUI_POINT_NULL,
|
| 107 | + .icon_opacity = 0,
|
| 108 | + .icon_selected_opacity = 0,
|
| 109 | + .icon_active_opacity = 0,
|
| 110 | + .text_pos = LIBUI_POINT(1, 1),
|
| 111 | + .text_color = 0xffffffff,
|
| 112 | + .text_color_selected = 0xff7fffff,
|
| 113 | + .text_color_active = 0xffff7f7f
|
| 114 | + },
|
| 115 | + .returntext = "Return to tools menu",
|
197 | 116 | .tickinterval = 10000000,
|
198 | | - .itemcount = 6,
|
199 | | - .defaultitem = 0,
|
| 117 | + .itemcount = 5,
|
200 | 118 | .items =
|
201 | 119 | {
|
202 | 120 | {
|
203 | | - .user = (void*)0,
|
204 | | - .actionparams = NULL,
|
205 | | - .renderparams = &settingchooser_rparams_toolchooser
|
| 121 | + .text = "Initial timeout",
|
| 122 | + .icon = LIBUI_SURFACE_NULL,
|
| 123 | + .icon_selected = LIBUI_SURFACE_NULL,
|
| 124 | + .type = SETTINGCHOOSER_TYPE_INTEGER,
|
| 125 | + .setting = &settings.timeout_initial,
|
| 126 | + .validator = setting_validate,
|
| 127 | + .config.integer =
|
| 128 | + {
|
| 129 | + .min = SETTINGS_TIMEOUT_INITIAL_MIN,
|
| 130 | + .max = SETTINGS_TIMEOUT_INITIAL_MAX,
|
| 131 | + .step = SETTINGS_TIMEOUT_INITIAL_STEP,
|
| 132 | + .tostring = settingchooser_time_to_str
|
| 133 | + }
|
206 | 134 | },
|
207 | 135 | {
|
208 | | - .user = (void*)1,
|
209 | | - .actionparams = NULL,
|
210 | | - .renderparams = &settingchooser_rparams_timeout_initial
|
| 136 | + .text = "Idle timeout",
|
| 137 | + .icon = LIBUI_SURFACE_NULL,
|
| 138 | + .icon_selected = LIBUI_SURFACE_NULL,
|
| 139 | + .type = SETTINGCHOOSER_TYPE_INTEGER,
|
| 140 | + .setting = &settings.timeout_idle,
|
| 141 | + .validator = setting_validate,
|
| 142 | + .config.integer =
|
| 143 | + {
|
| 144 | + .min = SETTINGS_TIMEOUT_IDLE_MIN,
|
| 145 | + .max = SETTINGS_TIMEOUT_IDLE_MAX,
|
| 146 | + .step = SETTINGS_TIMEOUT_IDLE_STEP,
|
| 147 | + .tostring = settingchooser_time_to_str
|
| 148 | + }
|
211 | 149 | },
|
212 | 150 | {
|
213 | | - .user = (void*)2,
|
214 | | - .actionparams = NULL,
|
215 | | - .renderparams = &settingchooser_rparams_timeout_idle
|
| 151 | + .text = "Timeout action",
|
| 152 | + .icon = LIBUI_SURFACE_NULL,
|
| 153 | + .icon_selected = LIBUI_SURFACE_NULL,
|
| 154 | + .type = SETTINGCHOOSER_TYPE_SELECT,
|
| 155 | + .setting = &settings.timeout_item,
|
| 156 | + .validator = setting_validate,
|
| 157 | + .config.select =
|
| 158 | + {
|
| 159 | + .options = &settings_timeout_item_options
|
| 160 | + }
|
216 | 161 | },
|
217 | 162 | {
|
218 | | - .user = (void*)3,
|
219 | | - .actionparams = NULL,
|
220 | | - .renderparams = &settingchooser_rparams_timeout_item
|
| 163 | + .text = "Default action",
|
| 164 | + .icon = LIBUI_SURFACE_NULL,
|
| 165 | + .icon_selected = LIBUI_SURFACE_NULL,
|
| 166 | + .type = SETTINGCHOOSER_TYPE_SELECT,
|
| 167 | + .setting = &settings.default_item,
|
| 168 | + .validator = setting_validate,
|
| 169 | + .config.select =
|
| 170 | + {
|
| 171 | + .options = &settings_default_item_options
|
| 172 | + }
|
221 | 173 | },
|
222 | 174 | {
|
223 | | - .user = (void*)4,
|
224 | | - .actionparams = NULL,
|
225 | | - .renderparams = &settingchooser_rparams_default_item
|
226 | | - },
|
227 | | - {
|
228 | | - .user = (void*)5,
|
229 | | - .actionparams = NULL,
|
230 | | - .renderparams = &settingchooser_rparams_fastboot_item
|
| 175 | + .text = "Fastboot action",
|
| 176 | + .icon = LIBUI_SURFACE_NULL,
|
| 177 | + .icon_selected = LIBUI_SURFACE_NULL,
|
| 178 | + .type = SETTINGCHOOSER_TYPE_SELECT,
|
| 179 | + .setting = &settings.fastboot_item,
|
| 180 | + .validator = setting_validate,
|
| 181 | + .config.select =
|
| 182 | + {
|
| 183 | + .options = &settings_fastboot_item_options
|
| 184 | + }
|
231 | 185 | }
|
232 | 186 | }
|
233 | 187 | };
|
— | — | @@ -233,45 +187,21 @@ |
234 | 188 |
|
235 | 189 | void run_settingchooser(void** firmware, void** app, int* size)
|
236 | 190 | {
|
237 | | - while (true)
|
| 191 | + bool changes = ui->settingchooser_run(&settingchooser);
|
| 192 | + if (changes)
|
238 | 193 | {
|
239 | | - const struct chooser_item* result = ui->chooser_run(&settingchooser);
|
240 | | - if (!result || !result->user)
|
241 | | - {
|
242 | | - rendertext(framebuf, 106, 140, 320, 0xff33ffff, 0xa0000000, "Saving settings...");
|
243 | | - displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
244 | | - settings_validate_all();
|
245 | | - settings_save();
|
246 | | - settings_apply();
|
247 | | - return;
|
248 | | - }
|
249 | | - int new;
|
250 | | - switch ((int)result->user)
|
251 | | - {
|
252 | | - case 3:
|
253 | | - new = run_bootoptionchooser(settings.timeout_item, "Power off", "Rockbox", "UMSboot", "emCORE console");
|
254 | | - if (new != -1) settings.timeout_item = new;
|
255 | | - break;
|
256 | | -
|
257 | | - case 4:
|
258 | | - new = run_bootoptionchooser(settings.default_item, "Power off", "Rockbox", "emCORE console", "Tools");
|
259 | | - if (new != -1) settings.default_item = new;
|
260 | | - break;
|
261 | | -
|
262 | | - case 5:
|
263 | | - new = run_bootoptionchooser(settings.fastboot_item, "Disabled", "Rockbox", "UMSboot", "emCORE console");
|
264 | | - if (new != -1) settings.fastboot_item = new;
|
265 | | - break;
|
266 | | - }
|
| 194 | + rendertext(framebuf, 106, 140, 320, 0xff33ffff, 0xa0000000, "Saving settings...");
|
| 195 | + displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
| 196 | + settings_validate_all();
|
| 197 | + settings_save();
|
| 198 | + settings_apply();
|
267 | 199 | }
|
268 | 200 | }
|
269 | 201 |
|
270 | 202 | void settingchooser_init()
|
271 | 203 | {
|
272 | | - settingchooser.actionhandler = ui->chooser_action_handler_wheel;
|
273 | | - settingchooser.renderer = ui->chooser_renderer_list;
|
274 | | - settingchooser_rparams.copy_dest.buf.addr = framebuf;
|
275 | | - settingchooser_rparams.copy_src.loc.buf.addr = bg;
|
276 | | - settingchooser_rparams.viewport.loc.buf.addr = framebuf;
|
277 | | - settingchooser_rparams.blit_src.loc.buf.addr = framebuf;
|
| 204 | + settingchooser.rendererparams.copy_dest.buf.addr = framebuf;
|
| 205 | + settingchooser.rendererparams.copy_src.loc.buf.addr = bg;
|
| 206 | + settingchooser.rendererparams.viewport.loc.buf.addr = framebuf;
|
| 207 | + settingchooser.rendererparams.blit_src.loc.buf.addr = framebuf;
|
278 | 208 | }
|
Index: apps/bootmenu-ipodclassic/SOURCES |
— | — | @@ -2,7 +2,6 @@ |
3 | 3 | mainchooser.c
|
4 | 4 | toolchooser.c
|
5 | 5 | settingchooser.c
|
6 | | -bootoptionchooser.c
|
7 | 6 | boot.c
|
8 | 7 | tools.c
|
9 | 8 | util.c
|
Index: apps/bootmenu-ipodclassic/settings.h |
— | — | @@ -31,6 +31,8 @@ |
32 | 32 | #define SETTINGS_VERSION 1
|
33 | 33 | struct settingdata
|
34 | 34 | {
|
| 35 | + char magic[8];
|
| 36 | + char app[8];
|
35 | 37 | uint32_t version;
|
36 | 38 | long timeout_initial;
|
37 | 39 | long timeout_idle;
|
— | — | @@ -39,7 +41,22 @@ |
40 | 42 | int fastboot_item;
|
41 | 43 | };
|
42 | 44 |
|
| 45 | +#define SETTINGS_TIMEOUT_INITIAL_MIN 0
|
| 46 | +#define SETTINGS_TIMEOUT_INITIAL_MAX 2000000000
|
| 47 | +#define SETTINGS_TIMEOUT_INITIAL_STEP 1000000
|
| 48 | +#define SETTINGS_TIMEOUT_IDLE_MIN 0
|
| 49 | +#define SETTINGS_TIMEOUT_IDLE_MAX 2000000000
|
| 50 | +#define SETTINGS_TIMEOUT_IDLE_STEP 1000000
|
| 51 | +#define SETTINGS_TIMEOUT_ITEM_MIN 0
|
| 52 | +#define SETTINGS_TIMEOUT_ITEM_MAX 3
|
| 53 | +#define SETTINGS_DEFAULT_ITEM_MIN 0
|
| 54 | +#define SETTINGS_DEFAULT_ITEM_MAX 3
|
| 55 | +#define SETTINGS_FASTBOOT_ITEM_MIN 0
|
| 56 | +#define SETTINGS_FASTBOOT_ITEM_MAX 3
|
43 | 57 |
|
| 58 | +#define SETTINGS_TIMEOUT_CUTOFF 3000000
|
| 59 | +
|
| 60 | +
|
44 | 61 | extern struct settingdata settings_default;
|
45 | 62 | extern struct settingdata settings;
|
46 | 63 |
|
— | — | @@ -46,6 +63,7 @@ |
47 | 64 |
|
48 | 65 | extern void settings_init();
|
49 | 66 | extern void settings_reset();
|
| 67 | +extern void setting_validate(void* setting);
|
50 | 68 | extern void settings_validate_all();
|
51 | 69 | extern void settings_apply();
|
52 | 70 | extern void settings_save();
|
Index: apps/bootmenu-ipodclassic/mainchooser.c |
— | — | @@ -53,6 +53,7 @@ |
54 | 54 | LIBUI_POINT(80, 80)),
|
55 | 55 | .text = "Power off",
|
56 | 56 | .text_color = 0xffffcccc,
|
| 57 | + .render = NULL
|
57 | 58 | };
|
58 | 59 |
|
59 | 60 | static struct chooser_renderer_iconflow_itemdata mainchooser_rparams_rockbox =
|
— | — | @@ -63,6 +64,7 @@ |
64 | 65 | LIBUI_POINT(80, 80)),
|
65 | 66 | .text = "Rockbox",
|
66 | 67 | .text_color = 0xffffcccc,
|
| 68 | + .render = NULL
|
67 | 69 | };
|
68 | 70 |
|
69 | 71 | static struct chooser_renderer_iconflow_itemdata mainchooser_rparams_console =
|
— | — | @@ -73,6 +75,7 @@ |
74 | 76 | LIBUI_POINT(80, 80)),
|
75 | 77 | .text = "emCORE console",
|
76 | 78 | .text_color = 0xffffcccc,
|
| 79 | + .render = NULL
|
77 | 80 | };
|
78 | 81 |
|
79 | 82 | static struct chooser_renderer_iconflow_itemdata mainchooser_rparams_toolchooser =
|
— | — | @@ -83,6 +86,7 @@ |
84 | 87 | LIBUI_POINT(80, 80)),
|
85 | 88 | .text = "Tools",
|
86 | 89 | .text_color = 0xffffcccc,
|
| 90 | + .render = NULL
|
87 | 91 | };
|
88 | 92 |
|
89 | 93 | static struct chooser_renderer_iconflow_params mainchooser_rparams =
|
— | — | @@ -91,12 +95,10 @@ |
92 | 96 | .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
93 | 97 | .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
94 | 98 | LIBUI_POINT(320, 240)),
|
95 | | - .bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
96 | | - .bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
97 | | - LIBUI_POINT(0, 0)),
|
| 99 | + .bg_dest = LIBUI_LOCATION_NULL,
|
| 100 | + .bg_src = LIBUI_SURFACE_NULL,
|
98 | 101 | .bg_opacity = 0,
|
99 | | - .fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
100 | | - LIBUI_POINT(0, 0)),
|
| 102 | + .fill_dest = LIBUI_SURFACE_NULL,
|
101 | 103 | .fill_color = 0,
|
102 | 104 | .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 30)),
|
103 | 105 | LIBUI_POINT(320, 130)),
|
— | — | @@ -216,8 +218,10 @@ |
217 | 219 | void mainchooser_apply_settings()
|
218 | 220 | {
|
219 | 221 | mainchooser.defaultitem = settings.default_item;
|
220 | | - if (settings.timeout_initial < 3000000) mainchooser_aparams.timeout_initial = TIMEOUT_BLOCK;
|
| 222 | + if (settings.timeout_initial < SETTINGS_TIMEOUT_CUTOFF)
|
| 223 | + mainchooser_aparams.timeout_initial = TIMEOUT_BLOCK;
|
221 | 224 | else mainchooser_aparams.timeout_initial = settings.timeout_initial + 500000;
|
222 | | - if (settings.timeout_idle < 3000000) mainchooser_aparams.timeout_idle = TIMEOUT_BLOCK;
|
| 225 | + if (settings.timeout_idle < SETTINGS_TIMEOUT_CUTOFF)
|
| 226 | + mainchooser_aparams.timeout_idle = TIMEOUT_BLOCK;
|
223 | 227 | else mainchooser_aparams.timeout_idle = settings.timeout_idle + 500000;
|
224 | 228 | }
|
Index: apps/bootmenu-ipodclassic/util.c |
— | — | @@ -68,7 +68,8 @@ |
69 | 69 | // remaining battery level
|
70 | 70 | ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 320, framebuf, 5, 5, 320);
|
71 | 71 | // background of the rest space
|
72 | | - ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 320, framebuf, 5 + batt_level, 5, 320);
|
| 72 | + ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level,
|
| 73 | + 5, 320, framebuf, 5 + batt_level, 5, 320);
|
73 | 74 | return false;
|
74 | 75 | }
|
75 | 76 |
|
Index: apps/bootmenu-ipodclassic/main.c |
— | — | @@ -87,9 +87,9 @@ |
88 | 88 | mainchooser_init();
|
89 | 89 | toolchooser_init();
|
90 | 90 | settingchooser_init();
|
91 | | - bootoptionchooser_init();
|
92 | 91 |
|
93 | 92 | run_mainchooser(&firmware, &app, &size);
|
| 93 | +
|
94 | 94 | free(framebuf);
|
95 | 95 | free(rbxlogo);
|
96 | 96 | free(icons);
|