Quantcast
Channel: NextGenUpdate
Viewing all articles
Browse latest Browse all 27691

SPRX C++ Code/Help Thread

$
0
0
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

Spoiler:

Write/Read Memory
Spoiler:

Code:

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
Spoiler:

Code:

#include <sys/syscall.h>

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



Exit Thread
Spoiler:

Code:

#include <sys/syscall.h>

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



Create Thread
Spoiler:

Code:

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

sys_ppu_thread_t id;
int 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 SYS_PRX_RESIDENT;
}



Console Write
Spoiler:

Code:

#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);
}



Viewing all articles
Browse latest Browse all 27691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>