Code:
#define _PSP_FW_VERSION 150
#include "includes/main.h"
#include "includes/socom.h"
#include <libcheat.h>
PSP_MODULE_INFO("Knife PRX", 0x3007, 1, 2);
PSP_MAIN_THREAD_ATTR(0);
PSP_HEAP_SIZE_KB(256);
SceUID thid;
//set up storage points for buffers
unsigned char GAMEID[10];
unsigned char BUFFER[64];
unsigned int *PRXOFF=(unsigned int*) (0x00804FF4+0x08800000);
unsigned int *LOBBY=(unsigned int*) (0x005044E0+0x08800000);
unsigned int RUNNING=0;
//Functions
int module_start(SceSize args, void *argp) __attribute__((alias("_start")));
int module_stop(SceSize args, void *argp) __attribute__((alias("_stop")));
int mainThread(){
SceCtrlData pad;
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
signed int fd;
unsigned int counter=0;
RUNNING=1;
//Wait for the kernel to boot up
sceKernelDelayThread(15000000);
while(!sceKernelFindModuleByName("sceKernelLibrary"))
sceKernelDelayThread(100000);
sceKernelDelayThread(100000);
//Find the Game ID
do{
fd=sceIoOpen("disc0:/UMD_DATA.BIN", PSP_O_RDONLY, 0777);
sceKernelDelayThread(10000);
}while(fd<=0);
//grab the game id from umd_data.bin and and store it into GAMEID buffer
sceIoRead(fd, GAMEID, 10);
//close the buffer
sceIoClose(fd);
//Compare the GAMEID buffer to the string "UCUS-98645" to see if the game is SOCOM RUNNING
if(strncmp(GAMEID, "UCUS-98645", 10)){
//Game isn't SOCOM RUNNING tell running to stop, this will also stop our while loop below.
RUNNING=0;
}
int count=0;
//while running is not equal to zero then run this loop
while(RUNNING){
sceCtrlReadBufferPositive(&pad, 1);
if(*LOBBY == 0x00010001){
setU32(0x08D044DC, 0x00000003);
}
if(*PRXOFF == 0x00000000){
//While Holdig R+[] your going to knife everyone
if((pad.Buttons & PSP_CTRL_RTRIGGER) && (pad.Buttons & PSP_CTRL_SQUARE)){
setU32DMA(0x08D05858, 0x00000000, 0x00000000);
if(*socomLobbyData01 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000002);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData01 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000004);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData02 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000066);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData03 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x000000CA);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData04 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x0000012E);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData05 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000192);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData06 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x000001F6);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData07 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x0000025A);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData08 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000322);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData09 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000386);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData10 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x000003EA);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData11 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x000002BE);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData12 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x0000044E);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData13 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x000004B2);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData14 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x00000516);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData15 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x0000057A);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
if(*socomLobbyData16 != 0xFFFFFFFF){
setU32DMA(0x08D05858, 0x00000630, 0x0000001C);
setU32DMA(0x08D05858, 0x00000634, 0x00000000);
setU32DMA(0x08D05858, 0x00000638, 0x000005DE);
sceKernelDelayThread(200000);
}
else{
retU32DMA(0x08D05858, 0x00000630);
retU32DMA(0x08D05858, 0x00000634);
retU32DMA(0x08D05858, 0x00000638);
}
}
//time out to keep thinks smooooth
sceKernelDelayThread(100000);
}
}
}
int _start(SceSize args, void *argp){
//Create thread
thid=sceKernelCreateThread("OurThread", &mainThread, 0x18, 0x1000, 0, NULL);
//Start thread
if(thid >= 0) sceKernelStartThread(thid, 0, NULL);
return 0;
}
int _stop(SceSize args, void *argp){
//shut down all our functions depending on RUNNING
RUNNING=0;
sceKernelTerminateThread(thid);
return 0;
}