sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
eesync.c
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright 2001-2004, 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 <
loadcore.h
>
12
#include <
intrman.h
>
13
#include <
ioman.h
>
14
#include <
sifman.h
>
15
#include <
sysmem.h
>
16
#include <
sysclib.h
>
17
18
#define MODNAME "SyncEE"
19
IRX_ID(MODNAME, 0x01, 0x01);
20
21
static
int
PostResetCallback(
iop_init_entry_t
*arg1,
int
arg2)
22
{
23
#ifdef EESYNC_WIPE_EE_KERNEL_SPACE
24
void
*block;
25
SifDmaTransfer_t dmat;
26
27
block = AllocSysMemory(0, 0x7C000, 0);
28
memset(block, 0, 0x7C000);
29
dmat.src = block;
30
dmat.dest = (
void
*)0x84000;
31
dmat.size = 0x7C000;
32
dmat.attr = 0;
33
sceSifSetDma(&dmat, 1);
34
FreeSysMemory(block);
35
#endif
36
(void)arg1;
37
(void)arg2;
38
39
sceSifSetSMFlag(
SIF_STAT_BOOTEND
);
40
41
return
0;
42
}
43
44
#ifdef EESYNC_SECRMAN_DUMMY
45
static
void
allocate_empty_space_for_secrman(
void
)
46
{
47
int
fd;
48
49
// In the original SCE version, there was obfuscation applied to the file string.
50
fd = open(
"rom0:SECRMAN"
, O_RDONLY);
51
if
(fd >= 0)
52
{
53
int
lseek_result;
54
int
close_result;
55
56
lseek_result = lseek(fd, 0, SEEK_END);
57
close_result = close(fd);
58
if
((lseek_result >= 0) && (close_result >= 0))
59
{
60
AllocSysMemory(0, (lseek_result == 10033) ? 6400 : 256, NULL);
61
}
62
}
63
}
64
#endif
65
66
#ifdef EESYNC_REGISTER_EXPORTS
67
extern
struct
irx_export_table
_exp_eesync;
68
#endif
69
70
int
_start(
int
argc,
char
**argv)
71
{
72
#ifdef EESYNC_CHECK_ILOADP
73
int
*BootMode;
74
#endif
75
76
(void)argc;
77
(void)argv;
78
79
#ifdef EESYNC_CHECK_ILOADP
80
BootMode = QueryBootMode(3);
81
// If ILOADP bit 0 (Init SIF) is set or ILOADP bit 1 (Do not perform FILEIO services) is set, do not initialize SIF
82
if
(BootMode != NULL && (((BootMode[1] & 1) != 0) || (BootMode[1] & 2) != 0))
83
{
84
return
MODULE_NO_RESIDENT_END;
85
}
86
#endif
87
#ifdef EESYNC_REGISTER_EXPORTS
88
if
(RegisterLibraryEntries(&_exp_eesync) < 0)
89
{
90
return
MODULE_NO_RESIDENT_END;
91
}
92
#endif
93
#ifdef EESYNC_SECRMAN_DUMMY
94
allocate_empty_space_for_secrman();
95
#endif
96
RegisterPostBootCallback(&PostResetCallback, 2, 0);
97
98
return
MODULE_RESIDENT_END;
99
}
intrman.h
ioman.h
loadcore.h
SIF_STAT_BOOTEND
#define SIF_STAT_BOOTEND
Definition
sifdma.h:51
sifman.h
iop_init_entry_t
Definition
loadcore.h:101
irx_export_table
Definition
irx.h:117
sysclib.h
sysmem.h
core
eesync
src
eesync.c
Generated by
1.18.0