PS2SDK
PS2 Homebrew Libraries
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 # Copyright (c) 2003, 2004 adresd <adresd_ps2dev@yahoo.com>
8 # Licenced under Academic Free License version 2.0
9 # Review ps2sdk README & LICENSE files for further details.
10 */
11 
17 #include "types.h"
18 #include "defs.h"
19 #include "irx.h"
20 
21 #include "loadcore.h"
22 #include "ioman.h"
23 #include "stdio.h"
24 #include "sysclib.h"
25 
26 #include "iopmgr.h"
27 
40 {
41  /* If cur_mod is 0, return the head of the list. */
42  if (!cur_mod) {
43  return GetLoadcoreInternalData()->image_info;
44  } else {
45  if (!cur_mod->next)
46  return 0;
47  else
48  return cur_mod->next;
49  }
50  return 0;
51 }
52 
64 {
65  ModuleInfo_t *modptr;
66  int len = strlen(name)+1;
67 
68  modptr = smod_get_next_mod(0);
69  while (modptr != 0)
70  {
71  if (!memcmp(modptr->name, name, len))
72  return modptr;
73  modptr = modptr->next;
74  }
75  return 0;
76 }
77 
88 int smod_get_modcount_by_name(const char *name)
89 {
90  ModuleInfo_t *modptr = 0;
91  int len = strlen(name)+1;
92  int count = 0;
93 
94  modptr = smod_get_next_mod(0);
95  while (modptr != 0)
96  {
97  if (!memcmp(modptr->name, name, len))
98  count++;
99  modptr = modptr->next;
100  }
101 
102  return count;
103 }
104 
115 int smod_get_modversion_by_name(const char *name)
116 {
117  ModuleInfo_t *modptr = 0;
118  modptr = smod_get_mod_by_name(name);
119  if (modptr != 0)
120  return (int)modptr->version;
121  else
122  return -1;
123 }
124 
136 int smod_unload_module(const char *name)
137 {
138  (void)name;
139 
140  return -2;
141 }
smod_get_mod_by_name
int smod_get_mod_by_name(const char *name, smod_mod_info_t *info)
Definition: smod.c:54
iopmgr.h
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_modversion_by_name
int smod_get_modversion_by_name(const char *name)
Definition: smod.c:115
sysclib.h
smod_get_modcount_by_name
int smod_get_modcount_by_name(const char *name)
Definition: smod.c:88
loadcore.h
smod_unload_module
int smod_unload_module(const char *name)
Definition: smod.c:136
count
u32 count
start sector of fragmented bd/file
Definition: usbhdfsd-common.h:3
irx.h
stdio.h
ioman.h
defs.h
_ModuleInfo
Definition: loadcore.h:31
tag_LC_internals::image_info
ModuleInfo_t * image_info
Definition: loadcore.h:82