PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
smod.c
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
#include <
tamtypes.h
>
17
#include <
kernel.h
>
18
#include <string.h>
19
#include <sifrpc.h>
20
21
#include "
smem.h
"
22
#include "
slib.h
"
23
#include "
smod.h
"
24
25
#include "
common.h
"
26
27
/* from common.c */
28
extern
struct
smem_buf
smem_buf
;
29
30
int
smod_get_next_mod
(
smod_mod_info_t
*cur_mod,
smod_mod_info_t
*next_mod)
31
{
32
SifRpcReceiveData_t
RData;
33
void
*addr;
34
35
/* If cur_mod is 0, return the head of the list (typically IOP address 0x800). */
36
if
(!cur_mod) {
37
addr = (
void
*)0x800;
38
}
else
{
39
if
(!cur_mod->next)
40
return
0;
41
else
42
addr = cur_mod->next;
43
}
44
45
SyncDCache(&
smem_buf
,
smem_buf
.bytes+
sizeof
(
smod_mod_info_t
));
46
if
(SifRpcGetOtherData(&RData, addr, &
smem_buf
,
sizeof
(
smod_mod_info_t
), 0)>=0){
47
memcpy(next_mod, &
smem_buf
.mod_info,
sizeof
(
smod_mod_info_t
));
48
return
next_mod->id;
49
}
50
51
return
0;
52
}
53
54
int
smod_get_mod_by_name
(
const
char
*name,
smod_mod_info_t
*
info
)
55
{
56
SifRpcReceiveData_t
RData;
57
int
len = strlen(name);
58
59
if
(!
smod_get_next_mod
(NULL,
info
))
60
return
0;
61
62
smem_buf
.bytes[64]=
'\0'
;
63
do
{
64
SyncDCache(&
smem_buf
,
smem_buf
.bytes+64);
65
if
(SifRpcGetOtherData(&RData,
info
->name, &
smem_buf
, 64, 0)>=0){
66
if
(!__memcmp(
smem_buf
.bytes, name, len))
67
return
info
->id;
68
}
69
}
while
(
smod_get_next_mod
(
info
,
info
) != 0);
70
71
return
0;
72
}
smod_get_next_mod
int smod_get_next_mod(smod_mod_info_t *cur_mod, smod_mod_info_t *next_mod)
Definition
smod.c:30
smod_get_mod_by_name
int smod_get_mod_by_name(const char *name, smod_mod_info_t *info)
Definition
smod.c:54
t_SifRpcReceiveData
Definition
sifrpc.h:147
common.h
kernel.h
slib.h
smem.h
smod.h
_smod_mod_info
Definition
smod.h:24
s_info
Definition
xprintf.c:78
smem_buf
Definition
common.h:3
tamtypes.h
ee
sbv
src
smod.c
Generated on Thu Nov 14 2024 05:25:25 for PS2SDK by
1.9.8