ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
patch_disable_prefix_check.c File Reference
#include <tamtypes.h>
#include <kernel.h>
#include <string.h>
#include "slib.h"
+ Include dependency graph for patch_disable_prefix_check.c:

Go to the source code of this file.

Functions

int sbv_patch_disable_prefix_check (void)
 

Variables

slib_exp_lib_list_t _slib_cur_exp_lib_list
 

Detailed Description

Disable the MODLOAD check for .elf's or .irx's on certain devices.

Definition in file patch_disable_prefix_check.c.

Function Documentation

◆ sbv_patch_disable_prefix_check()

int sbv_patch_disable_prefix_check ( void  )
Returns
0: success, none-zero: error

The MODLOAD module has a black/white (depends on version) list that determines what devices can have unprotected EE/IOP executables loaded from. Typically, only protected executables can be loaded from user-writable media like the memory card or HDD unit. This patch will disable the black/white list, allowing executables to be freely loaded from any device.

Definition at line 24 of file patch_disable_prefix_check.c.

25 {
26  union {
27  u8 buf[256];
28  slib_exp_lib_t exp_lib;
29  } buf;
30  static u32 patch[2] ALIGNED(16)={
31  0x03e00008, /* jr $ra */
32  0x00001021 /* addiu $v0, $0, 0 */
33  };
34  SifDmaTransfer_t dmat;
35  slib_exp_lib_t *modload_lib = &buf.exp_lib;
36 
37  memset(&_slib_cur_exp_lib_list, 0, sizeof(slib_exp_lib_list_t));
38 
39  if (!slib_get_exp_lib("modload", modload_lib))
40  return -1;
41 
42  dmat.src=patch;
43  dmat.size=sizeof(patch); //16-bytes will be written to IOP RAM, but the function on the IOP side is longer than 16 bytes in length.
44  dmat.dest=modload_lib->exports[15];
45  dmat.attr=0;
46 
47  SifSetDma(&dmat, 1);
48 
49  return 0;
50 }
u32 SifSetDma(SifDmaTransfer_t *sdd, s32 len)
#define ALIGNED(x)
Definition: kernel.h:50
slib_exp_lib_list_t _slib_cur_exp_lib_list
Definition: slib.c:26
int slib_get_exp_lib(const char *name, slib_exp_lib_t *library)
Definition: slib.c:101
void * dest
Definition: sifdma.h:55
void * src
Definition: sifdma.h:54
void * exports[0]
Definition: slib.h:38
unsigned int u32
Definition: tamtypes.h:30
unsigned char u8
Definition: tamtypes.h:23

References _slib_cur_exp_lib_list, ALIGNED, SifDmaTransfer_t::attr, SifDmaTransfer_t::dest, slib_exp_lib_t::exports, SifSetDma(), SifDmaTransfer_t::size, slib_get_exp_lib(), and SifDmaTransfer_t::src.

Variable Documentation

◆ _slib_cur_exp_lib_list

slib_exp_lib_list_t _slib_cur_exp_lib_list
extern

Definition at line 26 of file slib.c.

Referenced by sbv_patch_disable_prefix_check().