Advertisement
Guest User

Knife Example

a guest
Mar 16th, 2010
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.99 KB | None | 0 0
  1. //MiLk Approved
  2. //Bl4Ck.KiD...'s Knife Example
  3. //Includes
  4. #define _PSP_FW_VERSION 150
  5. #include <pspkernel.h>
  6. #include <pspkerneltypes.h>
  7. #include <pspmoduleinfo.h>
  8. #include <pspiofilemgr.h>
  9. #include <pspmodulemgr.h>
  10. #include <pspthreadman.h>
  11. #include <stdlib.h>
  12. #include <pspchnnlsv.h>
  13. #include <pspctrl.h>
  14. #include <string.h>
  15. #include <pspctrl_kernel.h>
  16. #include <pspthreadman_kernel.h>
  17. #include <pspumd.h>
  18. #include <crt0_prx.h>
  19. #include <psppower.h>
  20. #include <pspnet.h>
  21. #include <pspwlan.h>
  22. #include <psprtc.h>
  23. #include <psphprm.h>
  24. #include <pspctrl_kernel.h>
  25. PSP_MODULE_INFO("Knife PRX", 0x3008, 1, 2);
  26. PSP_MAIN_THREAD_ATTR(0);
  27. PSP_HEAP_SIZE_KB(-128);
  28. #define MAX_THREAD 64
  29. SceUID thid;
  30. unsigned char GAMEID[10];
  31. unsigned char BUFFER[64];
  32. unsigned int RUNNING=0;
  33.  
  34. //Activate Knife Off Code
  35. unsigned int *PRXOFF=(unsigned int*) (0x007D0000+0x08800000);
  36.  
  37. //Knife
  38. unsigned int *KNIFE=(unsigned int*) (0x005044D8+0x08800000);
  39.  
  40. int module_start(SceSize args, void *argp) __attribute__((alias
  41. ("_start")));
  42. int module_stop(SceSize args, void *argp) __attribute__((alias
  43. ("_stop")));
  44.  
  45. int mainThread(){
  46. SceCtrlData pad;
  47. sceCtrlSetSamplingCycle(0);
  48. sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
  49. signed int fd;
  50.          unsigned int counter=0;
  51.          RUNNING=1;
  52.  
  53.    sceKernelDelayThread(15000000);
  54.          while(!sceKernelFindModuleByName("sceKernelLibrary"))
  55.          sceKernelDelayThread(100000);
  56.          sceKernelDelayThread(100000);
  57.    do{
  58.                  fd=sceIoOpen("disc0:/UMD_DATA.BIN", PSP_O_RDONLY,
  59. 0777);
  60.                  sceKernelDelayThread(10000);
  61.          } while(fd<=0);
  62.          sceIoRead(fd, GAMEID, 10);
  63.          sceIoClose(fd);
  64.    if(strncmp(GAMEID, "UCUS-98645", 10)){
  65.                  RUNNING=0;
  66.          }
  67.  
  68.  
  69.  
  70. while(RUNNING){
  71. sceCtrlReadBufferPositive(&pad, 1);
  72.  
  73.  
  74. //If The Activation Code Value Is 0x00000000 Prx Goes Off
  75. if(*PRXOFF==0x00000000){
  76. //L+R+[] To Knife
  77. if((pad.Buttons & PSP_CTRL_LTRIGGER) && (pad.Buttons & PSP_CTRL_RTRIGGER) && (pad.Buttons & PSP_CTRL_SQUARE){
  78.  
  79. *KNIFE=0x00000000;//Put Modded Hex Here
  80.                        }
  81.                        else {
  82.                             *KNIFE=0x00000100;//Orignal Hex Here
  83.                             }
  84.  
  85. sceKernelDelayThread(10000);
  86. }
  87. }
  88.  
  89. int _start(SceSize args, void *argp){
  90.  
  91.  
  92.          thid=sceKernelCreateThread("KnifePRX", &mainThread, 0x18,
  93. 0x1000, 0, NULL);
  94.  
  95.  
  96.          if(thid >= 0) sceKernelStartThread(thid, 0, NULL);
  97.  
  98.          return 0;
  99.  
  100. }
  101.  
  102. int _stop(SceSize args, void *argp){
  103.  
  104.  
  105.          RUNNING=0;
  106.          sceKernelTerminateThread(thid);
  107.          return 0;
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement