Disabling auto-refresh of game list by default, as it is causing bugs sometimes
[open-ps2-loader.git] / modules / iopcore / eesync / eesync.c
blob314193cce34b097ed85fd288227f4f132b8c4365
1 #include <loadcore.h>
2 #include <intrman.h>
3 #include <ioman.h>
4 #include <sifman.h>
5 #include <sysmem.h>
7 #include "loadcore_add.h"
9 #define MODNAME "SyncEE"
10 IRX_ID(MODNAME, 0x01, 0x01);
12 extern struct irx_export_table _exp_eesync;
13 u8 memory[16] = "rom0:SECRMAN";
15 void checkSecrman(void)
17 //register int i;
18 register int fd;
19 register int length;
20 register int memorySize;
21 /*u8 memory[16];
23 for (i = 0; i < 12; i++) {
24 memory[i] = 0x70 - ((i+1) * 4);
27 *(u32*)&memory[0] ^= 0x5009071e;
28 *(u32*)&memory[4] ^= 0x13110b66;
29 *(u32*)&memory[8] ^= 0x0e05051e;
30 *(u32*)&memory[12] = 0;
32 //whole above writes:
33 //6c 68 64 60 5c 58 54 50 4c 48 44 40 00 00 00 00
34 //to memory an then dexors it to
35 //"rom0:SECRMAN"
36 //Why is it so freaking weird? Why did they want to hide it?
37 //I'm also not sure of the purpose of this funciton... all games do work fine without it
38 if ((fd = open(memory, O_RDONLY)) >= 0)
40 length = lseek(fd, 0, SEEK_END);
41 if (close(fd) < 0) return;
42 if (length < 0) return;
44 if (length == 0x2731) memorySize = 0x1900;
45 else memorySize = 0x100;
47 AllocSysMemory(ALLOC_FIRST, memorySize, NULL);
51 int PostResetCallback(void)
53 sceSifSetSMFlag(0x40000);
54 return 0;
57 int _start(int argc, char** argv)
59 register void *ret;
60 register u32 bootMode;
62 if ((ret = QueryBootMode(3)) != NULL)
64 bootMode = *(u32*)((u32)ret+4);
65 if (((bootMode & 1) != 0) || ((bootMode & 2) != 0)) return MODULE_NO_RESIDENT_END;
67 if (RegisterLibraryEntries(&_exp_eesync) < 0) return MODULE_NO_RESIDENT_END;
69 checkSecrman();
71 loadcore20((Callback)PostResetCallback, 2, 0);
73 return MODULE_RESIDENT_END;