PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
s147netb.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#include "irx_imports.h"
12#include <loadcore.h>
13#include <sys/fcntl.h>
14
15IRX_ID("S147NETB", 2, 2);
16// Text section hash:
17// 49d8ea7bd41706df5cfcebac25acdc5e
18
19int _start(int ac, char **av)
20{
21 char probebuf;
22 int fd;
23 int probe_i;
24
25 (void)ac;
26 (void)av;
27 Kprintf("\ns147netb.irx: System147 Network Boot Manager v%d.%d\n", 2, 2);
28 fd = open("atfile19:usb-probe", O_RDONLY);
29 if ( fd < 0 )
30 {
31 Kprintf("s147netb.irx: Could not initialize USB memory driver\n");
32 return MODULE_NO_RESIDENT_END;
33 }
34 for ( probe_i = 5; probe_i > 0; probe_i -= 1 )
35 {
36 read(fd, &probebuf, sizeof(probebuf));
37 Kprintf("\ns147netb.irx: === Wait %dsec for USB initialize... (probe=%d) ===\n", probe_i, (u8)probebuf);
38 if ( probebuf == 1 )
39 break;
40 DelayThread(1000000);
41 }
42 close(fd);
43 if ( !probebuf )
44 {
45 Kprintf("\ns147netb.irx: *** No USB memory ***\n");
46 return MODULE_RESIDENT_END;
47 }
48 fd = open("atfile10:ifc000.cnf", O_RDONLY);
49 if ( fd < 0 )
50 {
51 Kprintf("s147netb.irx: Could not find \"%s\"\n", "atfile10:ifc000.cnf");
52 return MODULE_RESIDENT_END;
53 }
54 close(fd);
55 Kprintf("s147netb.irx: \"%s\" is found\n", "atfile10:ifc000.cnf");
56 fd = open("atfile10:inet.irx", O_RDONLY);
57 if ( fd < 0 )
58 {
59 Kprintf("s147netb.irx: Could not find \"%s\"\n", "atfile10:inet.irx");
60 return MODULE_RESIDENT_END;
61 }
62 close(fd);
63 Kprintf("s147netb.irx: \"%s\" is found\n", "atfile10:inet.irx");
64 fd = open("atfile10:an986.irx", O_RDONLY);
65 if ( fd < 0 )
66 {
67 Kprintf("s147netb.irx: Could not find \"%s\"\n", "atfile10:an986.irx");
68 return MODULE_RESIDENT_END;
69 }
70 close(fd);
71 Kprintf("s147netb.irx: \"%s\" is found\n", "atfile10:an986.irx");
72 fd = open("atfile10:s147http.irx", O_RDONLY);
73 if ( fd < 0 )
74 {
75 Kprintf("s147netb.irx: Could not find \"%s\"\n", "atfile10:s147http.irx");
76 return MODULE_RESIDENT_END;
77 }
78 close(fd);
79 Kprintf("s147netb.irx: \"%s\" is found\n", "atfile10:s147http.irx");
80 Kprintf(
81 "s147netb.irx: LoadStartModule \"%s\" (%d)\n", "atfile10:inet.irx", LoadStartModule("atfile10:inet.irx", 0, 0, 0));
82 Kprintf(
83 "s147netb.irx: LoadStartModule \"%s\" (%d)\n",
84 "atfile10:an986.irx",
85 LoadStartModule("atfile10:an986.irx", 0, 0, 0));
86 Kprintf(
87 "s147netb.irx: LoadStartModule \"%s\" (%d)\n",
88 "atfile10:s147http.irx",
89 LoadStartModule("atfile10:s147http.irx", 0, 0, 0));
90 return MODULE_RESIDENT_END;
91}