extracted code branching from ItemsList drawing and main drawing method
[open-ps2-loader.git] / src / dialogs.c
blobbdc0e9cdf60e613118dd0d587161a5b924da9ea6
1 #include "include/dialogs.h"
2 #include "include/usbld.h"
3 #include "include/dia.h"
4 #include "include/lang.h"
5 #include "include/gui.h"
7 #include <stdio.h>
9 // Dialog definition for IP configuration
10 struct UIItem diaIPConfig[] = {
11 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_IPCONFIG}}},
13 {UI_SPLITTER},
15 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"- PS2 -", -1}}}, {UI_BREAK},
17 // ---- IP address ----
18 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_IP}}}, {UI_SPACER},
20 {UI_INT, 2, 1, -1, 0, 0, {.intvalue = {192, 192, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
21 {UI_INT, 3, 1, -1, 0, 0, {.intvalue = {168, 168, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
22 {UI_INT, 4, 1, -1, 0, 0, {.intvalue = {0, 0, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
23 {UI_INT, 5, 1, -1, 0, 0, {.intvalue = {10, 10, 0, 255}}}, {UI_BREAK},
25 // ---- Netmask ----
26 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_MASK}}}, {UI_SPACER},
28 {UI_INT, 6, 1, -1, 0, 0, {.intvalue = {255, 255, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
29 {UI_INT, 7, 1, -1, 0, 0, {.intvalue = {255, 255, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
30 {UI_INT, 8, 1, -1, 0, 0, {.intvalue = {255, 255, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
31 {UI_INT, 9, 1, -1, 0, 0, {.intvalue = {0, 0, 0, 255}}}, {UI_BREAK},
33 // ---- Gateway ----
34 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_GATEWAY}}}, {UI_SPACER},
36 {UI_INT, 10, 1, -1, 0, 0, {.intvalue = {192, 192, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
37 {UI_INT, 11, 1, -1, 0, 0, {.intvalue = {168, 168, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
38 {UI_INT, 12, 1, -1, 0, 0, {.intvalue = {0, 0, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
39 {UI_INT, 13, 1, -1, 0, 0, {.intvalue = {1, 1, 0, 255}}},
41 {UI_SPLITTER},
43 // ---- PC ----
44 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"- PC -", -1}}}, {UI_BREAK},
46 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_IP}}}, {UI_SPACER},
48 {UI_INT, 14, 1, -1, 0, 0, {.intvalue = {192, 192, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
49 {UI_INT, 15, 1, -1, 0, 0, {.intvalue = {168, 168, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
50 {UI_INT, 16, 1, -1, 0, 0, {.intvalue = {0, 0, 0, 255}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {".", -1}}},
51 {UI_INT, 17, 1, -1, 0, 0, {.intvalue = {1, 1, 0, 255}}}, {UI_BREAK},
53 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_PORT}}}, {UI_SPACER}, {UI_INT, 18, 1, -1, 0, 0, {.intvalue = {445, 445, 0, 1024}}}, {UI_BREAK},
55 {UI_BREAK},
57 // ---- PC share name ----
58 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_SHARE}}}, {UI_SPACER}, {UI_STRING, 19, 1, -1, 0, 0, {.stringvalue = {"PS2SMB", "PS2SMB", NULL}}}, {UI_BREAK},
59 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_USER}}}, {UI_SPACER}, {UI_STRING, 20, 1, -1, 0, 0, {.stringvalue = {"GUEST", "GUEST", NULL}}}, {UI_BREAK},
60 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_PASSWORD}}}, {UI_SPACER}, {UI_PASSWORD, 21, 1, _STR_HINT_GUEST, 0, 0, {.stringvalue = {"", "", NULL}}},
62 {UI_SPLITTER},
64 // ---- Ok ----
65 {UI_OK, 0, 1, -1, 0, 0, {.label = {NULL, _STR_OK}}},
67 // end of dialog
68 {UI_TERMINATOR}
71 struct UIItem diaCompatConfig[] = {
72 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_COMPAT_SETTINGS}}}, {UI_SPACER},
73 {UI_LABEL, COMPAT_GAME, 1, -1, 0, 0, {.label = {"<Game Label>", -1}}},
75 {UI_SPLITTER},
77 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 1", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE , 1, _STR_HINT_MODE1, -10, 0, {.intvalue = {0, 0}}}, {UI_SPACER},
78 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 2", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 1, 1, _STR_HINT_MODE2, -10, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
79 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 3", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 2, 1, _STR_HINT_MODE3, -10, 0, {.intvalue = {0, 0}}}, {UI_SPACER},
80 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 4", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 3, 1, _STR_HINT_MODE4, -10, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
81 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 5", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 4, 1, _STR_HINT_MODE5, -10, 0, {.intvalue = {0, 0}}}, {UI_SPACER},
82 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 6", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 5, 1, _STR_HINT_MODE6, -10, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
83 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 7", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 6, 1, _STR_HINT_MODE7, -10, 0, {.intvalue = {0, 0}}}, {UI_SPACER},
84 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Mode 8", -1}}}, {UI_SPACER}, {UI_BOOL, COMPAT_MODE_BASE + 7, 1, _STR_HINT_MODE8, -10, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
86 {UI_BREAK},
88 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"DMA Mode", -1}}}, {UI_SPACER}, {UI_ENUM, COMPAT_MODE_BASE + COMPAT_MODE_COUNT, 1, -1, 0, 0, {.intvalue = {0, 0}}},
90 {UI_SPLITTER},
92 #ifdef VMC
93 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"VMC Slot 1", -1}}}, {UI_SPACER},
94 #ifndef __CHILDPROOF
95 {UI_BUTTON, COMPAT_VMC1_DEFINE, 1, -1, 0, 0, {.label = {NULL, -1}}}, {UI_SPACER}, {UI_BUTTON, COMPAT_VMC1_ACTION, 1, -1, 0, 0, {.label = {NULL, -1}}}, {UI_BREAK},
96 #else
97 {UI_BUTTON, COMPAT_VMC1_DEFINE, 0, -1, 0, 0, {.label = {NULL, -1}}}, {UI_BREAK},
98 #endif
99 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"VMC Slot 2", -1}}}, {UI_SPACER},
100 #ifndef __CHILDPROOF
101 {UI_BUTTON, COMPAT_VMC2_DEFINE, 1, -1, 0, 0, {.label = {NULL, -1}}}, {UI_SPACER}, {UI_BUTTON, COMPAT_VMC2_ACTION, 1, -1, 0, 0, {.label = {NULL, -1}}},
102 #else
103 {UI_BUTTON, COMPAT_VMC2_DEFINE, 0, -1, 0, 0, {.label = {NULL, -1}}},
104 #endif
106 {UI_SPLITTER},
107 #endif
109 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"Game ID", -1}}}, {UI_SPACER}, {UI_STRING, COMPAT_GAMEID, 1, -1, 0, 0, {.stringvalue = {"", "", NULL}}},
110 {UI_SPACER}, {UI_BUTTON, COMPAT_LOADFROMDISC, 1, -1, 0, 0, {.label = {NULL, _STR_LOAD_FROM_DISC}}},
112 {UI_SPLITTER},
114 #ifndef __CHILDPROOF
115 {UI_BUTTON, COMPAT_SAVE, 1, -1, 0, 0, {.label = {NULL, _STR_SAVE_CHANGES}}}, {UI_SPACER},
116 #endif
117 {UI_BUTTON, COMPAT_TEST, 1, -1, 0, 0, {.label = {NULL, _STR_TEST}}}, {UI_BREAK},
119 {UI_BREAK},
121 #ifndef __CHILDPROOF
122 {UI_BUTTON, COMPAT_REMOVE, 1, -1, 0, 0, {.label = {NULL, _STR_REMOVE_ALL_SETTINGS}}},
123 #endif
124 // end of dialog
125 {UI_TERMINATOR}
128 struct UIItem diaConfig[] = {
129 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_SETTINGS}}},
130 {UI_SPLITTER},
132 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_DEBUG}}}, {UI_SPACER}, {UI_BOOL, CFG_DEBUG, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
133 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_EXITTO}}}, {UI_SPACER}, {UI_STRING, CFG_EXITTO, 1, _STR_HINT_EXITPATH, 0, 0, {.stringvalue = {"", "", NULL}}}, {UI_BREAK},
134 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_DANDROP}}}, {UI_SPACER}, {UI_BOOL, CFG_DANDROP, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
135 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_LASTPLAYED}}}, {UI_SPACER}, {UI_BOOL, CFG_LASTPLAYED, 1, -1, 0, 0, {.intvalue = {0, 0}}},
137 {UI_SPLITTER},
139 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_CHECKUSBFRAG}}}, {UI_SPACER}, {UI_BOOL, CFG_CHECKUSBFRAG, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
140 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_USB_DELAY}}}, {UI_SPACER}, {UI_INT, CFG_USBDELAY, 1, -1, 0, 0, {.intvalue = {3, 3, 0, 99}}}, {UI_BREAK},
141 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_USB_PREFIX}}}, {UI_SPACER}, {UI_STRING, CFG_USBPREFIX, 1, -1, 0, 0, {.stringvalue = {"", "", NULL}}}, {UI_BREAK},
143 {UI_BREAK},
145 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_HDD_SPINDOWN}}}, {UI_SPACER}, {UI_INT, CFG_HDDSPINDOWN, 1, _STR_HINT_SPINDOWN, 0, 0, {.intvalue = {20, 20, 0, 20}}},
147 {UI_SPLITTER},
149 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_USBMODE}}}, {UI_SPACER}, {UI_ENUM, CFG_USBMODE, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
150 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_HDDMODE}}}, {UI_SPACER}, {UI_ENUM, CFG_HDDMODE, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
151 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_ETHMODE}}}, {UI_SPACER}, {UI_ENUM, CFG_ETHMODE, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
152 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_APPMODE}}}, {UI_SPACER}, {UI_ENUM, CFG_APPMODE, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
153 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_DEFDEVICE}}}, {UI_SPACER}, {UI_ENUM, CFG_DEFDEVICE, 1, -1, 0, 0, {.intvalue = {0, 0}}},
155 {UI_SPLITTER},
157 {UI_OK, 0, 1, -1, 0, 0, {.label = {NULL, _STR_OK}}},
159 // end of dialog
160 {UI_TERMINATOR}
163 struct UIItem diaUIConfig[] = {
164 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_GFX_SETTINGS}}},
166 {UI_SPLITTER},
168 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_THEME}}}, {UI_SPACER}, {UI_ENUM, UICFG_THEME, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
169 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_LANGUAGE}}}, {UI_SPACER}, {UI_ENUM, UICFG_LANG, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
170 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_SCROLLING}}}, {UI_SPACER}, {UI_ENUM, UICFG_SCROLL, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
171 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_AUTOSORT}}}, {UI_SPACER}, {UI_BOOL, UICFG_AUTOSORT, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
172 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_AUTOREFRESH}}}, {UI_SPACER}, {UI_BOOL, UICFG_AUTOREFRESH, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
173 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_COVERART}}}, {UI_SPACER}, {UI_BOOL, UICFG_COVERART, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
174 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_USE_INFO_SCREEN}}}, {UI_SPACER}, {UI_BOOL, UICFG_INFOPAGE, 1, -1, 0, 0, {.intvalue = {0, 0}}},
176 {UI_SPLITTER},
178 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_TXTCOLOR}}}, {UI_SPACER}, {UI_COLOUR, UICFG_TXTCOL, 1, -1, -10, 17, {.colourvalue = {0, 0}}}, // UIItem #32
179 {UI_SPACER},
180 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_SELCOLOR}}}, {UI_SPACER}, {UI_COLOUR, UICFG_SELCOL, 1, -1, -10, 17, {.colourvalue = {0, 0}}}, // UIItem #36
181 {UI_BREAK},
182 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_UICOLOR}}}, {UI_SPACER}, {UI_COLOUR, UICFG_UICOL, 1, -1, -10, 17, {.colourvalue = {0, 0}}}, // UIItem #40
183 {UI_SPACER},
184 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_BGCOLOR}}}, {UI_SPACER}, {UI_COLOUR, UICFG_BGCOL, 1, -1, -10, 17, {.colourvalue = {0, 0}}}, // UIItem #44
185 {UI_BREAK},
187 {UI_SPLITTER},
189 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_VMODE}}}, {UI_SPACER}, {UI_ENUM, UICFG_VMODE, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK},
190 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {"V-Sync", -1}}}, {UI_SPACER}, {UI_BOOL, UICFG_VSYNC, 1, -1, 0, 0, {.intvalue = {1, 1}}}, {UI_BREAK},
191 {UI_LABEL, 0, 1, -1, -20, 0, {.label = {NULL, _STR_WIDE_SCREEN}}}, {UI_SPACER}, {UI_BOOL, UICFG_WIDESCREEN, 1, -1, 0, 0, {.intvalue = {0, 0}}},
193 {UI_SPLITTER},
195 {UI_OK, 0, 1, -1, 0, 0, {.label = {NULL, _STR_OK}}},
197 // end of dialog
198 {UI_TERMINATOR}
201 struct UIItem diaAbout[] = {
202 {UI_LABEL, 1, 1, -1, 0, 0, {.label = {NULL, -1}}},
204 {UI_SPLITTER},
206 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_DEVS}}}, {UI_BREAK},
208 {UI_BREAK},
210 {UI_SPACER}, {UI_LABEL, 0, 1, -1, 0, 15, {.label = {"crazyc", -1}}}, {UI_BREAK},
211 {UI_SPACER}, {UI_LABEL, 0, 1, -1, 0, 15, {.label = {"ifcaro", -1}}}, {UI_BREAK},
212 {UI_SPACER}, {UI_LABEL, 0, 1, -1, 0, 15, {.label = {"izdubar", -1}}}, {UI_BREAK},
213 {UI_SPACER}, {UI_LABEL, 0, 1, -1, 0, 15, {.label = {"jimmikaelkael", -1}}}, {UI_BREAK},
214 {UI_SPACER}, {UI_LABEL, 0, 1, -1, 0, 15, {.label = {"Polo35", -1}}}, {UI_BREAK},
215 {UI_SPACER}, {UI_LABEL, 0, 1, -1, 0, 15, {.label = {"volca", -1}}}, {UI_BREAK},
217 {UI_SPLITTER},
219 {UI_OK, 0, 1, -1, 0, 0, {.label = {NULL, _STR_OK}}},
221 // end of dialog
222 {UI_TERMINATOR}
225 #ifdef VMC
226 struct UIItem diaVMC[] = {
227 {UI_LABEL, 0, 1, -1, 0, 0, {.label = {NULL, _STR_VMC_SCREEN}}},
229 {UI_SPLITTER},
231 {UI_LABEL, 0, 1, -1, -15, 0, {.label = {NULL, _STR_VMC_NAME}}}, {UI_SPACER}, {UI_STRING, VMC_NAME, 1, -1, 0, 0, {.stringvalue = {"", "", &guiVmcNameHandler}}}, {UI_BREAK},
232 {UI_LABEL, 0, 1, -1, -15, 0, {.label = {NULL, _STR_VMC_SIZE}}}, {UI_SPACER}, {UI_ENUM, VMC_SIZE, 1, _STR_HINT_VMC_SIZE, 0, 0, {.intvalue = {0, 0}}},
234 {UI_SPLITTER},
236 {UI_LABEL, 0, 1, -1, -15, 0, {.label = {NULL, _STR_VMC_STATUS}}}, {UI_SPACER}, {UI_LABEL, VMC_STATUS, 0, -1, 0, 0, {.label = {NULL, -1}}}, {UI_BREAK},
237 {UI_LABEL, 0, 1, -1, -15, 0, {.label = {NULL, _STR_VMC_PROGRESS}}}, {UI_SPACER}, {UI_INT, VMC_PROGRESS, 0, -1, 0, 0, {.intvalue = {0, 0, 0, 100}}}, {UI_LABEL, 0, 1, -1, 0, 0, {.label = {"%", -1}}},
239 {UI_SPLITTER},
241 {UI_BUTTON, VMC_BUTTON_CREATE, 1, -1, 0, 0, {.label = {NULL, -1}}},
243 {UI_SPLITTER}, // UIItem #20
245 {UI_BUTTON, VMC_BUTTON_DELETE, 1, -1, 0, 0, {.label = {NULL, _STR_DELETE}}},
247 // end of dialog
248 {UI_TERMINATOR}
250 #endif