mirror of
https://github.com/MoHadiShibli/remotePad-ng.git
synced 2026-10-17 18:02:46 +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).
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#ifndef REMOTE_PAD_COMMON_DATA_H
|
|
#define REMOTE_PAD_COMMON_DATA_H
|
|
|
|
typedef struct circularBuf {
|
|
uint32_t head;
|
|
uint32_t tail;
|
|
uint32_t dataSize;
|
|
uint32_t maxHistory;
|
|
|
|
void (*clearData)(void *);
|
|
|
|
char data[];
|
|
} circularBuf;
|
|
|
|
void *getDatePtr(circularBuf *buf, uint32_t index);
|
|
|
|
int initData(circularBuf **buf, uint32_t dataSize, uint32_t maxHistory, void (*emptyData)(void *));
|
|
|
|
void termData(circularBuf *buf);
|
|
|
|
// Drop all queued items; the latest item becomes the empty item
|
|
void resetData(circularBuf *buf);
|
|
|
|
// Queue an item. When the queue is full the oldest queued item is dropped.
|
|
void pushData(circularBuf *buf, const void *data);
|
|
|
|
// The newest queued item (not read yet), to update in place; NULL when nothing is queued
|
|
void *peekNewestData(circularBuf *buf);
|
|
|
|
void getLatestData(circularBuf *buf, void *data);
|
|
|
|
// Copy up to `count` queued items (oldest first) and consume them. Returns the number copied, 0 when nothing is queued.
|
|
int32_t getData(circularBuf *buf, void *data, int32_t count);
|
|
|
|
#endif //REMOTE_PAD_COMMON_DATA_H
|