Disabling auto-refresh of game list by default, as it is causing bugs sometimes
[open-ps2-loader.git] / labs / lanlab / lanlab.c
blobf0693b9ea429c198fd9ac6717626233a5844bc1e
2 #include <tamtypes.h>
3 #include <kernel.h>
4 #include <sifrpc.h>
5 #include <loadfile.h>
6 #include <fileio.h>
7 #include <fileXio_rpc.h>
8 #include <malloc.h>
9 #include <stdio.h>
10 #include <string.h>
11 #include <sbv_patches.h>
12 #include <iopcontrol.h>
13 #include <iopheap.h>
14 #include <debug.h>
15 #include <sys/time.h>
16 #include <time.h>
18 #define IP_ADDR "192.168.0.10"
19 #define NETMASK "255.255.255.0"
20 #define GATEWAY "192.168.0.1"
22 extern void poweroff_irx;
23 extern int size_poweroff_irx;
24 extern void ps2dev9_irx;
25 extern int size_ps2dev9_irx;
26 extern void smsutils_irx;
27 extern int size_smsutils_irx;
28 extern void lanman_irx;
29 extern int size_lanman_irx;
30 extern void iomanx_irx;
31 extern int size_iomanx_irx;
32 extern void filexio_irx;
33 extern int size_filexio_irx;
35 // for IP config
36 #define IPCONFIG_MAX_LEN 64
37 static char g_ipconfig[IPCONFIG_MAX_LEN] __attribute__((aligned(64)));
38 static int g_ipconfig_len;
40 //--------------------------------------------------------------
41 void set_ipconfig(void)
43 memset(g_ipconfig, 0, IPCONFIG_MAX_LEN);
44 g_ipconfig_len = 0;
46 strncpy(&g_ipconfig[g_ipconfig_len], IP_ADDR, 15);
47 g_ipconfig_len += strlen(IP_ADDR) + 1;
48 strncpy(&g_ipconfig[g_ipconfig_len], NETMASK, 15);
49 g_ipconfig_len += strlen(NETMASK) + 1;
50 strncpy(&g_ipconfig[g_ipconfig_len], GATEWAY, 15);
51 g_ipconfig_len += strlen(GATEWAY) + 1;
54 //--------------------------------------------------------------
55 int main(int argc, char *argv[2])
57 int ret, id;
59 init_scr();
60 scr_clear();
61 scr_printf("\t lanlab\n\n");
63 SifInitRpc(0);
65 scr_printf("\t IOP Reset... ");
67 while(!SifIopReset("rom0:UDNL rom0:EELOADCNF",0));
68 while(!SifIopSync());;
69 fioExit();
70 SifExitIopHeap();
71 SifLoadFileExit();
72 SifExitRpc();
73 SifExitCmd();
75 SifInitRpc(0);
76 FlushCache(0);
77 FlushCache(2);
79 SifLoadFileInit();
80 SifInitIopHeap();
82 sbv_patch_enable_lmb();
83 sbv_patch_disable_prefix_check();
85 SifLoadModule("rom0:SIO2MAN", 0, 0);
86 SifLoadModule("rom0:MCMAN", 0, 0);
87 SifLoadModule("rom0:MCSERV", 0, 0);
88 SifLoadModule("rom0:PADMAN", 0, 0);
90 scr_printf("OK\n");
92 set_ipconfig();
94 scr_printf("\t loading iomanX... ");
95 id = SifExecModuleBuffer(&iomanx_irx, size_iomanx_irx, 0, NULL, &ret);
96 scr_printf("ret=%d\n", ret);
98 scr_printf("\t loading fileXio... ");
99 id = SifExecModuleBuffer(&filexio_irx, size_filexio_irx, 0, NULL, &ret);
100 scr_printf("ret=%d\n", ret);
102 scr_printf("\t loading poweroff... ");
103 id = SifExecModuleBuffer(&poweroff_irx, size_poweroff_irx, 0, NULL, &ret);
104 scr_printf("ret=%d\n", ret);
106 scr_printf("\t loading ps2dev9... ");
107 id = SifExecModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, &ret);
108 scr_printf("ret=%d\n", ret);
110 scr_printf("\t loading smsutils... ");
111 id = SifExecModuleBuffer(&smsutils_irx, size_smsutils_irx, 0, NULL, &ret);
112 scr_printf("ret=%d\n", ret);
114 scr_printf("\t loading lanman... ");
115 id = SifExecModuleBuffer(&lanman_irx, size_lanman_irx, 0, NULL, &ret);
116 scr_printf("ret=%d\n", ret);
118 scr_printf("\t modules load OK\n");
120 printf("printf test!\n");
122 SleepThread();
123 return 0;