Post: SPRX C++ Code/Help Thread
07-16-2014, 07:23 AM #1
Shark
Retired.
(adsbygoogle = window.adsbygoogle || []).push({}); Hey, since the method to make sprx's has been released I thought I would make this thread where everyone can post their codes (if they want) and request help (nothing to stupid please...), so ill start it off with a few codes


Write/Read Memory

    
Int32
*(int*)OffsetToWriteTo = IntergerToWrite;
int mem = *(int*)OffsetToRead;

Float
*(float*)OffsetToWriteTo = FloatToWrite;
float mem = *(int*)OffsetToRead;

there is many more of these just google it or look at xbox :p



Get ProcessID

    
#include <sys/syscall.h>

sys_pid_t sys_process_getpid(void)
{
system_call_0(1);
return_to_user_prog(sys_pid_t);
}



Sleep

    
#include <sys/sys_time.h>

void sleep(second_t time)
{
sys_timer_sleep(time);
}


Exit Thread

    
#include <sys/syscall.h>

int sys_ppu_thread_exit()
{
system_call_1(41, 0);
return_to_user_prog(int);
}



Create Thread

    
#include <sys/syscall.h>
#include <sys/ppu_thread.h>

sys_ppu_thread_t id;
sys_ppu_thread_t create_thread(void (*entry)(uint64_t), int priority, size_t stacksize, const char* threadname)
{
if(sys_ppu_thread_create(&id, entry, 0, priority , stacksize, 0, threadname) != CELL_OK)
{
console_write("Thread creation failed\n");
}
else
{
console_write("Thread created\n");
}
return id;
}



Console Write

    
#include <string.h>
#include <sys/syscall.h>
#include <stdarg.h>
#include <stddef.h>

int console_write(const char * s)
{
uint32_t len;
system_call_4(403, 0, (uint64_t) s, std::strlen(s), (uint64_t) &len);
return_to_user_prog(int);
}


Last edited by Shark ; 07-16-2014 at 10:47 AM.

The following 22 users say thank you to Shark for this useful post:

aburezk, Bad Luck Brian, elgolumm, flynhigh09, hackeveryone, HRX3, ImAzazel, iMoDz-Baptiste, ImPiffHD, KareraHekku, KranK, LaRip8, MegaMister, John, NotALegitPlayer, OLDSCHOOLMODZHD, RambosNGU, RouletteBoi, ShutTheCrunchUp, th3_goodGuy, Turk_Warrior, Winter
07-16-2014, 07:26 AM #2
Winter
Purple God
Free 4 first post? Happy

The following user thanked Winter for this useful post:

John
07-16-2014, 01:34 PM #3
Notorious
Caprisuns Is Back
Originally posted by Shark View Post
Hey, since the method to make sprx's has been released I thought I would make this thread where everyone can post their codes (if they want) and request help (nothing to stupid please...), so ill start it off with a few codes


Write/Read Memory

    
Int32
*(int*)OffsetToWriteTo = IntergerToWrite;
int mem = *(int*)OffsetToRead;

Float
*(float*)OffsetToWriteTo = FloatToWrite;
float mem = *(int*)OffsetToRead;

there is many more of these just google it or look at xbox :p



Get ProcessID

    
#include <sys/syscall.h>

sys_pid_t sys_process_getpid(void)
{
system_call_0(1);
return_to_user_prog(sys_pid_t);
}



Sleep

    
#include <sys/sys_time.h>

void sleep(second_t time)
{
sys_timer_sleep(time);
}


Exit Thread

    
#include <sys/syscall.h>

int sys_ppu_thread_exit()
{
system_call_1(41, 0);
return_to_user_prog(int);
}



Create Thread

    
#include <sys/syscall.h>
#include <sys/ppu_thread.h>

sys_ppu_thread_t id;
sys_ppu_thread_t create_thread(void (*entry)(uint64_t), int priority, size_t stacksize, const char* threadname)
{
if(sys_ppu_thread_create(&id, entry, 0, priority , stacksize, 0, threadname) != CELL_OK)
{
console_write("Thread creation failed\n");
}
else
{
console_write("Thread created\n");
}
return id;
}



Console Write

    
#include <string.h>
#include <sys/syscall.h>
#include <stdarg.h>
#include <stddef.h>

int console_write(const char * s)
{
uint32_t len;
system_call_4(403, 0, (uint64_t) s, std::strlen(s), (uint64_t) &len);
return_to_user_prog(int);
}



hereeeeeeeeeee idk what works or not but yolo:
    
void GetParamSFO(uint8_t buffer)
{
system_call_1(0x01E, getPID(), buffer);
}

void SetMem(int address, byte buff[])
{
*(int*)address = buff;
}
void DetachThread(int id)
{
system_call(0x02D, getPID(), id);
}
void genRandNum(int buffer)
{
system_call_3(0x361, getPID(), sizeof(buffer), buffer);
}
void GrabCID(uint8_t buffer)
{
system_call_1(0x366, buffer);
}

The following 4 users say thank you to Notorious for this useful post:

iMoDz-Baptiste, Shark, ShutTheCrunchUp, Swaqq
07-16-2014, 04:43 PM #4
seb5594
Proud Former Admin
Originally posted by Prime
hereeeeeeeeeee idk what works or not but yolo:
    
void GetParamSFO(uint8_t buffer)
{
system_call_1(0x01E, getPID(), buffer);
}

void SetMem(int address, byte buff[])
{
*(int*)address = buff;
}
void DetachThread(int id)
{
system_call(0x02D, getPID(), id);
}
void genRandNum(int buffer)
{
system_call_3(0x361, getPID(), sizeof(buffer), buffer);
}
void GrabCID(uint8_t buffer)
{
system_call_1(0x366, buffer);
}


The reward for the first PS3 Brick goes to.... Notorious lmfao
Please try all sys calls Cool Troll

The following 4 users say thank you to seb5594 for this useful post:

ItsLollo1000, SC58, VezahMoDz
07-16-2014, 05:13 PM #5
Originally posted by Shark View Post
Hey, since the method to make sprx's has been released I thought I would make this thread where everyone can post their codes (if they want) and request help (nothing to stupid please...), so ill start it off with a few codes


Write/Read Memory

    
Int32
*(int*)OffsetToWriteTo = IntergerToWrite;
int mem = *(int*)OffsetToRead;

Float
*(float*)OffsetToWriteTo = FloatToWrite;
float mem = *(int*)OffsetToRead;

there is many more of these just google it or look at xbox :p



Get ProcessID

    
#include <sys/syscall.h>

sys_pid_t sys_process_getpid(void)
{
system_call_0(1);
return_to_user_prog(sys_pid_t);
}



Sleep

    
#include <sys/sys_time.h>

void sleep(second_t time)
{
sys_timer_sleep(time);
}


Exit Thread

    
#include <sys/syscall.h>

int sys_ppu_thread_exit()
{
system_call_1(41, 0);
return_to_user_prog(int);
}



Create Thread

    
#include <sys/syscall.h>
#include <sys/ppu_thread.h>

sys_ppu_thread_t id;
sys_ppu_thread_t create_thread(void (*entry)(uint64_t), int priority, size_t stacksize, const char* threadname)
{
if(sys_ppu_thread_create(&id, entry, 0, priority , stacksize, 0, threadname) != CELL_OK)
{
console_write("Thread creation failed\n");
}
else
{
console_write("Thread created\n");
}
return id;
}



Console Write

    
#include <string.h>
#include <sys/syscall.h>
#include <stdarg.h>
#include <stddef.h>

int console_write(const char * s)
{
uint32_t len;
system_call_4(403, 0, (uint64_t) s, std::strlen(s), (uint64_t) &len);
return_to_user_prog(int);
}



Lol you just took these from the sample plugin :p
07-16-2014, 05:14 PM #6
Originally posted by Prime
hereeeeeeeeeee idk what works or not but yolo:
    
void GetParamSFO(uint8_t buffer)
{
system_call_1(0x01E, getPID(), buffer);
}

void SetMem(int address, byte buff[])
{
*(int*)address = buff;
}
void DetachThread(int id)
{
system_call(0x02D, getPID(), id);
}
void genRandNum(int buffer)
{
system_call_3(0x361, getPID(), sizeof(buffer), buffer);
}
void GrabCID(uint8_t buffer)
{
system_call_1(0x366, buffer);
}


Did you not even test these tears
07-16-2014, 05:32 PM #7
Originally posted by Shark View Post
Hey, since the method to make sprx's has been released I thought I would make this thread where everyone can post their codes (if they want) and request help (nothing to stupid please...), so ill start it off with a few codes


Write/Read Memory

    
Int32
*(int*)OffsetToWriteTo = IntergerToWrite;
int mem = *(int*)OffsetToRead;

Float
*(float*)OffsetToWriteTo = FloatToWrite;
float mem = *(int*)OffsetToRead;

there is many more of these just google it or look at xbox :p



Get ProcessID

    
#include <sys/syscall.h>

sys_pid_t sys_process_getpid(void)
{
system_call_0(1);
return_to_user_prog(sys_pid_t);
}



Sleep

    
#include <sys/sys_time.h>

void sleep(second_t time)
{
sys_timer_sleep(time);
}


Exit Thread

    
#include <sys/syscall.h>

int sys_ppu_thread_exit()
{
system_call_1(41, 0);
return_to_user_prog(int);
}



Create Thread

    
#include <sys/syscall.h>
#include <sys/ppu_thread.h>

sys_ppu_thread_t id;
sys_ppu_thread_t create_thread(void (*entry)(uint64_t), int priority, size_t stacksize, const char* threadname)
{
if(sys_ppu_thread_create(&id, entry, 0, priority , stacksize, 0, threadname) != CELL_OK)
{
console_write("Thread creation failed\n");
}
else
{
console_write("Thread created\n");
}
return id;
}



Console Write

    
#include <string.h>
#include <sys/syscall.h>
#include <stdarg.h>
#include <stddef.h>

int console_write(const char * s)
{
uint32_t len;
system_call_4(403, 0, (uint64_t) s, std::strlen(s), (uint64_t) &len);
return_to_user_prog(int);
}




For people who don't know to do systemcalls with the ps3 sdk it goes as the following.

Include the header file needed
    #include <sys/syscall.h>


Now to call the syscall that you want you need to know the number of arguments or parameters the call requires, not including the syscall number itself so take syscall 379 for an example, this is the sys_sm_shutown function. This requires 3 params according the the lv2 syscall chart. So you will do the following.

    
//Start it out like this system_call_[number of parameters]([syscall number], params, params, params, params)
system_call_3(379, 0x100, 0, 0);

See how it's done? the three in system_call_3 is the amount of args, then the 379 is the syscall number, and the two 0's are the remaining arguments. It's easy as strudel
07-16-2014, 07:50 PM #8
seb5594
Proud Former Admin
Originally posted by BlackPanther View Post
Did you not even test these tears


If yes, then he wouldn't be able to try more now tears

Originally posted by BlackPanther View Post
For people who don't know to do systemcalls with the ps3 sdk it goes as the following.

Include the header file needed
    #include <sys/syscall.h>


Now to call the syscall that you want you need to know the number of arguments or parameters the call requires, not including the syscall number itself so take syscall 379 for an example, this is the sys_sm_shutown function. This requires 3 params according the the lv2 syscall chart. So you will do the following.

    
//Start it out like this system_call_[number of parameters]([syscall number], params, params, params, params)
system_call_3(379, 0x100, 0, 0);

See how it's done? the three in system_call_3 is the amount of args, then the 379 is the syscall number, and the two 0's are the remaining arguments. It's easy as strudel


Here's good site for all Syscalls if someone didn't knew it Smile

You must login or register to view this content.

I wouldnt mess arround with too many of them :p

The following user thanked seb5594 for this useful post:

07-16-2014, 09:30 PM #9
Notorious
Caprisuns Is Back
Originally posted by seb5594 View Post
The reward for the first PS3 Brick goes to.... Notorious lmfao
Please try all sys calls Cool Troll


lol I really don't care what you say, I said I am not sure which ones work or not so yeah I really don't give two fuck's what you or any other people say about me.
07-16-2014, 10:35 PM #10
Sabotage
Gaming Squad
Originally posted by Prime
lol I really don't care what you say, I said I am not sure which ones work or not so yeah I really don't give two fuck's what you or any other people say about me.


stare You are kind of weird
(In a good way)

The following 2 users say thank you to Sabotage for this useful post:

Sw3Rve-X

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo