-
-
Notifications
You must be signed in to change notification settings - Fork 201
[Suggestion] JSON version of the web PS3MAPI #1180
Description
Hello, so I have been using the PS3MAPI from the HTTP server.
Unlike the PS3MAPI server, it can be used in webpages, so in phones.
The ability to remotely control the console from a browser or a phone is something I find very powerful and easier. (No need to make an entire application to set 3 bytes)
But it is not adapted for this purpose, and it is very slow.
Here is a function I made to get the memory.
async get_mem(process_id, offset, bytes) {
try {
let req = await fetch(`http://${this.ip}/getmem.ps3mapi?proc=0x${process_id}&addr=${offset.toString(16)}&len=${bytes}`);
return (await req.text()).match(/style="display:none">[0-9A-F]{2,}</)[0].replace(`style="display:none">`,"").replace("<","").match(/[0-9A-F]{2,2}/g).map(v=>parseInt(v,16));
}
catch(e) {
console.warn(e);
return false;
}
}When the HTTP server receives the request, it performs the requested action, then builds a full html page and sends it to the client.
Then I need to extract a tiny bit of the whole response. A lot of time and resource is lost.
So here I make my suggestion :
An HTTP version of PS3MAPI or a new param (like ?json=1) that return json instead of html.
Responses could look like this:
{"start":"22267FD","end":"22267FF","bytes":[123,0,56],"step":1,"success":true} / get memory /
{"processes":[{"name":"...","id":"1090200"},{"name":"...","id":"1030200"}],"success":true} / get processes /
{"success":true} / set memory, beep, notify, etc. /
{"error":500,"success":false} / server error, invalid process id, invalid offset etc. /It's still a big suggestion in term of work so I would understand if it's discarded.
If there is an alternative that I'm not aware, I'll close the issue.
(edit: also is it possible to exceed the 256 bytes length limit of write/read ?)