Editing CCAPI
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 246: | Line 246: | ||
= CCAPI 2.70 - 2.80 rev5 = | = CCAPI 2.70 - 2.80 rev5 = | ||
''' Location of ccapi.sprx ''' | |||
ccapi.sprx is renamed to sys_audio.sprx and is located to /dev_flash/sys/internal/sys_audio.sprx | |||
== Packets and http Requests == | == Packets and http Requests == | ||
Port:6333 | Port:6333 | ||
Communication: HTTP | Communication: HTTP | ||
Port:1979 PS3 | Port:1979 PS3 | ||
Communication: TCP/UDP | Communication: TCP/UDP | ||
<code>static int connect_to_CAPPI(void)<br>{<br>struct sockaddr_in sin;<br>int s;<br>sin.sin_family = AF_INET;<br>sin.sin_addr.s_addr = 0x7F000001; //127.0.0.1 (localhost)<br>sin.sin_port = htons(6333);<br>s = socket(AF_INET, SOCK_STREAM, 0);<br>if (s < 0)<br>{<br>return -1;<br>}<br>if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)<br>{<br>return -1;<br>}<br>return s;<br>} | <code> | ||
static int connect_to_CAPPI(void)<br> | |||
{<br> | |||
struct sockaddr_in sin;<br> | |||
int s;<br> | |||
<br> | |||
sin.sin_family = AF_INET;<br> | |||
sin.sin_addr.s_addr = 0x7F000001; //127.0.0.1 (localhost)<br> | |||
sin.sin_port = htons(6333);<br> | |||
s = socket(AF_INET, SOCK_STREAM, 0);<br> | |||
if (s < 0)<br> | |||
{<br> | |||
return -1;<br> | |||
}<br> | |||
<br> | |||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)<br> | |||
{<br> | |||
return -1;<br> | |||
}<br> | |||
<br> | |||
return s;<br> | |||
}<br> | |||
void DoNotify(char *szFormat,int id = 0) <br> | |||
{<br> | |||
char _notify_buffer[512];<br> | |||
snprintf(_notify_buffer, 512, "/ccapi/notify?id=%i&msg=%s",id,szFormat);<br> | |||
send_CCAPI_request(_notify_buffer);<br> | |||
}<br> | |||
<br> | |||
void ShutDownPS3() <br> | |||
{<br> | |||
char _notify_buffer[512];<br> | |||
snprintf(_notify_buffer, 512, "/ccapi/shutdown?mode=1");<br> | |||
send_CCAPI_request(_notify_buffer);<br> | |||
}<br> | |||
void RestartPS3()<br> | |||
{<br> | |||
char _notify_buffer[512];<br> | |||
snprintf(_notify_buffer, 512, "/ccapi/shutdown?mode=2");<br> | |||
send_CCAPI_request(_notify_buffer);<br> | |||
}<br> | |||
void Buzzer(int snd = 1)<br> | |||
{<br> | |||
char _notify_buffer[512];<br> | |||
snprintf(_notify_buffer, 512, "/ccapi/ringbuzzer?type=%i",snd);<br> | |||
send_CCAPI_request(_notify_buffer);<br> | |||
}<br> | |||
</code> | |||
Source : CCAPI && Webman Http requests for sprx - Jo-Milk | Source : CCAPI && Webman Http requests for sprx - Jo-Milk | ||
https//pastebin.com/RqnvPZ0j | https//pastebin.com/RqnvPZ0j | ||
== Use CCAPI Syscall from sprx == | |||
== Use CCAPI Syscall from | |||
CCAPI uses a unique PPC instruction that it implemented it. I named it "ccsc" as it works similarly to "sc" the syscall instruction in PPC. Here is the HEX value that represents "ccsc". | CCAPI uses a unique PPC instruction that it implemented it. I named it "ccsc" as it works similarly to "sc" the syscall instruction in PPC. Here is the HEX value that represents "ccsc". | ||
Line 285: | Line 328: | ||
} </code> | } </code> | ||
R3 or the first argument will be the value of the Command ID that will be processed by a kernel in a function implemented by CCAPI. | |||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
|- | |- | ||
! | ! Command ID !! Description !! Arguments | ||
|- | |- | ||
| | | 0x241 || {{cellcolors|#88ff88}} Enable CCAPI Syscalls || int32_t unk() | ||
|- | |- | ||
| | | 0x785 || {{cellcolors|#88ff88}} CCAPI Read ProcessMemory || int32_t CCAPIReadProcessMemory(int command_id, sys_pid_t pid, void* destination, void* source, size_t size) | ||
|- | |- | ||
| 0x123 || {{cellcolors|#88ff88}} Write | | 0x123 || {{cellcolors|#88ff88}} CCAPI Write ProcessMemory || int32_t CCAPIWriteProcessMemory(int command_id,sys_pid_t pid, void* destination, const void* source, size_t size) | ||
|- | |- | ||
| | | 0x357 || {{cellcolors|#88ff88}} CCAPI Create Process Thread || int32_t CCAPICreateProcessThread(int command_id,sys_pid_t pid, thread_t* thread, void* entry, uint64_t arg, int prio, size_t stacksize, const char* threadname) | ||
|- | |- | ||
| 0x977 || {{cellcolors|#88ff88}} CCAPI Allocate Page || int32_t CCAPIAllocatePage(int command_id,sys_pid_t pid, uint64_t size, uint64_t page_size, uint64_t flags, uint64_t is_executable, uint64_t* kernel_page_adr, uint64_t* game_page_adr) | |||
|} | |} | ||
Reference for this info : offset 0x448 ccapi.prx in ccapi 2.80 rev5 this is the function called to use ccsc(command id, ... ); | Reference for this info : offset 0x448 ccapi.prx in ccapi 2.80 rev5 this is the function called to use ccsc(command id, ... ); | ||
{{Reverse engineering}}<noinclude>[[Category:Main]]</noinclude> | {{Reverse engineering}}<noinclude>[[Category:Main]]</noinclude> |