mirror of
https://github.com/MoHadiShibli/remotePad-ng.git
synced 2026-10-17 10:01:02 +02:00
RemotePad NG 1.0.0, a maintained fork of remotePad 1.2.0 by xfangfang. Fixes: - Input lag that grew to seconds in games that read one sample per frame: stick-only updates now replace the newest unread sample, presses and releases still get their own (xfangfang/remotePad#7). - Crashes: the notify RPC used client text as a format string, a heap overflow in the ini parser, a too small server thread stack, unload crashes and leaks, a startup race, unchecked buffers from games (xfangfang/remotePad#9). - Hex user ids were read as decimal, so several pads got the wrong users (xfangfang/remotePad#2). - scePadRead returned shifted data with more than one queued sample; held buttons looked released between updates; buttons stayed pressed when a client went away. - Lowercase "connection: upgrade" headers were refused; TCP_NODELAY. - ini parsing: section order, UTF-8 BOM, "]" in values. New: - Settings module: everything the page can change is applied live and saved to remote_pad.ini, for all games or one game; lock_settings=1. - Guests join when a device picks their pad, and pads look connected only while a device drives them (join_on_start / always_connected restore the old behavior). - Configured PS4 users who aren't signed in play as guests. - Share mode (userN_share): add a pad to a user's own DualShock. - WebSocket protocol 2: claim, leave, status, settings, settings.set and live status notifications; protocol 1 clients keep working. - Network security: pages from other sites are refused, settings and notifications need the console's own page opened by IP address (or a non-browser client), at most 16 connections and 64 KB buffered per connection, and the page is served with a content security policy. - Clearer start notification with the address to open; logs go to the kernel log; guests are named after their pad (Remote1..4).
61 lines
2.0 KiB
C
61 lines
2.0 KiB
C
#include <Common.h>
|
|
#include <stdbool.h>
|
|
|
|
#define GOLDHEN_PATH "/data/GoldHEN"
|
|
|
|
#define TEX_ICON_SYSTEM "cxml://psnotification/tex_icon_system"
|
|
#define MAX_PATH_ 260
|
|
|
|
#define STR_IMPL(x) #x
|
|
#define STR(x) STR_IMPL(x)
|
|
|
|
#define attr_module_hidden __attribute__((weak)) __attribute__((visibility("hidden")))
|
|
#define attr_public __attribute__((visibility("default")))
|
|
|
|
// printf, plus a copy straight to the kernel log (GoldHEN's klog server) for when the TTY redirect is off
|
|
void log_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
|
|
|
#if (__FINAL__) == 1
|
|
#define BUILD_TYPE "(Release)"
|
|
#define debug_printf(a, args...)
|
|
#else
|
|
#define BUILD_TYPE "(Debug)"
|
|
#define debug_printf(a, args...) log_printf("[%s] (%s:%d) " a, __func__,__FILE__, __LINE__, ##args)
|
|
#endif
|
|
|
|
#define HOOK_DEFINE(func, ...) \
|
|
HOOK_INIT(func); \
|
|
typedef int32_t (*func##_def)(__VA_ARGS__); \
|
|
int32_t func(__VA_ARGS__); \
|
|
int32_t func##_hook(__VA_ARGS__)
|
|
|
|
#define HOOK_PASS(func, ...) \
|
|
HOOK_CONTINUE(func, func##_def, __VA_ARGS__)
|
|
|
|
#ifndef SCE_OK
|
|
#define SCE_OK 0
|
|
#endif
|
|
|
|
#define final_printf(a, args...) log_printf("[remote_pad] (%s:%d) " a, __FILE__, __LINE__, ##args)
|
|
|
|
#define print_proc_info() {\
|
|
final_printf("process info\n");\
|
|
final_printf("pid: %d\n", procInfo.pid);\
|
|
final_printf("name: %s\n", procInfo.name);\
|
|
final_printf("path: %s\n", procInfo.path);\
|
|
final_printf("titleid: %s\n", procInfo.titleid);\
|
|
final_printf("contentid: %s\n", procInfo.contentid);\
|
|
final_printf("version: %s\n", procInfo.version);\
|
|
final_printf("base_address: 0x%lx\n", procInfo.base_address);\
|
|
}
|
|
|
|
void Notify(const char* IconUri, const char *FMT, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
int32_t load_prx(const char *name, bool syscall);
|
|
|
|
// Takes hardcoded input string 2 to strlen against during compile time.
|
|
// startsWith(input_1, "input 2");
|
|
#define startsWith(str1, str2) (strncmp(str1, str2, __builtin_strlen(str2)) == 0)
|
|
|
|
bool file_exists(const char *filename);
|