1 | //---------------------------------------------------------------------------
|
---|
2 | //File name: main.c
|
---|
3 | //---------------------------------------------------------------------------
|
---|
4 | #include "launchelf.h"
|
---|
5 |
|
---|
6 | //dlanor: I'm correcting all these erroneous 'u8 *name' declarations
|
---|
7 | //dlanor: They are not pointers at all, but pure block addresses
|
---|
8 | //dlanor: Thus they should be declared as 'void name'
|
---|
9 | extern void iomanx_irx;
|
---|
10 | extern int size_iomanx_irx;
|
---|
11 | extern void filexio_irx;
|
---|
12 | extern int size_filexio_irx;
|
---|
13 | extern void ps2dev9_irx;
|
---|
14 | extern int size_ps2dev9_irx;
|
---|
15 | extern void ps2ip_irx;
|
---|
16 | extern int size_ps2ip_irx;
|
---|
17 | extern void ps2smap_irx;
|
---|
18 | extern int size_ps2smap_irx;
|
---|
19 | extern void smsutils_irx;
|
---|
20 | extern int size_smsutils_irx;
|
---|
21 | extern void ps2host_irx;
|
---|
22 | extern int size_ps2host_irx;
|
---|
23 | extern void vmcfs_irx;
|
---|
24 | extern int size_vmcfs_irx;
|
---|
25 | extern void ps2ftpd_irx;
|
---|
26 | extern int size_ps2ftpd_irx;
|
---|
27 | extern void ps2atad_irx;
|
---|
28 | extern int size_ps2atad_irx;
|
---|
29 | extern void ps2hdd_irx;
|
---|
30 | extern int size_ps2hdd_irx;
|
---|
31 | extern void ps2fs_irx;
|
---|
32 | extern int size_ps2fs_irx;
|
---|
33 | extern void poweroff_irx;
|
---|
34 | extern int size_poweroff_irx;
|
---|
35 | extern void loader_elf;
|
---|
36 | extern int size_loader_elf;
|
---|
37 | extern void ps2netfs_irx;
|
---|
38 | extern int size_ps2netfs_irx;
|
---|
39 | extern void iopmod_irx;
|
---|
40 | extern int size_iopmod_irx;
|
---|
41 | extern void usbd_irx;
|
---|
42 | extern int size_usbd_irx;
|
---|
43 | extern void usb_mass_irx;
|
---|
44 | extern int size_usb_mass_irx;
|
---|
45 | extern void cdvd_irx;
|
---|
46 | extern int size_cdvd_irx;
|
---|
47 | extern void ps2kbd_irx;
|
---|
48 | extern int size_ps2kbd_irx;
|
---|
49 | extern void hdl_info_irx;
|
---|
50 | extern int size_hdl_info_irx;
|
---|
51 | extern void chkesr_irx;
|
---|
52 | extern int size_chkesr_irx;
|
---|
53 | //extern void mcman_irx;
|
---|
54 | //extern int size_mcman_irx;
|
---|
55 | //extern void mcserv_irx;
|
---|
56 | //extern int size_mcserv_irx;
|
---|
57 |
|
---|
58 | //#define DEBUG
|
---|
59 | #ifdef DEBUG
|
---|
60 | #define dbgprintf(args...) scr_printf(args)
|
---|
61 | #define dbginit_scr() init_scr()
|
---|
62 | #else
|
---|
63 | #define dbgprintf(args...) do { } while(0)
|
---|
64 | #define dbginit_scr() do { } while(0)
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | enum
|
---|
68 | {
|
---|
69 | BUTTON,
|
---|
70 | DPAD
|
---|
71 | };
|
---|
72 |
|
---|
73 | void Reset();
|
---|
74 |
|
---|
75 | int TV_mode;
|
---|
76 | int selected=0;
|
---|
77 | int timeout=0, prev_timeout=1;
|
---|
78 | int init_delay=0, prev_init_delay=1;
|
---|
79 | int poweroff_delay=0; //Set only when calling hddPowerOff
|
---|
80 | int mode=BUTTON;
|
---|
81 | int user_acted = 0; /* Set when commands given, to break timeout */
|
---|
82 | char LaunchElfDir[MAX_PATH], mainMsg[MAX_PATH];
|
---|
83 | char CNF[MAX_NAME];
|
---|
84 | int numCNF=0;
|
---|
85 | int maxCNF;
|
---|
86 | int swapKeys;
|
---|
87 | int GUI_active;
|
---|
88 |
|
---|
89 | u64 WaitTime;
|
---|
90 | u64 CurrTime;
|
---|
91 | u64 init_delay_start;
|
---|
92 | u64 timeout_start;
|
---|
93 | u64 poweroff_start;
|
---|
94 |
|
---|
95 | #define IPCONF_MAX_LEN (3*16)
|
---|
96 | char if_conf[IPCONF_MAX_LEN];
|
---|
97 | int if_conf_len;
|
---|
98 |
|
---|
99 | char ip[16] = "192.168.0.10";
|
---|
100 | char netmask[16] = "255.255.255.0";
|
---|
101 | char gw[16] = "192.168.0.1";
|
---|
102 |
|
---|
103 | char netConfig[IPCONF_MAX_LEN+64]; //Adjust size as needed
|
---|
104 |
|
---|
105 | //State of module collections
|
---|
106 | int have_NetModules = 0;
|
---|
107 | int have_HDD_modules = 0;
|
---|
108 | //State of sbv_patches
|
---|
109 | int have_sbv_patches = 0;
|
---|
110 | //Old State of Checkable Modules (valid header)
|
---|
111 | int old_sio2man = 0;
|
---|
112 | int old_mcman = 0;
|
---|
113 | int old_mcserv = 0;
|
---|
114 | int old_padman = 0;
|
---|
115 | int old_fakehost = 0;
|
---|
116 | int old_poweroff = 0;
|
---|
117 | int old_iomanx = 0;
|
---|
118 | int old_filexio = 0;
|
---|
119 | int old_ps2dev9 = 0;
|
---|
120 | int old_ps2ip = 0;
|
---|
121 | int old_ps2atad = 0;
|
---|
122 | int old_ps2hdd = 0;
|
---|
123 | int old_ps2fs = 0;
|
---|
124 | int old_ps2netfs = 0;
|
---|
125 | //State of Uncheckable Modules (invalid header)
|
---|
126 | int have_cdvd = 0;
|
---|
127 | int have_usbd = 0;
|
---|
128 | int have_usb_mass = 0;
|
---|
129 | int have_ps2smap = 0;
|
---|
130 | int have_ps2host = 0;
|
---|
131 | int have_vmcfs = 0; //vmcfs may be checkable. (must ask Polo)
|
---|
132 | int have_ps2ftpd = 0;
|
---|
133 | int have_ps2kbd = 0;
|
---|
134 | int have_hdl_info = 0;
|
---|
135 | //State of Checkable Modules (valid header)
|
---|
136 | int have_urgent = 0; //flags presence of urgently needed modules
|
---|
137 | int have_sio2man = 0;
|
---|
138 | int have_mcman = 0;
|
---|
139 | int have_mcserv = 0;
|
---|
140 | int have_padman = 0;
|
---|
141 | int have_fakehost = 0;
|
---|
142 | int have_poweroff = 0;
|
---|
143 | int have_iomanx = 0;
|
---|
144 | int have_filexio = 0;
|
---|
145 | int have_ps2dev9 = 0;
|
---|
146 | int have_ps2ip = 0;
|
---|
147 | int have_ps2atad = 0;
|
---|
148 | int have_ps2hdd = 0;
|
---|
149 | int have_ps2fs = 0;
|
---|
150 | int have_ps2netfs = 0;
|
---|
151 |
|
---|
152 | int have_chkesr = 0;
|
---|
153 |
|
---|
154 | int force_IOP = 0; //flags presence of incompatible drivers, so we must reset IOP
|
---|
155 |
|
---|
156 | int menu_LK[15]; //holds RunElf index for each valid main menu entry
|
---|
157 |
|
---|
158 | int done_setupPowerOff = 0;
|
---|
159 | int ps2kbd_opened = 0;
|
---|
160 |
|
---|
161 | int boot_argc;
|
---|
162 | char *boot_argv[8];
|
---|
163 | char boot_path[MAX_PATH];
|
---|
164 |
|
---|
165 | //Variables for SYSTEM.CNF processing
|
---|
166 | int BootDiscType = 0;
|
---|
167 | char SystemCnf_BOOT[MAX_PATH];
|
---|
168 | char SystemCnf_BOOT2[MAX_PATH];
|
---|
169 | char SystemCnf_VER[10]; //Arbitrary. Real value should always be shorter
|
---|
170 | char SystemCnf_VMODE[10]; //Arbitrary, same deal. As yet unused
|
---|
171 |
|
---|
172 | char default_ESR_path[] = "mc:/BOOT/ESR.ELF";
|
---|
173 |
|
---|
174 | char ROMVER_data[20]; //16 byte file read from rom0:ROMVER at init
|
---|
175 | CdvdDiscType_t cdmode; //Last detected disc type
|
---|
176 | CdvdDiscType_t old_cdmode; //used for disc change detection
|
---|
177 | CdvdDiscType_t uLE_cdmode; //used for smart disc detection
|
---|
178 |
|
---|
179 | typedef struct{
|
---|
180 | int type;
|
---|
181 | char name[16];
|
---|
182 | } DiscType;
|
---|
183 |
|
---|
184 | DiscType DiscTypes[] = {
|
---|
185 | {CDVD_TYPE_NODISK, "!"},
|
---|
186 | {CDVD_TYPE_DETECT, "??"},
|
---|
187 | {CDVD_TYPE_DETECT_CD, "CD ?"},
|
---|
188 | {CDVD_TYPE_DETECT_DVDSINGLE, "DVD ?"},
|
---|
189 | {CDVD_TYPE_DETECT_DVDDUAL, "DVD 2?"},
|
---|
190 | {CDVD_TYPE_UNKNOWN, "???"},
|
---|
191 | {CDVD_TYPE_PS1CD, "PS1 CD"},
|
---|
192 | {CDVD_TYPE_PS1CDDA, "PS1 CDDA"},
|
---|
193 | {CDVD_TYPE_PS2CD, "PS2 CD"},
|
---|
194 | {CDVD_TYPE_PS2CDDA, "PS2 CDDA"},
|
---|
195 | {CDVD_TYPE_PS2DVD, "PS2 DVD"},
|
---|
196 | {CDVD_TYPE_ESRDVD_0, "ESR DVD (off)"},
|
---|
197 | {CDVD_TYPE_ESRDVD_1, "ESR DVD (on)"},
|
---|
198 | {CDVD_TYPE_CDDA, "Audio CD"},
|
---|
199 | {CDVD_TYPE_DVDVIDEO, "Video DVD"},
|
---|
200 | {CDVD_TYPE_ILLEGAL, "????"},
|
---|
201 | {0x00, ""}//end of list
|
---|
202 | }; //ends DiscTypes array
|
---|
203 | //---------------------------------------------------------------------------
|
---|
204 | //executable code
|
---|
205 | //---------------------------------------------------------------------------
|
---|
206 | //Function to print a text row to the 'gs' screen
|
---|
207 | //------------------------------
|
---|
208 | int PrintRow(int row_f, char *text_p)
|
---|
209 | { static int row;
|
---|
210 | int x = (Menu_start_x + 4);
|
---|
211 | int y;
|
---|
212 |
|
---|
213 | if(row_f >= 0) row = row_f;
|
---|
214 | y = (Menu_start_y + FONT_HEIGHT*row++);
|
---|
215 | printXY(text_p, x, y, setting->color[3], TRUE, 0);
|
---|
216 | return row;
|
---|
217 | }
|
---|
218 | //------------------------------
|
---|
219 | //endfunc PrintRow
|
---|
220 | //---------------------------------------------------------------------------
|
---|
221 | //Function to print a text row with text positioning
|
---|
222 | //------------------------------
|
---|
223 | int PrintPos(int row_f, int column, char *text_p)
|
---|
224 | { static int row;
|
---|
225 | int x = (Menu_start_x + 4 + column*FONT_WIDTH);
|
---|
226 | int y;
|
---|
227 |
|
---|
228 | if(row_f >= 0) row = row_f;
|
---|
229 | y = (Menu_start_y + FONT_HEIGHT*row++);
|
---|
230 | printXY(text_p, x, y, setting->color[3], TRUE, 0);
|
---|
231 | return row;
|
---|
232 | }
|
---|
233 | //------------------------------
|
---|
234 | //endfunc PrintPos
|
---|
235 | //---------------------------------------------------------------------------
|
---|
236 | //Function to show a screen with debugging info
|
---|
237 | //------------------------------
|
---|
238 | void ShowDebugInfo(void)
|
---|
239 | { char TextRow[256];
|
---|
240 | int i, event, post_event=0;
|
---|
241 |
|
---|
242 | event = 1; //event = initial entry
|
---|
243 | //----- Start of event loop -----
|
---|
244 | while(1) {
|
---|
245 | //Pad response section
|
---|
246 | waitAnyPadReady();
|
---|
247 | if(readpad() && new_pad){
|
---|
248 | event |= 2;
|
---|
249 | if (setting->GUI_skin[0]) {
|
---|
250 | GUI_active = 1;
|
---|
251 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
252 | }
|
---|
253 | break;
|
---|
254 | }
|
---|
255 |
|
---|
256 | //Display section
|
---|
257 | if(event||post_event) { //NB: We need to update two frame buffers per event
|
---|
258 | clrScr(setting->color[0]);
|
---|
259 | PrintRow(0,"Debug Info Screen:");
|
---|
260 | sprintf(TextRow, "rom0:ROMVER == \"%s\"", ROMVER_data);
|
---|
261 | PrintRow(2,TextRow);
|
---|
262 | sprintf(TextRow, "argc == %d", boot_argc);
|
---|
263 | PrintRow(4,TextRow);
|
---|
264 | for(i=0; (i<boot_argc)&&(i<8); i++){
|
---|
265 | sprintf(TextRow, "argv[%d] == \"%s\"", i, boot_argv[i]);
|
---|
266 | PrintRow(-1, TextRow);
|
---|
267 | }
|
---|
268 | sprintf(TextRow, "boot_path == \"%s\"", boot_path);
|
---|
269 | PrintRow(-1, TextRow);
|
---|
270 | sprintf(TextRow, "LaunchElfDir == \"%s\"", LaunchElfDir);
|
---|
271 | PrintRow(-1, TextRow);
|
---|
272 | }//ends if(event||post_event)
|
---|
273 | drawScr();
|
---|
274 | post_event = event;
|
---|
275 | event = 0;
|
---|
276 | } //ends while
|
---|
277 | //----- End of event loop -----
|
---|
278 | }
|
---|
279 | //------------------------------
|
---|
280 | //endfunc ShowDebugInfo
|
---|
281 | //---------------------------------------------------------------------------
|
---|
282 | //Function to show a screen with program credits ("About uLE")
|
---|
283 | //------------------------------
|
---|
284 | void Show_About_uLE(void)
|
---|
285 | { char TextRow[256];
|
---|
286 | int event, post_event=0;
|
---|
287 | int hpos = 16;
|
---|
288 |
|
---|
289 | event = 1; //event = initial entry
|
---|
290 | //----- Start of event loop -----
|
---|
291 | while(1) {
|
---|
292 | //Pad response section
|
---|
293 | waitAnyPadReady();
|
---|
294 | if(readpad() && new_pad){
|
---|
295 | event |= 2;
|
---|
296 | if (setting->GUI_skin[0]) {
|
---|
297 | GUI_active = 1;
|
---|
298 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
299 | }
|
---|
300 | break;
|
---|
301 | }
|
---|
302 |
|
---|
303 | //Display section
|
---|
304 | if(event||post_event) { //NB: We need to update two frame buffers per event
|
---|
305 | clrScr(setting->color[0]);
|
---|
306 | sprintf(TextRow, "About uLaunchELF %s %s:", ULE_VERSION, ULE_VERDATE);
|
---|
307 | PrintPos(03,hpos,TextRow);
|
---|
308 | PrintPos(05,hpos,"Project maintainers:");
|
---|
309 | PrintPos(-1,hpos," Eric Price (aka: 'E P')");
|
---|
310 | PrintPos(-1,hpos," Ronald Andersson (aka: 'dlanor')");
|
---|
311 | PrintPos(-1,hpos,"");
|
---|
312 | PrintPos(-1,hpos,"Other contributors:");
|
---|
313 | PrintPos(-1,hpos," Polo35, radad, Drakonite, sincro");
|
---|
314 | PrintPos(-1,hpos," kthu, Slam-Tilt, chip, pixel, Hermes");
|
---|
315 | PrintPos(-1,hpos," and others in the PS2Dev community");
|
---|
316 | PrintPos(-1,hpos,"");
|
---|
317 | PrintPos(-1,hpos,"Main release site:");
|
---|
318 | PrintPos(-1,hpos," \"http://psx-scene.com/forums/\"");
|
---|
319 | PrintPos(-1,hpos,"");
|
---|
320 | PrintPos(-1,hpos,"Ancestral project: LaunchELF v3.41");
|
---|
321 | PrintPos(-1,hpos,"Created by: Mirakichi");
|
---|
322 | }//ends if(event||post_event)
|
---|
323 | drawScr();
|
---|
324 | post_event = event;
|
---|
325 | event = 0;
|
---|
326 | } //ends while
|
---|
327 | //----- End of event loop -----
|
---|
328 | }
|
---|
329 | //------------------------------
|
---|
330 | //endfunc Show_About_uLE
|
---|
331 | //---------------------------------------------------------------------------
|
---|
332 | //Function to check for presence of key modules
|
---|
333 | //------------------------------
|
---|
334 | void CheckModules(void)
|
---|
335 | { smod_mod_info_t mod_t;
|
---|
336 |
|
---|
337 | old_sio2man = (have_sio2man = smod_get_mod_by_name(IOPMOD_NAME_SIO2MAN, &mod_t));
|
---|
338 | old_mcman = (have_mcman = smod_get_mod_by_name(IOPMOD_NAME_MCMAN, &mod_t));
|
---|
339 | old_mcserv = (have_mcserv = smod_get_mod_by_name(IOPMOD_NAME_MCSERV, &mod_t));
|
---|
340 | old_padman = (have_padman = smod_get_mod_by_name(IOPMOD_NAME_PADMAN, &mod_t));
|
---|
341 | old_fakehost = (have_fakehost = smod_get_mod_by_name(IOPMOD_NAME_FAKEHOST, &mod_t));
|
---|
342 | old_poweroff = (have_poweroff = smod_get_mod_by_name(IOPMOD_NAME_POWEROFF, &mod_t));
|
---|
343 | old_iomanx = (have_iomanx = smod_get_mod_by_name(IOPMOD_NAME_IOMANX, &mod_t));
|
---|
344 | old_filexio = (have_filexio = smod_get_mod_by_name(IOPMOD_NAME_FILEXIO, &mod_t));
|
---|
345 | old_ps2dev9 = (have_ps2dev9 = smod_get_mod_by_name(IOPMOD_NAME_PS2DEV9, &mod_t));
|
---|
346 | old_ps2ip = (have_ps2ip = smod_get_mod_by_name(IOPMOD_NAME_PS2IP, &mod_t));
|
---|
347 | old_ps2atad = (have_ps2atad = smod_get_mod_by_name(IOPMOD_NAME_PS2ATAD, &mod_t));
|
---|
348 | old_ps2hdd = (have_ps2hdd = smod_get_mod_by_name(IOPMOD_NAME_PS2HDD, &mod_t));
|
---|
349 | old_ps2fs = (have_ps2fs = smod_get_mod_by_name(IOPMOD_NAME_PS2FS, &mod_t));
|
---|
350 | old_ps2netfs = (have_ps2netfs= smod_get_mod_by_name(IOPMOD_NAME_PS2NETFS, &mod_t));
|
---|
351 | }
|
---|
352 | //------------------------------
|
---|
353 | //endfunc CheckModules
|
---|
354 | //---------------------------------------------------------------------------
|
---|
355 | // Parse network configuration from IPCONFIG.DAT
|
---|
356 | // Now completely rewritten to fix some problems
|
---|
357 | //------------------------------
|
---|
358 | static void getIpConfig(void)
|
---|
359 | {
|
---|
360 | int fd;
|
---|
361 | int i;
|
---|
362 | int len;
|
---|
363 | char c;
|
---|
364 | char buf[IPCONF_MAX_LEN];
|
---|
365 | char path[MAX_PATH];
|
---|
366 |
|
---|
367 | if(uLE_related(path, "uLE:/IPCONFIG.DAT")==1)
|
---|
368 | fd = genOpen(path, O_RDONLY);
|
---|
369 | else
|
---|
370 | fd=-1;
|
---|
371 |
|
---|
372 | if (fd >= 0)
|
---|
373 | { bzero(buf, IPCONF_MAX_LEN);
|
---|
374 | len = genRead(fd, buf, IPCONF_MAX_LEN - 1); //Save a byte for termination
|
---|
375 | genClose(fd);
|
---|
376 | }
|
---|
377 |
|
---|
378 | if ((fd >= 0) && (len > 0))
|
---|
379 | { buf[len] = '\0'; //Ensure string termination, regardless of file content
|
---|
380 | for (i=0; ((c = buf[i]) != '\0'); i++) //Clear out spaces and any CR/LF
|
---|
381 | if ((c == ' ') || (c == '\r') || (c == '\n'))
|
---|
382 | buf[i] = '\0';
|
---|
383 | strncpy(ip, buf, 15);
|
---|
384 | i = strlen(ip)+1;
|
---|
385 | strncpy(netmask, buf+i, 15);
|
---|
386 | i += strlen(netmask)+1;
|
---|
387 | strncpy(gw, buf+i, 15);
|
---|
388 | }
|
---|
389 |
|
---|
390 | bzero(if_conf, IPCONF_MAX_LEN);
|
---|
391 | strncpy(if_conf, ip, 15);
|
---|
392 | i = strlen(ip) + 1;
|
---|
393 | strncpy(if_conf+i, netmask, 15);
|
---|
394 | i += strlen(netmask) + 1;
|
---|
395 | strncpy(if_conf+i, gw, 15);
|
---|
396 | i += strlen(gw) + 1;
|
---|
397 | if_conf_len = i;
|
---|
398 | sprintf(netConfig, "%s: %-15s %-15s %-15s", LNG(Net_Config), ip, netmask, gw);
|
---|
399 |
|
---|
400 | }
|
---|
401 | //------------------------------
|
---|
402 | //endfunc getIpConfig
|
---|
403 | //---------------------------------------------------------------------------
|
---|
404 | void setLaunchKeys(void)
|
---|
405 | {
|
---|
406 | if(!setting->LK_Flag[12])
|
---|
407 | strcpy(setting->LK_Path[12], setting->Misc_Configure);
|
---|
408 | if((maxCNF>1) && !setting->LK_Flag[13])
|
---|
409 | strcpy(setting->LK_Path[13], setting->Misc_Load_CNFprev);
|
---|
410 | if((maxCNF>1) && !setting->LK_Flag[14])
|
---|
411 | strcpy(setting->LK_Path[14], setting->Misc_Load_CNFnext);
|
---|
412 | }
|
---|
413 | //------------------------------
|
---|
414 | //endfunc setLaunchKeys()
|
---|
415 | //---------------------------------------------------------------------------
|
---|
416 | int drawMainScreen(void)
|
---|
417 | {
|
---|
418 | int nElfs=0;
|
---|
419 | int i;
|
---|
420 | int x, y;
|
---|
421 | u64 color;
|
---|
422 | char c[MAX_PATH+8], f[MAX_PATH];
|
---|
423 | char *p;
|
---|
424 |
|
---|
425 | setLaunchKeys();
|
---|
426 |
|
---|
427 | clrScr(setting->color[0]);
|
---|
428 |
|
---|
429 | x = Menu_start_x;
|
---|
430 | y = Menu_start_y;
|
---|
431 | c[0] = 0;
|
---|
432 | if(init_delay) sprintf(c, "%s: %d", LNG(Init_Delay), init_delay/1000);
|
---|
433 | else if(setting->LK_Path[0][0]){
|
---|
434 | if(!user_acted) sprintf(c, "%s: %d", LNG(TIMEOUT), timeout/1000);
|
---|
435 | else sprintf(c, "%s: %s", LNG(TIMEOUT), LNG(Halted));
|
---|
436 | }
|
---|
437 | if(c[0]){
|
---|
438 | printXY(c, x, y, setting->color[3], TRUE, 0);
|
---|
439 | y += FONT_HEIGHT*2;
|
---|
440 | }
|
---|
441 | for(i=0; i<15; i++){
|
---|
442 | if((setting->LK_Path[i][0]) && ((i<13) || (maxCNF>1) || setting->LK_Flag[i]))
|
---|
443 | {
|
---|
444 | menu_LK[nElfs] = i; //memorize RunElf index for this menu entry
|
---|
445 | switch(i){
|
---|
446 | case 0:
|
---|
447 | strcpy(c,"Default: ");
|
---|
448 | break;
|
---|
449 | case 1:
|
---|
450 | strcpy(c," ÿ0: ");
|
---|
451 | break;
|
---|
452 | case 2:
|
---|
453 | strcpy(c," ÿ1: ");
|
---|
454 | break;
|
---|
455 | case 3:
|
---|
456 | strcpy(c," ÿ2: ");
|
---|
457 | break;
|
---|
458 | case 4:
|
---|
459 | strcpy(c," ÿ3: ");
|
---|
460 | break;
|
---|
461 | case 5:
|
---|
462 | strcpy(c," L1: ");
|
---|
463 | break;
|
---|
464 | case 6:
|
---|
465 | strcpy(c," R1: ");
|
---|
466 | break;
|
---|
467 | case 7:
|
---|
468 | strcpy(c," L2: ");
|
---|
469 | break;
|
---|
470 | case 8:
|
---|
471 | strcpy(c," R2: ");
|
---|
472 | break;
|
---|
473 | case 9:
|
---|
474 | strcpy(c," L3: ");
|
---|
475 | break;
|
---|
476 | case 10:
|
---|
477 | strcpy(c," R3: ");
|
---|
478 | break;
|
---|
479 | case 11:
|
---|
480 | strcpy(c," START: ");
|
---|
481 | break;
|
---|
482 | case 12:
|
---|
483 | strcpy(c," SELECT: ");
|
---|
484 | break;
|
---|
485 | case 13:
|
---|
486 | sprintf(c,"%s: ", LNG(LEFT));
|
---|
487 | break;
|
---|
488 | case 14:
|
---|
489 | sprintf(c,"%s: ", LNG(RIGHT));
|
---|
490 | break;
|
---|
491 | } //ends switch
|
---|
492 | if(setting->Show_Titles) //Show Launch Titles ?
|
---|
493 | strcpy(f, setting->LK_Title[i]);
|
---|
494 | else
|
---|
495 | f[0] = '\0';
|
---|
496 | if(!f[0]) { //No title present, or allowed ?
|
---|
497 | if(setting->Hide_Paths) { //Hide full path ?
|
---|
498 | if((p=strrchr(setting->LK_Path[i], '/'))) // found delimiter ?
|
---|
499 | strcpy(f, p+1);
|
---|
500 | else // No delimiter !
|
---|
501 | strcpy(f, setting->LK_Path[i]);
|
---|
502 | if((p=strrchr(f, '.')))
|
---|
503 | *p = 0;
|
---|
504 | } else { //Show full path !
|
---|
505 | strcpy(f, setting->LK_Path[i]);
|
---|
506 | }
|
---|
507 | } //ends clause for No title
|
---|
508 | if(nElfs++==selected && mode==DPAD)
|
---|
509 | color = setting->color[2];
|
---|
510 | else
|
---|
511 | color = setting->color[3];
|
---|
512 | int len = (strlen(LNG(LEFT))+2>strlen(LNG(RIGHT))+2)?
|
---|
513 | strlen(LNG(LEFT))+2:strlen(LNG(RIGHT))+2;
|
---|
514 | if(i==13){ // LEFT
|
---|
515 | if(strlen(LNG(RIGHT))+2>strlen(LNG(LEFT))+2)
|
---|
516 | printXY(c, x+(strlen(LNG(RIGHT))+2>9?
|
---|
517 | ((strlen(LNG(RIGHT))+2)-(strlen(LNG(LEFT))+2))*FONT_WIDTH:
|
---|
518 | (9-(strlen(LNG(LEFT))+2))*FONT_WIDTH), y, color, TRUE, 0);
|
---|
519 | else
|
---|
520 | printXY(c, x+(strlen(LNG(LEFT))+2>9?
|
---|
521 | 0:(9-(strlen(LNG(LEFT))+2))*FONT_WIDTH), y, color, TRUE, 0);
|
---|
522 | }else if (i==14){ // RIGHT
|
---|
523 | if(strlen(LNG(LEFT))+2>strlen(LNG(RIGHT))+2)
|
---|
524 | printXY(c, x+(strlen(LNG(LEFT))+2>9?
|
---|
525 | ((strlen(LNG(LEFT))+2)-(strlen(LNG(RIGHT))+2))*FONT_WIDTH:
|
---|
526 | (9-(strlen(LNG(RIGHT))+2))*FONT_WIDTH), y, color, TRUE, 0);
|
---|
527 | else
|
---|
528 | printXY(c, x+(strlen(LNG(RIGHT))+2>9?
|
---|
529 | 0:(9-(strlen(LNG(RIGHT))+2))*FONT_WIDTH), y, color, TRUE, 0);
|
---|
530 | }else
|
---|
531 | printXY(c, x+(len>9? (len-9)*FONT_WIDTH:0), y, color, TRUE, 0);
|
---|
532 | printXY(f, x+(len>9? len*FONT_WIDTH:9*FONT_WIDTH), y, color, TRUE, 0);
|
---|
533 | y += FONT_HEIGHT;
|
---|
534 | } //ends clause for defined LK_Path[i] valid for menu
|
---|
535 | } //ends for
|
---|
536 |
|
---|
537 | if(mode==BUTTON) sprintf(c, "%s!", LNG(PUSH_ANY_BUTTON_or_DPAD));
|
---|
538 | else{
|
---|
539 | if(swapKeys)
|
---|
540 | sprintf(c, "ÿ1:%s ÿ0:%s", LNG(OK), LNG(Cancel));
|
---|
541 | else
|
---|
542 | sprintf(c, "ÿ0:%s ÿ1:%s", LNG(OK), LNG(Cancel));
|
---|
543 | }
|
---|
544 |
|
---|
545 | setScrTmp(mainMsg, c);
|
---|
546 |
|
---|
547 | return nElfs;
|
---|
548 | }
|
---|
549 | //------------------------------
|
---|
550 | //endfunc drawMainScreen
|
---|
551 | //---------------------------------------------------------------------------
|
---|
552 | int drawMainScreen2(int TV_mode)
|
---|
553 | {
|
---|
554 | int nElfs=0;
|
---|
555 | int i;
|
---|
556 | int x, y, xo_config=0, yo_config=0, yo_first=0, yo_step=0;
|
---|
557 | u64 color;
|
---|
558 | char c[MAX_PATH+8], f[MAX_PATH];
|
---|
559 | char *p;
|
---|
560 |
|
---|
561 | setLaunchKeys();
|
---|
562 |
|
---|
563 | clrScr(setting->color[0]);
|
---|
564 |
|
---|
565 | x = Menu_start_x;
|
---|
566 | y = Menu_start_y;
|
---|
567 |
|
---|
568 | if(init_delay) sprintf(c, "%s: %d", LNG(Delay), init_delay/1000);
|
---|
569 | else if(setting->LK_Path[0][0]){
|
---|
570 | if(!user_acted) sprintf(c, "%s: %d", LNG(TIMEOUT), timeout/1000);
|
---|
571 | else sprintf(c, "%s: %s", LNG(TIMEOUT), LNG(Halt));
|
---|
572 | }
|
---|
573 |
|
---|
574 | if(TV_mode == TV_mode_PAL){
|
---|
575 | printXY(c, x+448, y+FONT_HEIGHT+6, setting->color[3], TRUE, 0);
|
---|
576 | y += FONT_HEIGHT+5;
|
---|
577 | yo_first = 5;
|
---|
578 | yo_step = FONT_HEIGHT*2;
|
---|
579 | yo_config = -92;
|
---|
580 | xo_config = 370;
|
---|
581 | }else if(TV_mode == TV_mode_NTSC){
|
---|
582 | printXY(c, x+448, y+FONT_HEIGHT-5, setting->color[3], TRUE, 0);
|
---|
583 | y += FONT_HEIGHT-3;
|
---|
584 | yo_first = 3;
|
---|
585 | yo_step = FONT_HEIGHT*2-4;
|
---|
586 | yo_config = -80;
|
---|
587 | xo_config = 360;
|
---|
588 | }
|
---|
589 |
|
---|
590 | for(i=0; i<15; i++){
|
---|
591 | if((setting->LK_Path[i][0]) && ((i<13)||(maxCNF>1)||setting->LK_Flag[i]))
|
---|
592 | {
|
---|
593 | menu_LK[nElfs] = i; //memorize RunElf index for this menu entry
|
---|
594 | if(setting->Show_Titles) //Show Launch Titles ?
|
---|
595 | strcpy(f, setting->LK_Title[i]);
|
---|
596 | else
|
---|
597 | f[0] = '\0';
|
---|
598 | if(!f[0]) { //No title present, or allowed ?
|
---|
599 | if(setting->Hide_Paths) { //Hide full path ?
|
---|
600 | if((p=strrchr(setting->LK_Path[i], '/'))) // found delimiter ?
|
---|
601 | strcpy(f, p+1);
|
---|
602 | else // No delimiter !
|
---|
603 | strcpy(f, setting->LK_Path[i]);
|
---|
604 | if((p=strrchr(f, '.')))
|
---|
605 | *p = 0;
|
---|
606 | } else { //Show full path !
|
---|
607 | strcpy(f, setting->LK_Path[i]);
|
---|
608 | }
|
---|
609 | } //ends clause for No title
|
---|
610 | if(setting->LK_Path[i][0] && nElfs++==selected && mode==DPAD)
|
---|
611 | color = setting->color[2];
|
---|
612 | else
|
---|
613 | color = setting->color[3];
|
---|
614 | int len = (strlen(LNG(LEFT))+2>strlen(LNG(RIGHT))+2)?
|
---|
615 | strlen(LNG(LEFT))+2:strlen(LNG(RIGHT))+2;
|
---|
616 | if (i==0)
|
---|
617 | printXY(f, x+(len>9? len*FONT_WIDTH:9*FONT_WIDTH)+20, y, color, TRUE, 0);
|
---|
618 | else if (i==12)
|
---|
619 | printXY(f, x+(len>9? len*FONT_WIDTH:9*FONT_WIDTH)+xo_config, y, color, TRUE, 0);
|
---|
620 | else if (i==13)
|
---|
621 | printXY(f, x+(len>9? len*FONT_WIDTH:9*FONT_WIDTH)+xo_config, y, color, TRUE, 0);
|
---|
622 | else if (i==14)
|
---|
623 | printXY(f, x+(len>9? len*FONT_WIDTH:9*FONT_WIDTH)+xo_config, y, color, TRUE, 0);
|
---|
624 | else
|
---|
625 | printXY(f, x+(len>9? len*FONT_WIDTH:9*FONT_WIDTH)+10, y, color, TRUE, 0);
|
---|
626 | } //ends clause for defined LK_Path[i] valid for menu
|
---|
627 | y += yo_step;
|
---|
628 | if (i==0)
|
---|
629 | y+=yo_first;
|
---|
630 | else if (i==11)
|
---|
631 | y+=yo_config;
|
---|
632 | } //ends for
|
---|
633 |
|
---|
634 | c[0] = '\0'; //dummy tooltip string (Tooltip unused for GUI menu)
|
---|
635 | setScrTmp(mainMsg, c);
|
---|
636 |
|
---|
637 | return nElfs;
|
---|
638 | }
|
---|
639 | //------------------------------
|
---|
640 | //endfunc drawMainScreen2
|
---|
641 | //---------------------------------------------------------------------------
|
---|
642 | void delay(int count)
|
---|
643 | {
|
---|
644 | int i;
|
---|
645 | int ret;
|
---|
646 | for (i = 0; i < count; i++) {
|
---|
647 | ret = 0x01000000;
|
---|
648 | while(ret--) asm("nop\nnop\nnop\nnop");
|
---|
649 | }
|
---|
650 | }
|
---|
651 | //------------------------------
|
---|
652 | //endfunc delay
|
---|
653 | //---------------------------------------------------------------------------
|
---|
654 | void initsbv_patches(void)
|
---|
655 | {
|
---|
656 | if(!have_sbv_patches)
|
---|
657 | { dbgprintf("Init MrBrown sbv_patches\n");
|
---|
658 | sbv_patch_enable_lmb();
|
---|
659 | sbv_patch_disable_prefix_check();
|
---|
660 | have_sbv_patches = 1;
|
---|
661 | }
|
---|
662 | }
|
---|
663 | //------------------------------
|
---|
664 | //endfunc initsbv_patches
|
---|
665 | //---------------------------------------------------------------------------
|
---|
666 | void load_iomanx(void)
|
---|
667 | {
|
---|
668 | int ret;
|
---|
669 |
|
---|
670 | if (!have_iomanx)
|
---|
671 | { SifExecModuleBuffer(&iomanx_irx, size_iomanx_irx, 0, NULL, &ret);
|
---|
672 | have_iomanx = 1;
|
---|
673 | }
|
---|
674 | }
|
---|
675 | //------------------------------
|
---|
676 | //endfunc load_iomanx
|
---|
677 | //---------------------------------------------------------------------------
|
---|
678 | void load_filexio(void)
|
---|
679 | {
|
---|
680 | int ret;
|
---|
681 |
|
---|
682 | if (!have_filexio)
|
---|
683 | { SifExecModuleBuffer(&filexio_irx, size_filexio_irx, 0, NULL, &ret);
|
---|
684 | have_filexio = 1;
|
---|
685 | }
|
---|
686 | }
|
---|
687 | //------------------------------
|
---|
688 | //endfunc load_filexio
|
---|
689 | //---------------------------------------------------------------------------
|
---|
690 | void load_ps2dev9(void)
|
---|
691 | {
|
---|
692 | int ret;
|
---|
693 |
|
---|
694 | load_iomanx();
|
---|
695 | if (!have_ps2dev9)
|
---|
696 | { SifExecModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, &ret);
|
---|
697 | have_ps2dev9 = 1;
|
---|
698 | }
|
---|
699 | }
|
---|
700 | //------------------------------
|
---|
701 | //endfunc load_ps2dev9
|
---|
702 | //---------------------------------------------------------------------------
|
---|
703 | void load_ps2ip(void)
|
---|
704 | {
|
---|
705 | int ret;
|
---|
706 |
|
---|
707 | load_ps2dev9();
|
---|
708 | if (!have_ps2ip){
|
---|
709 | SifExecModuleBuffer(&smsutils_irx, size_smsutils_irx, 0, NULL, &ret);
|
---|
710 | SifExecModuleBuffer(&ps2ip_irx, size_ps2ip_irx, 0, NULL, &ret);
|
---|
711 | have_ps2ip = 1;
|
---|
712 | }
|
---|
713 | if (!have_ps2smap){
|
---|
714 | SifExecModuleBuffer(&ps2smap_irx, size_ps2smap_irx,
|
---|
715 | if_conf_len, &if_conf[0], &ret);
|
---|
716 | have_ps2smap = 1;
|
---|
717 | }
|
---|
718 | }
|
---|
719 | //------------------------------
|
---|
720 | //endfunc load_ps2ip
|
---|
721 | //---------------------------------------------------------------------------
|
---|
722 | void load_ps2atad(void)
|
---|
723 | {
|
---|
724 | int ret;
|
---|
725 | static char hddarg[] = "-o" "\0" "4" "\0" "-n" "\0" "20";
|
---|
726 | static char pfsarg[] = "-m" "\0" "4" "\0" "-o" "\0" "10" "\0" "-n" "\0" "40";
|
---|
727 |
|
---|
728 | load_ps2dev9();
|
---|
729 | if (!have_ps2atad)
|
---|
730 | { SifExecModuleBuffer(&ps2atad_irx, size_ps2atad_irx, 0, NULL, &ret);
|
---|
731 | have_ps2atad = 1;
|
---|
732 | }
|
---|
733 | if (!have_ps2hdd)
|
---|
734 | { SifExecModuleBuffer(&ps2hdd_irx, size_ps2hdd_irx, sizeof(hddarg), hddarg, &ret);
|
---|
735 | have_ps2hdd = 1;
|
---|
736 | }
|
---|
737 | if (!have_ps2fs)
|
---|
738 | { SifExecModuleBuffer(&ps2fs_irx, size_ps2fs_irx, sizeof(pfsarg), pfsarg, &ret);
|
---|
739 | have_ps2fs = 1;
|
---|
740 | }
|
---|
741 | }
|
---|
742 | //------------------------------
|
---|
743 | //endfunc load_ps2atad
|
---|
744 | //---------------------------------------------------------------------------
|
---|
745 | void load_ps2host(void)
|
---|
746 | {
|
---|
747 | int ret;
|
---|
748 |
|
---|
749 | setupPowerOff(); //resolves the stall out when opening host: from LaunchELF's FileBrowser
|
---|
750 | load_ps2ip();
|
---|
751 | if (!have_ps2host)
|
---|
752 | { SifExecModuleBuffer(&ps2host_irx, size_ps2host_irx, 0, NULL, &ret);
|
---|
753 | have_ps2host = 1;
|
---|
754 | }
|
---|
755 | }
|
---|
756 | //------------------------------
|
---|
757 | //endfunc load_ps2host
|
---|
758 | //---------------------------------------------------------------------------
|
---|
759 | void load_vmcfs(void)
|
---|
760 | {
|
---|
761 | int ret;
|
---|
762 |
|
---|
763 | load_iomanx();
|
---|
764 | load_filexio();
|
---|
765 | if (!have_vmcfs)
|
---|
766 | { SifExecModuleBuffer(&vmcfs_irx, size_vmcfs_irx, 0, NULL, &ret);
|
---|
767 | have_vmcfs = 1;
|
---|
768 | }
|
---|
769 | }
|
---|
770 | //------------------------------
|
---|
771 | //endfunc load_vmcfs
|
---|
772 | //---------------------------------------------------------------------------
|
---|
773 | void load_ps2ftpd(void)
|
---|
774 | {
|
---|
775 | int ret;
|
---|
776 | int arglen;
|
---|
777 | char* arg_p;
|
---|
778 |
|
---|
779 | arg_p = "-anonymous";
|
---|
780 | arglen = strlen(arg_p);
|
---|
781 |
|
---|
782 | load_ps2ip();
|
---|
783 | if (!have_ps2ftpd)
|
---|
784 | { SifExecModuleBuffer(&ps2ftpd_irx, size_ps2ftpd_irx, arglen, arg_p, &ret);
|
---|
785 | have_ps2ftpd = 1;
|
---|
786 | }
|
---|
787 | }
|
---|
788 | //------------------------------
|
---|
789 | //endfunc load_ps2ftpd
|
---|
790 | //---------------------------------------------------------------------------
|
---|
791 | void load_ps2netfs(void)
|
---|
792 | {
|
---|
793 | int ret;
|
---|
794 |
|
---|
795 | load_ps2ip();
|
---|
796 | if (!have_ps2netfs)
|
---|
797 | { SifExecModuleBuffer(&ps2netfs_irx, size_ps2netfs_irx, 0, NULL, &ret);
|
---|
798 | have_ps2netfs = 1;
|
---|
799 | }
|
---|
800 | }
|
---|
801 | //------------------------------
|
---|
802 | //endfunc load_ps2netfs
|
---|
803 | //---------------------------------------------------------------------------
|
---|
804 | void loadBasicModules(void)
|
---|
805 | {
|
---|
806 | int ret;
|
---|
807 |
|
---|
808 | if (!have_sio2man) {
|
---|
809 | SifLoadModule("rom0:SIO2MAN", 0, NULL);
|
---|
810 | have_sio2man = 1;
|
---|
811 | }
|
---|
812 | if (!have_mcman) {
|
---|
813 | //SifExecModuleBuffer(&mcman_irx, size_mcman_irx, 0, NULL, &ret); //Home
|
---|
814 | SifLoadModule("rom0:MCMAN", 0, NULL); //Sony
|
---|
815 | have_mcman = 1;
|
---|
816 | }
|
---|
817 | if (!have_mcserv) {
|
---|
818 | //SifExecModuleBuffer(&mcserv_irx, size_mcserv_irx, 0, NULL, &ret); //Home
|
---|
819 | SifLoadModule("rom0:MCSERV", 0, NULL); //Sony
|
---|
820 | have_mcserv = 1;
|
---|
821 | }
|
---|
822 | if (!have_padman) {
|
---|
823 | SifLoadModule("rom0:PADMAN", 0, NULL);
|
---|
824 | have_padman = 1;
|
---|
825 | }
|
---|
826 | }
|
---|
827 | //------------------------------
|
---|
828 | //endfunc loadBasicModules
|
---|
829 | //---------------------------------------------------------------------------
|
---|
830 | void loadCdModules(void)
|
---|
831 | {
|
---|
832 | int ret;
|
---|
833 |
|
---|
834 | if (!have_cdvd) {
|
---|
835 | SifExecModuleBuffer(&cdvd_irx, size_cdvd_irx, 0, NULL, &ret);
|
---|
836 | cdInit(CDVD_INIT_INIT);
|
---|
837 | CDVD_Init();
|
---|
838 | have_cdvd = 1;
|
---|
839 | }
|
---|
840 | }
|
---|
841 | //------------------------------
|
---|
842 | //endfunc loadCdModules
|
---|
843 | //---------------------------------------------------------------------------
|
---|
844 | void load_chkesr_module(void)
|
---|
845 | {
|
---|
846 | // load chkesr and other modules (EROMDRV) needed to read DVDV
|
---|
847 |
|
---|
848 | int ret;
|
---|
849 |
|
---|
850 | if(have_chkesr)
|
---|
851 | return;
|
---|
852 |
|
---|
853 | SifExecModuleBuffer(&chkesr_irx, size_chkesr_irx, 0, NULL, &ret);
|
---|
854 | chkesr_rpc_Init();
|
---|
855 | have_chkesr = 1;
|
---|
856 | }
|
---|
857 | //------------------------------
|
---|
858 | //endfunc load_chkesr_module
|
---|
859 | //---------------------------------------------------------------------------
|
---|
860 | int uLE_cdDiscValid(void) //returns 1 if disc valid, else returns 0
|
---|
861 | {
|
---|
862 | if (!have_cdvd) {
|
---|
863 | loadCdModules();
|
---|
864 | }
|
---|
865 |
|
---|
866 | cdmode = cdGetDiscType();
|
---|
867 |
|
---|
868 | switch(cdmode){
|
---|
869 | case CDVD_TYPE_PS1CD:
|
---|
870 | case CDVD_TYPE_PS1CDDA:
|
---|
871 | case CDVD_TYPE_PS2CD:
|
---|
872 | case CDVD_TYPE_PS2CDDA:
|
---|
873 | case CDVD_TYPE_PS2DVD:
|
---|
874 | // case CDVD_TYPE_ESRDVD_0:
|
---|
875 | // case CDVD_TYPE_ESRDVD_1:
|
---|
876 | case CDVD_TYPE_CDDA:
|
---|
877 | case CDVD_TYPE_DVDVIDEO:
|
---|
878 | return 1;
|
---|
879 | case CDVD_TYPE_NODISK:
|
---|
880 | case CDVD_TYPE_DETECT:
|
---|
881 | case CDVD_TYPE_DETECT_CD:
|
---|
882 | case CDVD_TYPE_DETECT_DVDSINGLE:
|
---|
883 | case CDVD_TYPE_DETECT_DVDDUAL:
|
---|
884 | case CDVD_TYPE_UNKNOWN:
|
---|
885 | case CDVD_TYPE_ILLEGAL:
|
---|
886 | default:
|
---|
887 | return 0;
|
---|
888 | }
|
---|
889 | }
|
---|
890 | //------------------------------
|
---|
891 | //endfunc uLE_cdDiscValid
|
---|
892 | //---------------------------------------------------------------------------
|
---|
893 | int uLE_cdStop(void)
|
---|
894 | {
|
---|
895 | int test;
|
---|
896 |
|
---|
897 | old_cdmode = cdmode;
|
---|
898 | test = uLE_cdDiscValid();
|
---|
899 | uLE_cdmode = cdmode;
|
---|
900 | if (test){ //if stable detection of a real disc is achieved
|
---|
901 | if((cdmode !=old_cdmode) //if this was a new detection
|
---|
902 | && ((cdmode == CDVD_TYPE_DVDVIDEO) || (cdmode == CDVD_TYPE_PS2DVD))){
|
---|
903 | load_chkesr_module(); //prepare to check for ESR disc
|
---|
904 | test = Check_ESR_Disc();
|
---|
905 | printf("Check_ESR_Disc => %d\n", test);
|
---|
906 | if(test > 0){ //ESR Disc ?
|
---|
907 | uLE_cdmode = (cdmode == CDVD_TYPE_PS2DVD)
|
---|
908 | ? CDVD_TYPE_ESRDVD_1 : CDVD_TYPE_ESRDVD_0 ;
|
---|
909 | }
|
---|
910 | }
|
---|
911 | CDVD_Stop();
|
---|
912 | }
|
---|
913 | return uLE_cdmode;
|
---|
914 | }
|
---|
915 | //------------------------------
|
---|
916 | //endfunc uLE_cdStop
|
---|
917 | //---------------------------------------------------------------------------
|
---|
918 | // loadExternalFile below will use the given path, and read the
|
---|
919 | // indicated file into a buffer it allocates for that purpose.
|
---|
920 | // The buffer address and size are returned via pointer variables,
|
---|
921 | // and the size is also returned as function value. Both those
|
---|
922 | // instances of size will be forced to Zero if any error occurs,
|
---|
923 | // and in such cases the buffer pointer returned will be NULL.
|
---|
924 | // NB: Release of the allocated memory block, if/when it is not
|
---|
925 | // needed anymore, is entirely the responsibility of the caller,
|
---|
926 | // though, of course, none is allocated if the file is not found.
|
---|
927 | //---------------------------------------------------------------------------
|
---|
928 | int loadExternalFile(char *argPath, void **fileBaseP, int *fileSizeP)
|
---|
929 | { //The first three variables are local variants similar to the arguments
|
---|
930 | char filePath[MAX_PATH];
|
---|
931 | char *pathSep;
|
---|
932 | void *fileBase;
|
---|
933 | int fileSize;
|
---|
934 | FILE* File;
|
---|
935 |
|
---|
936 | fileBase = NULL;
|
---|
937 | fileSize = 0;
|
---|
938 |
|
---|
939 | pathSep = strchr(argPath, '/');
|
---|
940 |
|
---|
941 | if(!strncmp(argPath, "mass", 4)){
|
---|
942 | //Loading some module from USB mass:
|
---|
943 | //NB: This won't be for USB drivers, due to protection elsewhere
|
---|
944 | loadUsbModules();
|
---|
945 | strcpy(filePath, argPath);
|
---|
946 | if(pathSep && (pathSep-argPath<7) && pathSep[-1]==':')
|
---|
947 | strcpy(filePath+(pathSep-argPath), pathSep+1);
|
---|
948 |
|
---|
949 | }else if(!strncmp(argPath, "hdd0:/", 6)){
|
---|
950 | //Loading some module from HDD
|
---|
951 | char party[MAX_PATH];
|
---|
952 | char *p;
|
---|
953 |
|
---|
954 | loadHddModules();
|
---|
955 | sprintf(party, "hdd0:%s", argPath+6);
|
---|
956 | p = strchr(party, '/');
|
---|
957 | sprintf(filePath, "pfs0:%s", p);
|
---|
958 | *p = 0;
|
---|
959 | fileXioMount("pfs0:", party, FIO_MT_RDONLY);
|
---|
960 |
|
---|
961 | }else if(!strncmp(argPath, "cdfs", 4)){
|
---|
962 | loadCdModules();
|
---|
963 | strcpy(filePath, argPath);
|
---|
964 | CDVD_FlushCache();
|
---|
965 | CDVD_DiskReady(0);
|
---|
966 | }else{
|
---|
967 | (void) uLE_related(filePath, argPath);
|
---|
968 | }
|
---|
969 | //Here 'filePath' is a valid path for fio or fileXio operations
|
---|
970 | //Which means we can now use generic file I/O
|
---|
971 | File = fopen( filePath, "r" );
|
---|
972 | if( File != NULL ) {
|
---|
973 | fseek(File, 0, SEEK_END);
|
---|
974 | fileSize = ftell(File);
|
---|
975 | fseek(File, 0, SEEK_SET);
|
---|
976 | if(fileSize) {
|
---|
977 | if((fileBase = malloc(fileSize)) > 0 ) {
|
---|
978 | fread(fileBase, 1, fileSize, File );
|
---|
979 | } else
|
---|
980 | fileSize =0;
|
---|
981 | }
|
---|
982 | fclose(File);
|
---|
983 | }
|
---|
984 | *fileBaseP = fileBase;
|
---|
985 | *fileSizeP = fileSize;
|
---|
986 | return fileSize;
|
---|
987 | }
|
---|
988 | //------------------------------
|
---|
989 | //endfunc loadExternalFile
|
---|
990 | //---------------------------------------------------------------------------
|
---|
991 | // loadExternalModule below will use the given path and attempt
|
---|
992 | // to load the indicated file into a temporary buffer, and from
|
---|
993 | // that buffer send it on to the IOP as a driver module, after
|
---|
994 | // which the temporary buffer will be freed. If the file is not
|
---|
995 | // found, or some error occurs in its reading or buffer allocation
|
---|
996 | // then the default internal module specified by the 2nd and 3rd
|
---|
997 | // arguments will be used, except if the base is NULL or the size
|
---|
998 | // is zero, in which case a value of 0 is returned. A value of
|
---|
999 | // 0 is also returned if loading of default module fails. But
|
---|
1000 | // normally the value returned will be 1 for an internal default
|
---|
1001 | // module, but 2 for an external module..
|
---|
1002 | //---------------------------------------------------------------------------
|
---|
1003 | int loadExternalModule(char *modPath, void *defBase, int defSize)
|
---|
1004 | {
|
---|
1005 | void *extBase;
|
---|
1006 | int extSize;
|
---|
1007 | int external; //Flags loading of external file into buffer
|
---|
1008 | int ext_OK, def_OK; //Flags success for external and default module
|
---|
1009 | int dummy;
|
---|
1010 |
|
---|
1011 | ext_OK = (def_OK = 0);
|
---|
1012 | if( (!(external = loadExternalFile(modPath, &extBase, &extSize)))
|
---|
1013 | ||((ext_OK = SifExecModuleBuffer(extBase, extSize, 0, NULL, &dummy)) < 0) ) {
|
---|
1014 | if(defBase && defSize) {
|
---|
1015 | def_OK = SifExecModuleBuffer(defBase, defSize, 0, NULL, &dummy);
|
---|
1016 | }
|
---|
1017 | }
|
---|
1018 | if(external) free(extBase);
|
---|
1019 | if(ext_OK) return 2;
|
---|
1020 | if(def_OK) return 1;
|
---|
1021 | return 0;
|
---|
1022 | }
|
---|
1023 | //------------------------------
|
---|
1024 | //endfunc loadExternalModule
|
---|
1025 | //---------------------------------------------------------------------------
|
---|
1026 | void loadUsbDModule(void)
|
---|
1027 | {
|
---|
1028 | if( (!have_usbd)
|
---|
1029 | &&(loadExternalModule(setting->usbd_file, &usbd_irx, size_usbd_irx))
|
---|
1030 | ) have_usbd = 1;
|
---|
1031 | }
|
---|
1032 | //------------------------------
|
---|
1033 | //endfunc loadUsbDModule
|
---|
1034 | //---------------------------------------------------------------------------
|
---|
1035 | void loadUsbModules(void)
|
---|
1036 | {
|
---|
1037 | //int ret;
|
---|
1038 |
|
---|
1039 | loadUsbDModule();
|
---|
1040 | if( have_usbd
|
---|
1041 | && !have_usb_mass
|
---|
1042 | && (USB_mass_loaded = loadExternalModule(setting->usbmass_file, &usb_mass_irx, size_usb_mass_irx))){
|
---|
1043 | delay(3);
|
---|
1044 | //ret = usb_mass_bindRpc(); //dlanor: disused in switching to usbhdfsd
|
---|
1045 | have_usb_mass = 1;
|
---|
1046 | }
|
---|
1047 | if(USB_mass_loaded == 1) //if using the internal mass driver
|
---|
1048 | USB_mass_max_drives = USB_MASS_MAX_DRIVES; //allow multiple drives
|
---|
1049 | else
|
---|
1050 | USB_mass_max_drives = 1; //else allow only one mass drive
|
---|
1051 | }
|
---|
1052 | //------------------------------
|
---|
1053 | //endfunc loadUsbModules
|
---|
1054 | //---------------------------------------------------------------------------
|
---|
1055 | void loadKbdModules(void)
|
---|
1056 | {
|
---|
1057 | loadUsbDModule();
|
---|
1058 | if( (have_usbd && !have_ps2kbd)
|
---|
1059 | &&(loadExternalModule(setting->usbkbd_file, &ps2kbd_irx, size_ps2kbd_irx))
|
---|
1060 | ) have_ps2kbd = 1;
|
---|
1061 | }
|
---|
1062 | //------------------------------
|
---|
1063 | //endfunc loadKbdModules
|
---|
1064 | //---------------------------------------------------------------------------
|
---|
1065 | void loadHdlInfoModule(void)
|
---|
1066 | {
|
---|
1067 | int ret;
|
---|
1068 |
|
---|
1069 | if(!have_hdl_info){
|
---|
1070 | drawMsg(LNG(Loading_HDL_Info_Module));
|
---|
1071 | SifExecModuleBuffer(&hdl_info_irx, size_hdl_info_irx, 0, NULL, &ret);
|
---|
1072 | ret = Hdl_Info_BindRpc();
|
---|
1073 | have_hdl_info = 1;
|
---|
1074 | }
|
---|
1075 | }
|
---|
1076 | //------------------------------
|
---|
1077 | //endfunc loadHdlInfoModule
|
---|
1078 | //---------------------------------------------------------------------------
|
---|
1079 | void poweroffHandler(int i)
|
---|
1080 | {
|
---|
1081 | //hddPowerOff(); //deprecated
|
---|
1082 | poweroffShutdown();
|
---|
1083 | }
|
---|
1084 | //------------------------------
|
---|
1085 | //endfunc poweroffHandler
|
---|
1086 | //---------------------------------------------------------------------------
|
---|
1087 | void setupPowerOff(void) {
|
---|
1088 | int ret;
|
---|
1089 |
|
---|
1090 | if(!done_setupPowerOff) {
|
---|
1091 | //hddPreparePoweroff(); //deprecated
|
---|
1092 | //hddSetUserPoweroffCallback((void *)poweroffHandler, NULL); //deprecated
|
---|
1093 | if (!have_poweroff) {
|
---|
1094 | SifExecModuleBuffer(&poweroff_irx, size_poweroff_irx, 0, NULL, &ret);
|
---|
1095 | have_poweroff = 1;
|
---|
1096 | }
|
---|
1097 | poweroffInit();
|
---|
1098 | poweroffSetCallback((void *)poweroffHandler, NULL);
|
---|
1099 | load_iomanx();
|
---|
1100 | load_filexio();
|
---|
1101 | load_ps2dev9();
|
---|
1102 | done_setupPowerOff = 1;
|
---|
1103 | }
|
---|
1104 | }
|
---|
1105 | //------------------------------
|
---|
1106 | //endfunc setupPowerOff
|
---|
1107 | //---------------------------------------------------------------------------
|
---|
1108 | void loadHddModules(void)
|
---|
1109 | {
|
---|
1110 | if(!have_HDD_modules) {
|
---|
1111 | drawMsg(LNG(Loading_HDD_Modules));
|
---|
1112 | setupPowerOff();
|
---|
1113 | load_ps2atad(); //also loads ps2hdd & ps2fs
|
---|
1114 | have_HDD_modules = TRUE;
|
---|
1115 | }
|
---|
1116 | }
|
---|
1117 | //------------------------------
|
---|
1118 | //endfunc loadHddModules
|
---|
1119 | //---------------------------------------------------------------------------
|
---|
1120 | // Load Network modules by EP (modified by RA)
|
---|
1121 | //------------------------------
|
---|
1122 | void loadNetModules(void)
|
---|
1123 | {
|
---|
1124 | if(!have_NetModules){
|
---|
1125 | loadHddModules();
|
---|
1126 | loadUsbModules();
|
---|
1127 | drawMsg(LNG(Loading_NetFS_and_FTP_Server_Modules));
|
---|
1128 |
|
---|
1129 | getIpConfig(); //RA NB: I always get that info, early in init
|
---|
1130 | // //But sometimes it is useful to do it again (HDD)
|
---|
1131 | // Also, my module checking makes some other tests redundant
|
---|
1132 | load_ps2netfs(); // loads ps2netfs from internal buffer
|
---|
1133 | load_ps2ftpd(); // loads ps2dftpd from internal buffer
|
---|
1134 | have_NetModules = 1;
|
---|
1135 | }
|
---|
1136 | strcpy(mainMsg, netConfig);
|
---|
1137 | if (setting->GUI_skin[0]) {
|
---|
1138 | GUI_active = 1;
|
---|
1139 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1140 | }
|
---|
1141 | }
|
---|
1142 | //------------------------------
|
---|
1143 | //endfunc loadNetModules
|
---|
1144 | //---------------------------------------------------------------------------
|
---|
1145 | void startKbd(void)
|
---|
1146 | {
|
---|
1147 | int kbd_fd;
|
---|
1148 | void *mapBase;
|
---|
1149 | int mapSize;
|
---|
1150 |
|
---|
1151 | printf("Entering startKbd()\r\n");
|
---|
1152 | if(setting->usbkbd_used) {
|
---|
1153 | loadKbdModules();
|
---|
1154 | PS2KbdInit();
|
---|
1155 | ps2kbd_opened = 1;
|
---|
1156 | if(setting->kbdmap_file[0]) {
|
---|
1157 | if((kbd_fd = fioOpen(PS2KBD_DEVFILE, O_RDONLY)) >= 0) {
|
---|
1158 | printf("kbd_fd=%d; Loading Kbd map file \"%s\"\r\n",kbd_fd,setting->kbdmap_file);
|
---|
1159 | if(loadExternalFile(setting->kbdmap_file, &mapBase, &mapSize)) {
|
---|
1160 | if(mapSize == 0x600) {
|
---|
1161 | fioIoctl(kbd_fd, PS2KBD_IOCTL_SETKEYMAP, mapBase);
|
---|
1162 | fioIoctl(kbd_fd, PS2KBD_IOCTL_SETSPECIALMAP, mapBase+0x300);
|
---|
1163 | fioIoctl(kbd_fd, PS2KBD_IOCTL_SETCTRLMAP, mapBase+0x400);
|
---|
1164 | fioIoctl(kbd_fd, PS2KBD_IOCTL_SETALTMAP, mapBase+0x500);
|
---|
1165 | }
|
---|
1166 | printf("Freeing buffer after setting Kbd maps\r\n");
|
---|
1167 | free(mapBase);
|
---|
1168 | }
|
---|
1169 | fioClose(kbd_fd);
|
---|
1170 | }
|
---|
1171 | }
|
---|
1172 | }
|
---|
1173 | }
|
---|
1174 | //------------------------------
|
---|
1175 | //endfunc startKbd
|
---|
1176 | //---------------------------------------------------------------------------
|
---|
1177 | //scanSystemCnf will check for a standard variable of a SYSTEM.CNF file
|
---|
1178 | //------------------------------
|
---|
1179 | int scanSystemCnf(unsigned char *name, unsigned char *value)
|
---|
1180 | {
|
---|
1181 | if(!strcmp(name,"BOOT")) strncat(SystemCnf_BOOT, value, MAX_PATH-1);
|
---|
1182 | else if(!strcmp(name,"BOOT2")) strncat(SystemCnf_BOOT2, value, MAX_PATH-1);
|
---|
1183 | else if(!strcmp(name,"VER")) strncat(SystemCnf_VER, value, 9);
|
---|
1184 | else if(!strcmp(name,"VMODE")) strncat(SystemCnf_VMODE, value, 9);
|
---|
1185 | else
|
---|
1186 | return 0; //when no matching variable
|
---|
1187 | return 1; //when matching variable found
|
---|
1188 | }
|
---|
1189 | //------------------------------
|
---|
1190 | //endfunc scanSystemCnf
|
---|
1191 | //---------------------------------------------------------------------------
|
---|
1192 | //readSystemCnf will read standard settings from a SYSTEM.CNF file
|
---|
1193 | //------------------------------
|
---|
1194 | int readSystemCnf(void)
|
---|
1195 | {
|
---|
1196 | int dummy, var_cnt;
|
---|
1197 | unsigned char *RAM_p, *CNF_p, *name, *value;
|
---|
1198 |
|
---|
1199 | BootDiscType = 0;
|
---|
1200 | SystemCnf_BOOT[0] = '\0';
|
---|
1201 | SystemCnf_BOOT2[0] = '\0';
|
---|
1202 | SystemCnf_VER[0] = '\0';
|
---|
1203 | SystemCnf_VMODE[0] = '\0';
|
---|
1204 |
|
---|
1205 | if( (RAM_p = preloadCNF("cdrom0:\\SYSTEM.CNF;1")) != NULL){
|
---|
1206 | CNF_p = RAM_p;
|
---|
1207 | for(var_cnt = 0; get_CNF_string(&CNF_p, &name, &value); var_cnt++)
|
---|
1208 | dummy = scanSystemCnf(name, value);
|
---|
1209 | free(RAM_p);
|
---|
1210 | }
|
---|
1211 |
|
---|
1212 | if(SystemCnf_BOOT2[0]) BootDiscType = 2;
|
---|
1213 | else if(SystemCnf_BOOT[0]) BootDiscType = 1;
|
---|
1214 |
|
---|
1215 | if(!SystemCnf_BOOT[0]) strcpy(SystemCnf_BOOT, "???");
|
---|
1216 | if(!SystemCnf_VER[0]) strcpy(SystemCnf_VER, "???");
|
---|
1217 |
|
---|
1218 | if(RAM_p == NULL){ //if SYSTEM.CNF was not found test for PS1 special cases
|
---|
1219 | if(exists("cdrom0:\\PSXMYST\\MYST.CCS;1")){
|
---|
1220 | strcpy(SystemCnf_BOOT, "SLPS_000.24");
|
---|
1221 | BootDiscType = 1;
|
---|
1222 | }else if(exists("cdrom0:\\CDROM\\LASTPHOT\\ALL_C.NBN;1")){
|
---|
1223 | strcpy(SystemCnf_BOOT, "SLPS_000.65");
|
---|
1224 | BootDiscType = 1;
|
---|
1225 | }else if(exists("cdrom0:\\PSX.EXE;1")){
|
---|
1226 | BootDiscType = 1;
|
---|
1227 | }
|
---|
1228 | }
|
---|
1229 |
|
---|
1230 | return BootDiscType; //0==none, 1==PS1, 2==PS2
|
---|
1231 | }
|
---|
1232 | //------------------------------
|
---|
1233 | //endfunc readSystemCnf
|
---|
1234 | //---------------------------------------------------------------------------
|
---|
1235 | void ShowFont(void)
|
---|
1236 | {
|
---|
1237 | int test_type=0;
|
---|
1238 | int test_types=2; //Patch test_types for number of test loops
|
---|
1239 | int i, j, event, post_event=0;
|
---|
1240 | char Hex[18] = "0123456789ABCDEF";
|
---|
1241 | int ch_x_stp = 1+FONT_WIDTH+1+LINE_THICKNESS;
|
---|
1242 | int ch_y_stp = 2+FONT_HEIGHT+1+LINE_THICKNESS;
|
---|
1243 | int mat_w = LINE_THICKNESS+17*ch_x_stp;
|
---|
1244 | int mat_h = LINE_THICKNESS+17*ch_y_stp;
|
---|
1245 | int mat_x = (((SCREEN_WIDTH-mat_w)/2) & -2);
|
---|
1246 | int mat_y = (((SCREEN_HEIGHT-mat_h)/2) & -2);
|
---|
1247 | int ch_x = mat_x+LINE_THICKNESS+1;
|
---|
1248 | // int ch_y = mat_y+LINE_THICKNESS+2;
|
---|
1249 | int px, ly, cy;
|
---|
1250 | u64 col_0=setting->color[0], col_1=setting->color[1], col_3=setting->color[3];
|
---|
1251 |
|
---|
1252 | //The next line is a patch to save font, if/when needed (needs patch in draw.c too)
|
---|
1253 | // WriteFont_C("mc0:/SYS-CONF/font_uLE.c");
|
---|
1254 |
|
---|
1255 | event = 1; //event = initial entry
|
---|
1256 | //----- Start of event loop -----
|
---|
1257 | while(1) {
|
---|
1258 | //Display section
|
---|
1259 | if(event||post_event) { //NB: We need to update two frame buffers per event
|
---|
1260 | drawOpSprite(col_0, mat_x, mat_y, mat_x+mat_w-1, mat_y+mat_h-1);
|
---|
1261 | //Here the background rectangle has been prepared
|
---|
1262 | /* //Start of commented out section //Move this line as needed for tests
|
---|
1263 | //Start of gsKit test section
|
---|
1264 | if(test_type > 1) goto done_test;
|
---|
1265 | gsKit_prim_point(gsGlobal, mat_x+16, mat_y+16, 1, col_3);
|
---|
1266 | gsKit_prim_point(gsGlobal, mat_x+33, mat_y+16, 1, col_3);
|
---|
1267 | gsKit_prim_point(gsGlobal, mat_x+33, mat_y+33, 1, col_3);
|
---|
1268 | gsKit_prim_point(gsGlobal, mat_x+16, mat_y+33, 1, col_3);
|
---|
1269 | gsKit_prim_line(gsGlobal, mat_x+48, mat_y+48, mat_x+65, mat_y+48, 1, col_3);
|
---|
1270 | gsKit_prim_line(gsGlobal, mat_x+65, mat_y+48, mat_x+65, mat_y+65, 1, col_3);
|
---|
1271 | gsKit_prim_line(gsGlobal, mat_x+65, mat_y+65, mat_x+48, mat_y+65, 1, col_3);
|
---|
1272 | gsKit_prim_line(gsGlobal, mat_x+48, mat_y+65, mat_x+48, mat_y+48, 1, col_3);
|
---|
1273 | gsKit_prim_sprite(gsGlobal, mat_x+80, mat_y+80, mat_x+97, mat_y+81, 1, col_3);
|
---|
1274 | gsKit_prim_sprite(gsGlobal, mat_x+97, mat_y+80, mat_x+96, mat_y+97, 1, col_3);
|
---|
1275 | gsKit_prim_sprite(gsGlobal, mat_x+97, mat_y+97, mat_x+80, mat_y+96, 1, col_3);
|
---|
1276 | gsKit_prim_sprite(gsGlobal, mat_x+80, mat_y+97, mat_x+81, mat_y+80, 1, col_3);
|
---|
1277 | gsKit_prim_line(gsGlobal, mat_x+80, mat_y+16, mat_x+81, mat_y+16, 1, col_3);
|
---|
1278 | gsKit_prim_line(gsGlobal, mat_x+97, mat_y+16, mat_x+97, mat_y+17, 1, col_3);
|
---|
1279 | gsKit_prim_line(gsGlobal, mat_x+97, mat_y+33, mat_x+96, mat_y+33, 1, col_3);
|
---|
1280 | gsKit_prim_line(gsGlobal, mat_x+80, mat_y+33, mat_x+80, mat_y+32, 1, col_3);
|
---|
1281 | gsKit_prim_sprite(gsGlobal, mat_x+16, mat_y+80, mat_x+17, mat_y+81, 1, col_3);
|
---|
1282 | gsKit_prim_sprite(gsGlobal, mat_x+33, mat_y+80, mat_x+32, mat_y+81, 1, col_3);
|
---|
1283 | gsKit_prim_sprite(gsGlobal, mat_x+33, mat_y+97, mat_x+32, mat_y+96, 1, col_3);
|
---|
1284 | gsKit_prim_sprite(gsGlobal, mat_x+16, mat_y+97, mat_x+17, mat_y+96, 1, col_3);
|
---|
1285 | goto end_display;
|
---|
1286 | done_test:
|
---|
1287 | //End of gsKit test section
|
---|
1288 | */ //End of commented out section //Move this line as needed for tests
|
---|
1289 | //Start of font display section
|
---|
1290 | //Now we start to draw all vertical frame lines
|
---|
1291 | px=mat_x;
|
---|
1292 | drawOpSprite(col_1, px, mat_y, px+LINE_THICKNESS-1, mat_y+mat_h-1);
|
---|
1293 | for(j=0; j<17; j++) { //for each font column, plus the row_index column
|
---|
1294 | px += ch_x_stp;
|
---|
1295 | drawOpSprite(col_1, px, mat_y, px+LINE_THICKNESS-1, mat_y+mat_h-1);
|
---|
1296 | } //ends for each font column, plus the row_index column
|
---|
1297 | //Here all the vertical frame lines have been drawn
|
---|
1298 | //Next we draw the top horizontal line
|
---|
1299 | drawOpSprite(col_1, mat_x, mat_y, mat_x+mat_w-1, mat_y+LINE_THICKNESS-1);
|
---|
1300 | cy = mat_y+LINE_THICKNESS+2;
|
---|
1301 | ly = mat_y;
|
---|
1302 | for(i=0; i<17; i++) { //for each font row
|
---|
1303 | px=ch_x;
|
---|
1304 | if(!i) { //if top row (which holds the column indexes)
|
---|
1305 | drawChar('\\', px, cy, col_3); //Display '\' at index crosspoint
|
---|
1306 | } else { //else a real font row
|
---|
1307 | drawChar(Hex[i-1], px, cy, col_3); //Display row index
|
---|
1308 | }
|
---|
1309 | for(j=0; j<16; j++) { //for each font column
|
---|
1310 | px += ch_x_stp;
|
---|
1311 | if(!i) { //if top row (which holds the column indexes)
|
---|
1312 | drawChar(Hex[j], px, cy, col_3); //Display Column index
|
---|
1313 | } else {
|
---|
1314 | drawChar((i-1)*16+j, px, cy, col_3); //Display font character
|
---|
1315 | }
|
---|
1316 | } //ends for each font column
|
---|
1317 | ly += ch_y_stp;
|
---|
1318 | drawOpSprite(col_1, mat_x, ly, mat_x+mat_w-1, ly+LINE_THICKNESS-1);
|
---|
1319 | cy += ch_y_stp;
|
---|
1320 | } //ends for each font row
|
---|
1321 | //End of font display section
|
---|
1322 | } //ends if(event||post_event)
|
---|
1323 | //end_display:
|
---|
1324 | drawScr();
|
---|
1325 | post_event = event;
|
---|
1326 | event = 0;
|
---|
1327 |
|
---|
1328 | //Pad response section
|
---|
1329 | waitAnyPadReady();
|
---|
1330 | if(readpad() && new_pad){
|
---|
1331 | event |= 2;
|
---|
1332 | if((++test_type) < test_types){
|
---|
1333 | mat_y++;
|
---|
1334 | continue;
|
---|
1335 | }
|
---|
1336 | if (setting->GUI_skin[0]) {
|
---|
1337 | GUI_active = 1;
|
---|
1338 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1339 | }
|
---|
1340 | break;
|
---|
1341 | }
|
---|
1342 | } //ends while
|
---|
1343 | //----- End of event loop -----
|
---|
1344 | }
|
---|
1345 | //------------------------------
|
---|
1346 | //endfunc ShowFont
|
---|
1347 | //---------------------------------------------------------------------------
|
---|
1348 | void triggerPowerOff(void)
|
---|
1349 | {
|
---|
1350 | char filepath[MAX_PATH] = "xyz:/imaginary/hypothetical/doesn't.exist";
|
---|
1351 | FILE *File;
|
---|
1352 |
|
---|
1353 | File = fopen( filepath, "r" );
|
---|
1354 | // sprintf(mainMsg, "%s => %08X.", filepath, File);
|
---|
1355 | // drawMsg(mainMsg);
|
---|
1356 | if( File != NULL ) {
|
---|
1357 | fclose( File );
|
---|
1358 | } // end if( File != NULL )
|
---|
1359 | }
|
---|
1360 | //------------------------------
|
---|
1361 | //endfunc triggerPowerOff
|
---|
1362 | //---------------------------------------------------------------------------
|
---|
1363 | void Validate_CNF_Path(void)
|
---|
1364 | {
|
---|
1365 | char cnf_path[MAX_PATH];
|
---|
1366 |
|
---|
1367 | if(setting->CNF_Path[0] != '\0') {
|
---|
1368 | if(genFixPath(setting->CNF_Path, cnf_path) >= 0)
|
---|
1369 | strcpy(LaunchElfDir, setting->CNF_Path);
|
---|
1370 | }
|
---|
1371 | }
|
---|
1372 | //------------------------------
|
---|
1373 | //endfunc Validate_CNF_Path
|
---|
1374 | //---------------------------------------------------------------------------
|
---|
1375 | void Set_CNF_Path(void)
|
---|
1376 | {
|
---|
1377 | char *tmp;
|
---|
1378 |
|
---|
1379 | getFilePath(setting->CNF_Path, CNF_PATH_CNF);
|
---|
1380 | if((tmp = strrchr(setting->CNF_Path, '/')))
|
---|
1381 | tmp[1] = '\0';
|
---|
1382 | Validate_CNF_Path();
|
---|
1383 |
|
---|
1384 | if(!strcmp(setting->CNF_Path, LaunchElfDir))
|
---|
1385 | sprintf(mainMsg, "%s ", LNG(Valid));
|
---|
1386 | else
|
---|
1387 | sprintf(mainMsg, "%s ", LNG(Bogus));
|
---|
1388 | sprintf(mainMsg+6, "%s = \"%s\"", LNG(CNF_Path), setting->CNF_Path);
|
---|
1389 |
|
---|
1390 | }
|
---|
1391 | //------------------------------
|
---|
1392 | //endfunc Set_CNF_Path
|
---|
1393 | //---------------------------------------------------------------------------
|
---|
1394 | //Reload CNF, possibly after a path change
|
---|
1395 | int reloadConfig()
|
---|
1396 | {
|
---|
1397 | char tmp[MAX_PATH];
|
---|
1398 | int CNF_error = -1;
|
---|
1399 |
|
---|
1400 | if (numCNF == 0)
|
---|
1401 | strcpy(CNF, "LAUNCHELF.CNF");
|
---|
1402 | else
|
---|
1403 | sprintf(CNF, "LAUNCHELF%i.CNF", numCNF);
|
---|
1404 |
|
---|
1405 | CNF_error = loadConfig(mainMsg, CNF);
|
---|
1406 | Validate_CNF_Path();
|
---|
1407 | updateScreenMode(0);
|
---|
1408 | if (setting->GUI_skin[0]) GUI_active = 1;
|
---|
1409 | else GUI_active= 0;
|
---|
1410 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1411 |
|
---|
1412 | if(CNF_error<0)
|
---|
1413 | strcpy(tmp, mainMsg+strlen(LNG(Failed_To_Load)));
|
---|
1414 | else
|
---|
1415 | strcpy(tmp, mainMsg+strlen(LNG(Loaded_Config)));
|
---|
1416 |
|
---|
1417 | Load_External_Language();
|
---|
1418 | loadFont(setting->font_file);
|
---|
1419 |
|
---|
1420 | if(CNF_error<0)
|
---|
1421 | sprintf(mainMsg, "%s%s", LNG(Failed_To_Load), tmp);
|
---|
1422 | else
|
---|
1423 | sprintf(mainMsg, "%s%s", LNG(Loaded_Config), tmp);
|
---|
1424 |
|
---|
1425 | timeout = (setting->timeout+1)*1000;
|
---|
1426 | timeout_start = Timer();
|
---|
1427 | if(setting->discControl)
|
---|
1428 | loadCdModules();
|
---|
1429 |
|
---|
1430 | return CNF_error;
|
---|
1431 | }
|
---|
1432 | //------------------------------
|
---|
1433 | //endfunc reloadConfig
|
---|
1434 | //---------------------------------------------------------------------------
|
---|
1435 | // Config Cycle Left (--) by EP
|
---|
1436 | void decConfig()
|
---|
1437 | {
|
---|
1438 | if (numCNF > 0)
|
---|
1439 | numCNF--;
|
---|
1440 | else
|
---|
1441 | numCNF = maxCNF-1;
|
---|
1442 |
|
---|
1443 | reloadConfig();
|
---|
1444 | }
|
---|
1445 | //------------------------------
|
---|
1446 | //endfunc decConfig
|
---|
1447 | //---------------------------------------------------------------------------
|
---|
1448 | // Config Cycle Right (++) by EP
|
---|
1449 | void incConfig()
|
---|
1450 | {
|
---|
1451 | if (numCNF < maxCNF-1)
|
---|
1452 | numCNF++;
|
---|
1453 | else
|
---|
1454 | numCNF = 0;
|
---|
1455 |
|
---|
1456 | reloadConfig();
|
---|
1457 | }
|
---|
1458 | //------------------------------
|
---|
1459 | //endfunc incConfig
|
---|
1460 | //---------------------------------------------------------------------------
|
---|
1461 | //exists. Tests if a file exists or not
|
---|
1462 | //------------------------------
|
---|
1463 | int exists(char *path)
|
---|
1464 | {
|
---|
1465 | int fd;
|
---|
1466 |
|
---|
1467 | fd = genOpen(path, O_RDONLY);
|
---|
1468 | if( fd < 0 )
|
---|
1469 | return 0;
|
---|
1470 | genClose(fd);
|
---|
1471 | return 1;
|
---|
1472 | }
|
---|
1473 | //------------------------------
|
---|
1474 | //endfunc exists
|
---|
1475 | //---------------------------------------------------------------------------
|
---|
1476 | //uLE_related. Tests if an uLE_related file exists or not
|
---|
1477 | // Returns:
|
---|
1478 | // 1 == uLE related path with file present
|
---|
1479 | // 0 == uLE related path with file missing
|
---|
1480 | // -1 == Not uLE related path
|
---|
1481 | //------------------------------
|
---|
1482 | int uLE_related(char *pathout, char *pathin)
|
---|
1483 | {
|
---|
1484 | int ret;
|
---|
1485 |
|
---|
1486 | if(!strncmp(pathin, "uLE:/", 5)){
|
---|
1487 | sprintf(pathout, "%s%s", LaunchElfDir, pathin+5);
|
---|
1488 | if( exists(pathout) )
|
---|
1489 | return 1;
|
---|
1490 | sprintf(pathout, "%s%s", "mc0:/SYS-CONF/", pathin+5);
|
---|
1491 | if( !strncmp(LaunchElfDir, "mc1", 3) )
|
---|
1492 | pathout[2] = '1';
|
---|
1493 | if( exists(pathout) )
|
---|
1494 | return 1;
|
---|
1495 | pathout[2] ^= 1; //switch between mc0 and mc1
|
---|
1496 | if( exists(pathout) )
|
---|
1497 | return 1;
|
---|
1498 | ret = 0;
|
---|
1499 | } else
|
---|
1500 | ret = -1;
|
---|
1501 | strcpy(pathout, pathin);
|
---|
1502 | return ret;
|
---|
1503 | }
|
---|
1504 | //------------------------------
|
---|
1505 | //endfunc uLE_related
|
---|
1506 | //---------------------------------------------------------------------------
|
---|
1507 | //CleanUp releases uLE stuff preparatory to launching some other application
|
---|
1508 | //------------------------------
|
---|
1509 | void CleanUp(void)
|
---|
1510 | {
|
---|
1511 | clrScr(GS_SETREG_RGBA(0x00, 0x00, 0x00, 0));
|
---|
1512 | drawScr();
|
---|
1513 | clrScr(GS_SETREG_RGBA(0x00, 0x00, 0x00, 0));
|
---|
1514 | drawScr();
|
---|
1515 | free(setting);
|
---|
1516 | free(elisaFnt);
|
---|
1517 | free(External_Lang_Buffer);
|
---|
1518 | padPortClose(1,0);
|
---|
1519 | padPortClose(0,0);
|
---|
1520 | if(ps2kbd_opened) PS2KbdClose();
|
---|
1521 | TimerEnd();
|
---|
1522 | }
|
---|
1523 | //------------------------------
|
---|
1524 | //endfunc CleanUp
|
---|
1525 | //---------------------------------------------------------------------------
|
---|
1526 | // Run ELF. The generic ELF launcher.
|
---|
1527 | //------------------------------
|
---|
1528 | void RunElf(char *pathin)
|
---|
1529 | {
|
---|
1530 | char tmp[MAX_PATH];
|
---|
1531 | static char path[MAX_PATH];
|
---|
1532 | static char fullpath[MAX_PATH];
|
---|
1533 | static char party[40];
|
---|
1534 | char *pathSep;
|
---|
1535 | char *p;
|
---|
1536 | int x, t=0;
|
---|
1537 | char dvdpl_path[] = "mc0:/BREXEC-DVDPLAYER/dvdplayer.elf";
|
---|
1538 | int dvdpl_update;
|
---|
1539 |
|
---|
1540 | if(pathin[0]==0) return;
|
---|
1541 |
|
---|
1542 | if( !uLE_related(path, pathin) ) //1==uLE_rel 0==missing, -1==other dev
|
---|
1543 | return;
|
---|
1544 |
|
---|
1545 | Recurse_for_ESR: //Recurse here for PS2Disc command with ESR disc
|
---|
1546 |
|
---|
1547 | pathSep = strchr(path, '/');
|
---|
1548 |
|
---|
1549 | if(!strncmp(path, "mc", 2)){
|
---|
1550 | party[0] = 0;
|
---|
1551 | if(path[2]!=':')
|
---|
1552 | goto CheckELF_path;
|
---|
1553 | strcpy(fullpath, "mc0:");
|
---|
1554 | strcat(fullpath, path+3);
|
---|
1555 | if(checkELFheader(fullpath)>0)
|
---|
1556 | goto ELFchecked;
|
---|
1557 | fullpath[2]='1';
|
---|
1558 | goto CheckELF_fullpath;
|
---|
1559 |
|
---|
1560 | }else if(!strncmp(path, "vmc", 3)){
|
---|
1561 | x = path[3] - '0';
|
---|
1562 | if((x<0)||(x>1)||!vmcMounted[x])
|
---|
1563 | goto ELFnotFound;
|
---|
1564 | goto CheckELF_path;
|
---|
1565 | }else if(!strncmp(path, "hdd0:/", 6)){
|
---|
1566 | loadHddModules();
|
---|
1567 | if((t=checkELFheader(path))<=0)
|
---|
1568 | goto ELFnotFound;
|
---|
1569 | //coming here means the ELF is fine
|
---|
1570 | sprintf(party, "hdd0:%s", path+6);
|
---|
1571 | p = strchr(party, '/');
|
---|
1572 | sprintf(fullpath, "pfs0:%s", p);
|
---|
1573 | *p = 0;
|
---|
1574 | goto ELFchecked;
|
---|
1575 |
|
---|
1576 | }else if(!strncmp(path, "mass", 4)){
|
---|
1577 | loadUsbModules();
|
---|
1578 | if((t=checkELFheader(path))<=0)
|
---|
1579 | goto ELFnotFound;
|
---|
1580 | //coming here means the ELF is fine
|
---|
1581 | party[0] = 0;
|
---|
1582 |
|
---|
1583 | strcpy(fullpath, path);
|
---|
1584 | if(pathSep && (pathSep-path<7) && pathSep[-1]==':')
|
---|
1585 | strcpy(fullpath+(pathSep-path), pathSep+1);
|
---|
1586 | goto ELFchecked;
|
---|
1587 |
|
---|
1588 | }else if(!strncmp(path, "host:", 5)){
|
---|
1589 | initHOST();
|
---|
1590 | party[0] = 0;
|
---|
1591 | strcpy(fullpath, "host:");
|
---|
1592 | if(path[5] == '/')
|
---|
1593 | strcat(fullpath, path+6);
|
---|
1594 | else
|
---|
1595 | strcat(fullpath, path+5);
|
---|
1596 | makeHostPath(fullpath, fullpath);
|
---|
1597 | goto CheckELF_fullpath;
|
---|
1598 |
|
---|
1599 | }else if(!stricmp(path, setting->Misc_PS2Disc)){
|
---|
1600 | drawMsg(LNG(Reading_SYSTEMCNF));
|
---|
1601 | party[0]=0;
|
---|
1602 | readSystemCnf();
|
---|
1603 | if(BootDiscType==2){ //Boot a PS2 disc
|
---|
1604 | strcpy(fullpath, SystemCnf_BOOT2);
|
---|
1605 | goto CheckELF_fullpath;
|
---|
1606 | }
|
---|
1607 | if(BootDiscType==1){ //Boot a PS1 disc
|
---|
1608 | char *args[2] = {SystemCnf_BOOT, SystemCnf_VER};
|
---|
1609 | CleanUp();
|
---|
1610 | LoadExecPS2("rom0:PS1DRV", 2, args);
|
---|
1611 | sprintf(mainMsg, "PS1DRV %s", LNG(Failed));
|
---|
1612 | goto Done_PS2Disc;
|
---|
1613 | }
|
---|
1614 | if(uLE_cdDiscValid()){
|
---|
1615 | if(cdmode == CDVD_TYPE_DVDVIDEO){
|
---|
1616 | load_chkesr_module(); //prepare to check for ESR disc
|
---|
1617 | x = Check_ESR_Disc();
|
---|
1618 | printf("Check_ESR_Disc => %d\n", x);
|
---|
1619 | if(x > 0){ //ESR Disc, so launch ESR
|
---|
1620 | if(setting->LK_Flag[15] && setting->LK_Path[15][0])
|
---|
1621 | strcpy(path, setting->LK_Path[15]);
|
---|
1622 | else
|
---|
1623 | strcpy(path, default_ESR_path);
|
---|
1624 |
|
---|
1625 | goto Recurse_for_ESR;
|
---|
1626 | }
|
---|
1627 |
|
---|
1628 | //DVD Video Disc, so launch DVD player
|
---|
1629 | char arg0[20], arg1[20], arg2[20], arg3[40];
|
---|
1630 | char *args[4] = {arg0, arg1, arg2, arg3};
|
---|
1631 | char kelf_loader[40];
|
---|
1632 | char MG_region[10];
|
---|
1633 | int i, pos, tst, argc;
|
---|
1634 |
|
---|
1635 | if ((tst = SifLoadModule("rom0:ADDDRV", 0, NULL)) < 0)
|
---|
1636 | goto Fail_DVD_Video;
|
---|
1637 |
|
---|
1638 | strcpy(arg0, "-k rom1:EROMDRVA");
|
---|
1639 | strcpy(arg1, "-m erom0:UDFIO");
|
---|
1640 | strcpy(arg2, "-x erom0:DVDPLA");
|
---|
1641 | argc = 3;
|
---|
1642 | strcpy(kelf_loader, "moduleload2 rom1:UDNL rom1:DVDCNF");
|
---|
1643 |
|
---|
1644 | strcpy(MG_region, "ACEJMORU");
|
---|
1645 | pos = strlen(arg0)-1;
|
---|
1646 | for(i=0; i<9 ; i++){ //NB: MG_region[8] is a string terminator
|
---|
1647 | arg0[pos] = MG_region[i];
|
---|
1648 | tst = SifLoadModuleEncrypted(arg0+3, 0, NULL);
|
---|
1649 | if(tst >= 0)
|
---|
1650 | break;
|
---|
1651 | }
|
---|
1652 |
|
---|
1653 | pos = strlen(arg2);
|
---|
1654 | if(i == 8)
|
---|
1655 | strcpy(&arg2[pos-3], "ELF");
|
---|
1656 | else
|
---|
1657 | arg2[pos-1] = MG_region[i];
|
---|
1658 | //At this point all args are ready to use internal DVD player
|
---|
1659 |
|
---|
1660 | //We must check for an updated player on MC
|
---|
1661 | dvdpl_path[6] = ROMVER_data[4];
|
---|
1662 | dvdpl_update = 0;
|
---|
1663 | for(i=0; i<2; i++){
|
---|
1664 | dvdpl_path[2] = '0'+i;
|
---|
1665 | if(exists(dvdpl_path)){
|
---|
1666 | dvdpl_update = 1;
|
---|
1667 | break;
|
---|
1668 | }
|
---|
1669 | }
|
---|
1670 |
|
---|
1671 | if((tst < 0) && (dvdpl_update == 0))
|
---|
1672 | goto Fail_PS2Disc; //We must abort if no working kelf found
|
---|
1673 |
|
---|
1674 | if(dvdpl_update){ // Launch DVD player from memory card
|
---|
1675 | strcpy(arg0, "-m rom0:SIO2MAN");
|
---|
1676 | strcpy(arg1, "-m rom0:MCMAN");
|
---|
1677 | strcpy(arg2, "-m rom0:MCSERV");
|
---|
1678 | sprintf(arg3, "-x %s", dvdpl_path); // -x :elf is encrypted for mc
|
---|
1679 | argc = 4;
|
---|
1680 | strcpy(kelf_loader, "moduleload");
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 | CleanUp();
|
---|
1684 | LoadExecPS2(kelf_loader, argc, args);
|
---|
1685 |
|
---|
1686 | Fail_DVD_Video:
|
---|
1687 | sprintf(mainMsg, "DVD-Video %s", LNG(Failed));
|
---|
1688 | goto Done_PS2Disc;
|
---|
1689 | }
|
---|
1690 | if(cdmode == CDVD_TYPE_CDDA){
|
---|
1691 | //Fail_CDDA:
|
---|
1692 | sprintf(mainMsg, "CDDA %s", LNG(Failed));
|
---|
1693 | goto Done_PS2Disc;
|
---|
1694 | }
|
---|
1695 | }
|
---|
1696 | Fail_PS2Disc:
|
---|
1697 | sprintf(mainMsg, "%s => %s CDVD 0x%02X", LNG(PS2Disc), LNG(Failed), cdmode);
|
---|
1698 | Done_PS2Disc:
|
---|
1699 | x = x;
|
---|
1700 | }else if(!stricmp(path, setting->Misc_FileBrowser)){
|
---|
1701 | if (setting->GUI_skin[0]) {
|
---|
1702 | GUI_active = 0;
|
---|
1703 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1704 | }
|
---|
1705 | mainMsg[0] = 0;
|
---|
1706 | tmp[0] = 0;
|
---|
1707 | LastDir[0] = 0;
|
---|
1708 | getFilePath(tmp, FALSE);
|
---|
1709 | if(tmp[0])
|
---|
1710 | RunElf(tmp);
|
---|
1711 | return;
|
---|
1712 | }else if(!stricmp(path, setting->Misc_PS2Browser)){
|
---|
1713 | __asm__ __volatile__(
|
---|
1714 | " li $3, 0x04;"
|
---|
1715 | " syscall;"
|
---|
1716 | " nop;"
|
---|
1717 | );
|
---|
1718 | //There has been a major change in the code for calling PS2Browser
|
---|
1719 | //The method above is borrowed from PS2MP3. It's independent of ELF loader
|
---|
1720 | //The method below was used earlier, but causes reset with new ELF loader
|
---|
1721 | //party[0]=0;
|
---|
1722 | //strcpy(fullpath,"rom0:OSDSYS");
|
---|
1723 | }else if(!stricmp(path, setting->Misc_PS2Net)){
|
---|
1724 | mainMsg[0] = 0;
|
---|
1725 | loadNetModules();
|
---|
1726 | return;
|
---|
1727 | }else if(!stricmp(path, setting->Misc_PS2PowerOff)){
|
---|
1728 | mainMsg[0] = 0;
|
---|
1729 | drawMsg(LNG(Powering_Off_Console));
|
---|
1730 | setupPowerOff();
|
---|
1731 | //hddPowerOff(); //deprecated
|
---|
1732 | poweroffShutdown();
|
---|
1733 | poweroff_delay = 250; //trigger delay for those without net adapter
|
---|
1734 | poweroff_start = Timer();
|
---|
1735 | return;
|
---|
1736 | }else if(!stricmp(path, setting->Misc_HddManager)){
|
---|
1737 | if (setting->GUI_skin[0]) {
|
---|
1738 | GUI_active = 0;
|
---|
1739 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1740 | }
|
---|
1741 | hddManager();
|
---|
1742 | return;
|
---|
1743 | }else if(!stricmp(path, setting->Misc_TextEditor)){
|
---|
1744 | if (setting->GUI_skin[0]) {
|
---|
1745 | GUI_active = 0;
|
---|
1746 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1747 | }
|
---|
1748 | TextEditor();
|
---|
1749 | return;
|
---|
1750 | }else if(!stricmp(path, setting->Misc_JpgViewer)){
|
---|
1751 | if (setting->GUI_skin[0]) {
|
---|
1752 | GUI_active = 0;
|
---|
1753 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1754 | }
|
---|
1755 | JpgViewer();
|
---|
1756 | return;
|
---|
1757 | }else if(!stricmp(path, setting->Misc_Configure)){
|
---|
1758 | if (setting->GUI_skin[0]) {
|
---|
1759 | GUI_active = 0;
|
---|
1760 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1761 | Load_External_Language();
|
---|
1762 | loadFont(setting->font_file);
|
---|
1763 | }
|
---|
1764 | config(mainMsg, CNF);
|
---|
1765 | return;
|
---|
1766 | }else if(!stricmp(path, setting->Misc_Load_CNFprev)){
|
---|
1767 | decConfig();
|
---|
1768 | return;
|
---|
1769 | }else if(!stricmp(path, setting->Misc_Load_CNFnext)){
|
---|
1770 | incConfig();
|
---|
1771 | return;
|
---|
1772 | }else if(!stricmp(path, setting->Misc_Set_CNF_Path)){
|
---|
1773 | Set_CNF_Path();
|
---|
1774 | return;
|
---|
1775 | }else if(!stricmp(path, setting->Misc_Load_CNF)){
|
---|
1776 | reloadConfig();
|
---|
1777 | return;
|
---|
1778 | //Next clause is for an optional font test routine
|
---|
1779 | }else if(!stricmp(path, setting->Misc_ShowFont)){
|
---|
1780 | ShowFont();
|
---|
1781 | return;
|
---|
1782 | }else if(!stricmp(path, setting->Misc_Debug_Info)){
|
---|
1783 | if (setting->GUI_skin[0]) {
|
---|
1784 | GUI_active = 0;
|
---|
1785 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1786 | }
|
---|
1787 | ShowDebugInfo();
|
---|
1788 | return;
|
---|
1789 | }else if(!stricmp(path, setting->Misc_About_uLE)){
|
---|
1790 | if (setting->GUI_skin[0]) {
|
---|
1791 | GUI_active = 0;
|
---|
1792 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
1793 | }
|
---|
1794 | Show_About_uLE();
|
---|
1795 | return;
|
---|
1796 | }else if(!strncmp(path, "cdfs", 4)){
|
---|
1797 | loadCdModules();
|
---|
1798 | CDVD_FlushCache();
|
---|
1799 | CDVD_DiskReady(0);
|
---|
1800 | party[0] = 0;
|
---|
1801 | goto CheckELF_path;
|
---|
1802 | }else if(!strncmp(path, "rom", 3)){
|
---|
1803 | party[0] = 0;
|
---|
1804 | CheckELF_path:
|
---|
1805 | strcpy(fullpath, path);
|
---|
1806 | CheckELF_fullpath:
|
---|
1807 | if((t=checkELFheader(fullpath))<=0)
|
---|
1808 | goto ELFnotFound;
|
---|
1809 | ELFchecked:
|
---|
1810 | CleanUp();
|
---|
1811 | RunLoaderElf(fullpath, party);
|
---|
1812 | }else{ //Invalid path
|
---|
1813 | t = 0;
|
---|
1814 | ELFnotFound:
|
---|
1815 | if(t==0)
|
---|
1816 | sprintf(mainMsg, "%s %s.", fullpath, LNG(is_Not_Found));
|
---|
1817 | else
|
---|
1818 | sprintf(mainMsg, "%s: %s.", LNG(This_file_isnt_an_ELF), fullpath);
|
---|
1819 | return;
|
---|
1820 | }
|
---|
1821 | }
|
---|
1822 | //------------------------------
|
---|
1823 | //endfunc RunElf
|
---|
1824 | //---------------------------------------------------------------------------
|
---|
1825 | // reboot IOP (original source by Hermes in BOOT.c - cogswaploader)
|
---|
1826 | // dlanor: but changed now, as the original was badly bugged
|
---|
1827 | void Reset()
|
---|
1828 | {
|
---|
1829 | SifIopReset("rom0:UDNL rom0:EELOADCNF",0);
|
---|
1830 | while(!SifIopSync());
|
---|
1831 | fioExit();
|
---|
1832 | SifExitIopHeap();
|
---|
1833 | SifLoadFileExit();
|
---|
1834 | SifExitRpc();
|
---|
1835 | SifExitCmd();
|
---|
1836 |
|
---|
1837 | SifInitRpc(0);
|
---|
1838 | FlushCache(0);
|
---|
1839 | FlushCache(2);
|
---|
1840 |
|
---|
1841 | have_cdvd = 0;
|
---|
1842 | have_usbd = 0;
|
---|
1843 | have_usb_mass = 0;
|
---|
1844 | have_ps2smap = 0;
|
---|
1845 | have_ps2host = 0;
|
---|
1846 | have_ps2ftpd = 0;
|
---|
1847 | have_ps2kbd = 0;
|
---|
1848 | have_NetModules = 0;
|
---|
1849 | have_HDD_modules = 0;
|
---|
1850 | have_sbv_patches = 0;
|
---|
1851 |
|
---|
1852 | CheckModules();
|
---|
1853 | loadBasicModules();
|
---|
1854 | mcReset();
|
---|
1855 | mcInit(MC_TYPE_MC);
|
---|
1856 | // padReset();
|
---|
1857 | // setupPad();
|
---|
1858 | }
|
---|
1859 | //------------------------------
|
---|
1860 | //endfunc Reset
|
---|
1861 | //---------------------------------------------------------------------------
|
---|
1862 | int uLE_detect_TV_mode()
|
---|
1863 | {
|
---|
1864 | int ROMVER_fd;
|
---|
1865 |
|
---|
1866 | ROMVER_fd = genOpen("rom0:ROMVER", O_RDONLY);
|
---|
1867 | if(ROMVER_fd < 0)
|
---|
1868 | return TV_mode_NTSC; //NTSC is default mode for unidentified console
|
---|
1869 | genRead(ROMVER_fd, ROMVER_data, 16);
|
---|
1870 | genClose(ROMVER_fd);
|
---|
1871 | ROMVER_data[16] = 0;
|
---|
1872 |
|
---|
1873 | if(ROMVER_data[4] == 'E')
|
---|
1874 | return TV_mode_PAL; //PAL mode is identified by 'E' for Europe
|
---|
1875 | return TV_mode_NTSC; //All other cases need NTSC
|
---|
1876 | }
|
---|
1877 | //------------------------------
|
---|
1878 | //endfunc uLE_detect_TV_mode
|
---|
1879 | //---------------------------------------------------------------------------
|
---|
1880 | int main(int argc, char *argv[])
|
---|
1881 | {
|
---|
1882 | char *p, CNF_pathname[MAX_PATH];
|
---|
1883 | int event, post_event=0;
|
---|
1884 | char RunPath[MAX_PATH];
|
---|
1885 | int RunELF_index, nElfs=0;
|
---|
1886 | int hdd_booted = 0;
|
---|
1887 | int host_or_hdd_booted = 0;
|
---|
1888 | int mass_booted = 0; //flags boot made with compatible mass drivers
|
---|
1889 | int mass_needed = 0; //flags need to load compatible mass drivers
|
---|
1890 | int mc_booted = 0;
|
---|
1891 | int cdvd_booted = 0;
|
---|
1892 | int host_booted = 0;
|
---|
1893 | int gs_vmode;
|
---|
1894 | int CNF_error = -1; //assume error until CNF correctly loaded
|
---|
1895 | int i;
|
---|
1896 |
|
---|
1897 | boot_argc = argc;
|
---|
1898 | for(i=0; (i<argc)&&(i<8); i++)
|
---|
1899 | boot_argv[i] = argv[i];
|
---|
1900 |
|
---|
1901 | SifInitRpc(0);
|
---|
1902 | CheckModules();
|
---|
1903 | loadBasicModules();
|
---|
1904 | mcInit(MC_TYPE_MC);
|
---|
1905 | genInit();
|
---|
1906 | Init_Default_Language();
|
---|
1907 |
|
---|
1908 | force_IOP = 0;
|
---|
1909 | LaunchElfDir[0] = 0;
|
---|
1910 | if ((argc > 0) && argv[0]){
|
---|
1911 | strcpy(LaunchElfDir, argv[0]);
|
---|
1912 | if (!strncmp(argv[0], "mass", 4)){
|
---|
1913 | if(!strncmp(argv[0], "mass0:\\", 7)){ //SwapMagic boot path for usb_mass
|
---|
1914 | //Transform the boot path to homebrew standards
|
---|
1915 | LaunchElfDir[4]=':';
|
---|
1916 | strcpy(&LaunchElfDir[5], &LaunchElfDir[7]);
|
---|
1917 | for(i=0; LaunchElfDir[i]!=0; i++){
|
---|
1918 | if(LaunchElfDir[i] == '\\')
|
---|
1919 | LaunchElfDir[i] = '/';
|
---|
1920 | }
|
---|
1921 | force_IOP = 1; //Note incompatible drivers present (as yet ignored)
|
---|
1922 | mass_needed = 1; //Note need to load compatible mass: drivers
|
---|
1923 | } else { //else we booted with normal homebrew mass: drivers
|
---|
1924 | mass_booted = 1; //Note presence of compatible mass: drivers
|
---|
1925 | }
|
---|
1926 | }
|
---|
1927 | else if (!strncmp(argv[0], "mc", 2))
|
---|
1928 | mc_booted = 1;
|
---|
1929 | else if (!strncmp(argv[0], "cd", 2))
|
---|
1930 | cdvd_booted = 1;
|
---|
1931 | else if ((!strncmp(argv[0], "hdd", 3)) || (!strncmp(argv[0], "pfs", 3)))
|
---|
1932 | hdd_booted = 1; //Modify this section later to cover Dev2 needs !!!
|
---|
1933 | }
|
---|
1934 | strcpy(boot_path, LaunchElfDir);
|
---|
1935 |
|
---|
1936 | if(!strncmp(LaunchElfDir, "host",4)) {
|
---|
1937 | host_or_hdd_booted = 1;
|
---|
1938 | if (have_fakehost)
|
---|
1939 | hdd_booted = 1;
|
---|
1940 | else
|
---|
1941 | host_booted = 1;
|
---|
1942 | }
|
---|
1943 |
|
---|
1944 | if (host_booted) //Fix untestable modules for host booting
|
---|
1945 | { have_ps2smap = 1;
|
---|
1946 | have_ps2host = 1;
|
---|
1947 | }
|
---|
1948 |
|
---|
1949 | if (mass_booted) //Fix untestable module for USB_mass booting
|
---|
1950 | { have_usbd = 1;
|
---|
1951 | have_usb_mass = 1;
|
---|
1952 | }
|
---|
1953 |
|
---|
1954 | if ( ((p=strrchr(LaunchElfDir, '/'))==NULL)
|
---|
1955 | &&((p=strrchr(LaunchElfDir, '\\'))==NULL)
|
---|
1956 | ) p=strrchr(LaunchElfDir, ':');
|
---|
1957 | if (p!=NULL)
|
---|
1958 | *(p+1)=0;
|
---|
1959 | //The above cuts away the ELF filename from LaunchElfDir, leaving a pure path
|
---|
1960 |
|
---|
1961 | if(hdd_booted && !strncmp(LaunchElfDir, "hdd", 3)){;
|
---|
1962 | //Patch DMS4 Dev2 booting here, when we learn more about how it works
|
---|
1963 | //Trying to mount that partition for loading CNF simply crashes.
|
---|
1964 | //We may need a new IOP reset method for this.
|
---|
1965 | }
|
---|
1966 |
|
---|
1967 | LastDir[0] = 0;
|
---|
1968 |
|
---|
1969 | if(uLE_detect_TV_mode() == TV_mode_PAL) { //Test console TV mode
|
---|
1970 | SCREEN_X = 652;
|
---|
1971 | SCREEN_Y = 72;
|
---|
1972 | } else {
|
---|
1973 | SCREEN_X = 632;
|
---|
1974 | SCREEN_Y = 50;
|
---|
1975 | }
|
---|
1976 |
|
---|
1977 | //RA NB: loadConfig needs SCREEN_X and SCREEN_Y to be defaults matching TV mode
|
---|
1978 | CNF_error = loadConfig(mainMsg, strcpy(CNF, "LAUNCHELF.CNF"));
|
---|
1979 | if(CNF_error<0)
|
---|
1980 | strcpy(CNF_pathname, mainMsg+strlen(LNG(Failed_To_Load)));
|
---|
1981 | else
|
---|
1982 | strcpy(CNF_pathname, mainMsg+strlen(LNG(Loaded_Config)));
|
---|
1983 |
|
---|
1984 | TV_mode = setting->TV_mode;
|
---|
1985 | if((TV_mode!=TV_mode_NTSC)&&(TV_mode!=TV_mode_PAL)){ //If no forced request
|
---|
1986 | TV_mode = uLE_detect_TV_mode(); //Let console region decide TV_mode
|
---|
1987 | }
|
---|
1988 |
|
---|
1989 | if(TV_mode == TV_mode_PAL){ //Use PAL mode if chosen (forced or auto)
|
---|
1990 | gs_vmode = GS_MODE_PAL;
|
---|
1991 | SCREEN_WIDTH = 640;
|
---|
1992 | SCREEN_HEIGHT = 512;
|
---|
1993 | SCREEN_X = 652;
|
---|
1994 | SCREEN_Y = 72;
|
---|
1995 | Menu_end_y = Menu_start_y + 26*FONT_HEIGHT;
|
---|
1996 | }else{ //else use NTSC mode (forced or auto)
|
---|
1997 | gs_vmode = GS_MODE_NTSC;
|
---|
1998 | SCREEN_WIDTH = 640;
|
---|
1999 | SCREEN_HEIGHT = 448;
|
---|
2000 | SCREEN_X = 632;
|
---|
2001 | SCREEN_Y = 50;
|
---|
2002 | Menu_end_y = Menu_start_y + 22*FONT_HEIGHT;
|
---|
2003 | } /* end else */
|
---|
2004 | Frame_end_y = Menu_end_y + 4;
|
---|
2005 | Menu_tooltip_y = Frame_end_y + LINE_THICKNESS + 2;
|
---|
2006 |
|
---|
2007 | maxCNF = setting->numCNF;
|
---|
2008 | swapKeys = setting->swapKeys;
|
---|
2009 | if(setting->resetIOP)
|
---|
2010 | { Reset();
|
---|
2011 | if(!strncmp(LaunchElfDir, "mass", 4))
|
---|
2012 | { initsbv_patches();
|
---|
2013 | loadUsbModules();
|
---|
2014 | }
|
---|
2015 | else if(!strncmp(LaunchElfDir, "host:", 5))
|
---|
2016 | { getIpConfig();
|
---|
2017 | initsbv_patches();
|
---|
2018 | initHOST();
|
---|
2019 | }
|
---|
2020 | }
|
---|
2021 | //Here IOP reset (if done) has been completed, so it's time to load and init drivers
|
---|
2022 | getIpConfig();
|
---|
2023 | initsbv_patches();
|
---|
2024 |
|
---|
2025 | if(setting->discControl)
|
---|
2026 | loadCdModules();
|
---|
2027 |
|
---|
2028 | TimerInit();
|
---|
2029 | WaitTime=Timer();
|
---|
2030 | setupPad(); //Comment out this line when using early setupPad above
|
---|
2031 | startKbd();
|
---|
2032 | TimerInit();
|
---|
2033 | WaitTime=Timer();
|
---|
2034 |
|
---|
2035 | init_delay = setting->Init_Delay*1000;
|
---|
2036 | init_delay_start = Timer();
|
---|
2037 | timeout = (setting->timeout+1)*1000;
|
---|
2038 | timeout_start = Timer();
|
---|
2039 |
|
---|
2040 | //Last chance to look at bootup screen, so allow braking here
|
---|
2041 | /*
|
---|
2042 | if(readpad() && (new_pad && PAD_UP))
|
---|
2043 | { scr_printf("________ Boot paused. Press 'Circle' to continue.\n");
|
---|
2044 | while(1)
|
---|
2045 | { if(new_pad & PAD_CIRCLE)
|
---|
2046 | break;
|
---|
2047 | while(!readpad());
|
---|
2048 | }
|
---|
2049 | }
|
---|
2050 | */
|
---|
2051 | setupGS(gs_vmode);
|
---|
2052 | updateScreenMode(0); //resolves screen position issue with newer gsKit
|
---|
2053 | gsKit_clear(gsGlobal, GS_SETREG_RGBAQ(0x00,0x00,0x00,0x00,0x00));
|
---|
2054 |
|
---|
2055 | loadFont(""); //Some font must be loaded before loading some device modules
|
---|
2056 | Load_External_Language();
|
---|
2057 | loadFont(setting->font_file);
|
---|
2058 | if (setting->GUI_skin[0]) {GUI_active = 1;}
|
---|
2059 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
2060 |
|
---|
2061 | gsKit_clear(gsGlobal, GS_SETREG_RGBAQ(0x00,0x00,0x00,0x00,0x00));
|
---|
2062 |
|
---|
2063 | if(CNF_error<0)
|
---|
2064 | sprintf(mainMsg, "%s%s", LNG(Failed_To_Load), CNF_pathname);
|
---|
2065 | else
|
---|
2066 | sprintf(mainMsg, "%s%s", LNG(Loaded_Config), CNF_pathname);
|
---|
2067 |
|
---|
2068 | //Here nearly everything is ready for the main menu event loop
|
---|
2069 | //But before we start that, we need to validate CNF_Path
|
---|
2070 | Validate_CNF_Path();
|
---|
2071 |
|
---|
2072 | RunPath[0] = 0; //Nothing to run yet
|
---|
2073 | cdmode = -1; //flag unchecked cdmode state
|
---|
2074 | event = 1; //event = initial entry
|
---|
2075 | //----- Start of main menu event loop -----
|
---|
2076 | while(1){
|
---|
2077 | int DiscType_ix;
|
---|
2078 |
|
---|
2079 | //Background event section
|
---|
2080 | if(!setting->discControl)
|
---|
2081 | goto done_discControl;
|
---|
2082 |
|
---|
2083 | uLE_cdStop(); //Test disc state and if needed stop disc (updates cdmode)
|
---|
2084 | if(cdmode == old_cdmode) //if disc detection did not change state
|
---|
2085 | goto done_discControl;
|
---|
2086 |
|
---|
2087 | event |= 4; //event |= disc change detection
|
---|
2088 | if(cdmode<=0)
|
---|
2089 | sprintf(mainMsg, "%s ", LNG(No_Disc));
|
---|
2090 | else if(cdmode>=1 && cdmode<=4)
|
---|
2091 | sprintf(mainMsg, "%s == ", LNG(Detecting_Disc));
|
---|
2092 | else //if(cdmode>=5)
|
---|
2093 | sprintf(mainMsg, "%s == ", LNG(Stop_Disc));
|
---|
2094 |
|
---|
2095 | DiscType_ix = 0;
|
---|
2096 | for(i=0; DiscTypes[i].name[0]; i++)
|
---|
2097 | if(DiscTypes[i].type == uLE_cdmode)
|
---|
2098 | DiscType_ix = i;
|
---|
2099 |
|
---|
2100 | sprintf(mainMsg+strlen(mainMsg), DiscTypes[DiscType_ix].name);
|
---|
2101 | //Comment out the debug output below when not needed
|
---|
2102 | /*
|
---|
2103 | sprintf(mainMsg+strlen(mainMsg),
|
---|
2104 | " cdmode==%d uLE_cdmode==%d type_ix==%d",
|
---|
2105 | cdmode, uLE_cdmode, DiscType_ix);
|
---|
2106 | //*/
|
---|
2107 | done_discControl:
|
---|
2108 | if(poweroff_delay) {
|
---|
2109 | CurrTime = Timer();
|
---|
2110 | if(CurrTime > (poweroff_start + poweroff_delay)){
|
---|
2111 | poweroff_delay = 0;
|
---|
2112 | triggerPowerOff();
|
---|
2113 | }
|
---|
2114 | }
|
---|
2115 |
|
---|
2116 | if(init_delay){
|
---|
2117 | prev_init_delay = init_delay;
|
---|
2118 | CurrTime = Timer();
|
---|
2119 | if(CurrTime > (init_delay_start + init_delay)){
|
---|
2120 | init_delay = 0;
|
---|
2121 | timeout_start = CurrTime;
|
---|
2122 | }else{
|
---|
2123 | init_delay = init_delay_start + init_delay - CurrTime;
|
---|
2124 | init_delay_start = CurrTime;
|
---|
2125 | }
|
---|
2126 | if((init_delay/1000) != (prev_init_delay/1000))
|
---|
2127 | event |= 8; //event |= visible delay change
|
---|
2128 | }else if(timeout && !user_acted){
|
---|
2129 | prev_timeout = timeout;
|
---|
2130 | CurrTime = Timer();
|
---|
2131 | if(CurrTime > (timeout_start + timeout)){
|
---|
2132 | timeout = 0;
|
---|
2133 | }else{
|
---|
2134 | timeout = timeout_start + timeout - CurrTime;
|
---|
2135 | timeout_start = CurrTime;
|
---|
2136 | }
|
---|
2137 | if((timeout/1000) != (prev_timeout/1000))
|
---|
2138 | event |= 8; //event |= visible timeout change
|
---|
2139 | }
|
---|
2140 |
|
---|
2141 | //Display section
|
---|
2142 | if(event||post_event){ //NB: We need to update two frame buffers per event
|
---|
2143 | if (!(setting->GUI_skin[0]))
|
---|
2144 | nElfs = drawMainScreen(); //Display pure text GUI on generic background
|
---|
2145 | else if (!setting->Show_Menu) { //Display only GUI jpg
|
---|
2146 | setLaunchKeys();
|
---|
2147 | clrScr(setting->color[0]);
|
---|
2148 | }
|
---|
2149 | else //Display launch filenames/titles on GUI jpg
|
---|
2150 | nElfs = drawMainScreen2(TV_mode);
|
---|
2151 | }
|
---|
2152 | drawScr();
|
---|
2153 | post_event = event;
|
---|
2154 | event = 0;
|
---|
2155 |
|
---|
2156 | //Pad response section
|
---|
2157 | if(!init_delay && (waitAnyPadReady(), readpad())){
|
---|
2158 | if(new_pad){
|
---|
2159 | event |= 2; //event |= pad command
|
---|
2160 | }
|
---|
2161 | RunELF_index = -1;
|
---|
2162 | switch(mode){
|
---|
2163 | case BUTTON:
|
---|
2164 | if(new_pad & PAD_CIRCLE) RunELF_index = 1;
|
---|
2165 | else if(new_pad & PAD_CROSS) RunELF_index = 2;
|
---|
2166 | else if(new_pad & PAD_SQUARE) RunELF_index = 3;
|
---|
2167 | else if(new_pad & PAD_TRIANGLE) RunELF_index = 4;
|
---|
2168 | else if(new_pad & PAD_L1) RunELF_index = 5;
|
---|
2169 | else if(new_pad & PAD_R1) RunELF_index = 6;
|
---|
2170 | else if(new_pad & PAD_L2) RunELF_index = 7;
|
---|
2171 | else if(new_pad & PAD_R2) RunELF_index = 8;
|
---|
2172 | else if(new_pad & PAD_L3) RunELF_index = 9;
|
---|
2173 | else if(new_pad & PAD_R3) RunELF_index = 10;
|
---|
2174 | else if(new_pad & PAD_START) RunELF_index = 11;
|
---|
2175 | else if(new_pad & PAD_SELECT) RunELF_index = 12;
|
---|
2176 | else if((new_pad & PAD_LEFT) && (maxCNF > 1 || setting->LK_Flag[13]))
|
---|
2177 | RunELF_index = 13;
|
---|
2178 | else if((new_pad & PAD_RIGHT) && (maxCNF > 1 || setting->LK_Flag[14]))
|
---|
2179 | RunELF_index = 14;
|
---|
2180 | else if(new_pad & PAD_UP || new_pad & PAD_DOWN){
|
---|
2181 | user_acted = 1;
|
---|
2182 | if (!setting->Show_Menu && setting->GUI_skin[0]){} //GUI Menu: disabled when there's no text on menu screen
|
---|
2183 | else{
|
---|
2184 | selected=0;
|
---|
2185 | mode=DPAD;
|
---|
2186 | }
|
---|
2187 | }
|
---|
2188 | if(RunELF_index >= 0 && setting->LK_Path[RunELF_index][0])
|
---|
2189 | strcpy(RunPath, setting->LK_Path[RunELF_index]);
|
---|
2190 | break;
|
---|
2191 |
|
---|
2192 | case DPAD:
|
---|
2193 | if(new_pad & PAD_UP){
|
---|
2194 | selected--;
|
---|
2195 | if(selected<0)
|
---|
2196 | selected=nElfs-1;
|
---|
2197 | }else if(new_pad & PAD_DOWN){
|
---|
2198 | selected++;
|
---|
2199 | if(selected>=nElfs)
|
---|
2200 | selected=0;
|
---|
2201 | }else if((!swapKeys && new_pad & PAD_CROSS)
|
---|
2202 | || (swapKeys && new_pad & PAD_CIRCLE) ){
|
---|
2203 | mode=BUTTON;
|
---|
2204 | }else if((swapKeys && new_pad & PAD_CROSS)
|
---|
2205 | || (!swapKeys && new_pad & PAD_CIRCLE) ){
|
---|
2206 | if(setting->LK_Path[menu_LK[selected]][0])
|
---|
2207 | strcpy(RunPath, setting->LK_Path[menu_LK[selected]]);
|
---|
2208 | }
|
---|
2209 | break;
|
---|
2210 | }//ends switch(mode)
|
---|
2211 | }//ends Pad response section
|
---|
2212 |
|
---|
2213 | if(!user_acted && ((timeout/1000)==0) && setting->LK_Path[0][0] && mode==BUTTON){
|
---|
2214 | event |= 8; //event |= visible timeout change
|
---|
2215 | strcpy(RunPath, setting->LK_Path[0]);
|
---|
2216 | }
|
---|
2217 |
|
---|
2218 | if(RunPath[0]){
|
---|
2219 | user_acted = 1;
|
---|
2220 | mode=BUTTON;
|
---|
2221 | RunElf(RunPath);
|
---|
2222 | RunPath[0] = 0;
|
---|
2223 | if (setting->GUI_skin[0]){
|
---|
2224 | GUI_active = 1;
|
---|
2225 | loadSkin(BACKGROUND_PIC, 0, 0);
|
---|
2226 | //Load_External_Language();
|
---|
2227 | //loadFont(setting->font_file);
|
---|
2228 | }
|
---|
2229 | }
|
---|
2230 | }//ends while(1)
|
---|
2231 | //----- End of main menu event loop -----
|
---|
2232 | }
|
---|
2233 | //------------------------------
|
---|
2234 | //endfunc main
|
---|
2235 | //---------------------------------------------------------------------------
|
---|
2236 | //End of file: main.c
|
---|
2237 | //---------------------------------------------------------------------------
|
---|