ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
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 
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 
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 
60  return 0;
61 
62  smem_buf.bytes[64]='\0';
63  do {
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 }
jpgData * info
Definition: camera-test.c:14
int __memcmp(const void *s1, const void *s2, unsigned int length)
Definition: common.c:27
void SyncDCache(void *start, void *end)
int SifRpcGetOtherData(SifRpcReceiveData_t *rd, void *src, void *dest, int size, int mode)
int smod_get_next_mod(smod_mod_info_t *cur_mod, smod_mod_info_t *next_mod)
Definition: smod.c:30
int smod_get_mod_by_name(const char *name, smod_mod_info_t *info)
Definition: smod.c:54
Definition: common.h:3
u8 bytes[SMEM_BUF_SIZE/sizeof(u8)]
Definition: common.h:5
smod_mod_info_t mod_info
Definition: common.h:7
struct _smod_mod_info * next
Definition: smod.h:25
#define NULL
Definition: tamtypes.h:91