PS2SDK
PS2 Homebrew Libraries
patch_disable_prefix_check.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 
20 #include "slib.h"
21 
22 extern slib_exp_lib_list_t _slib_cur_exp_lib_list;
23 
24 static const u32 g_patch[2] = {
25  0x03e00008, /* jr $ra */
26  0x00001021 /* addiu $v0, $0, 0 */
27 };
28 
30 {
31  union {
32  u8 buf[256];
33  slib_exp_lib_t exp_lib;
34  } buf;
35  static u32 patch[sizeof(g_patch)/sizeof(g_patch[0])] ALIGNED(16);
36  SifDmaTransfer_t dmat;
37  slib_exp_lib_t *modload_lib = &buf.exp_lib;
38 
39  memcpy(UNCACHED_SEG(patch), g_patch, sizeof(g_patch));
40  memset(&_slib_cur_exp_lib_list, 0, sizeof(slib_exp_lib_list_t));
41 
42  if (!slib_get_exp_lib("modload", modload_lib))
43  return -1;
44 
45  dmat.src=patch;
46  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.
47  dmat.dest=modload_lib->exports[15];
48  dmat.attr=0;
49 
50  sceSifSetDma(&dmat, 1);
51 
52  return 0;
53 }
kernel.h
_slib_exp_lib_list
Definition: slib.h:45
slib.h
tamtypes.h
_slib_exp_lib
Definition: slib.h:32
slib_get_exp_lib
int slib_get_exp_lib(const char *name, slib_exp_lib_t *library)
Definition: slib.c:103
t_SifDmaTransfer
Definition: sifdma.h:52
sbv_patch_disable_prefix_check
int sbv_patch_disable_prefix_check(void)
Definition: patch_disable_prefix_check.c:29