Files
netris-nestri/protobufs/types.proto
Kristian Ollikainen d87a0b35dd feat: Fully use protobuf, fix controller issues and cleanup (#305)
## Description
### First commit
Restructured protobuf schemas to make them easier to use across
languages, switched to using them in-place of JSON for signaling as
well, so there's no 2 different message formats flying about. Few new
message types to deal with clients and nestri-servers better (not final
format, may see changes still).

General cleanup of dead/unused code along some bug squashing and package
updates.

TODO for future commits:
- [x] Fix additional controllers not doing inputs (possibly needs
vimputti changes)
- [x] ~~Restructure relay protocols code a bit, to reduce bloatiness of
the currently single file for them, more code re-use.~~
- Gonna keep this PR somewhat manageable without poking more at relay..
- [x] ~~Try to fix issue where with multiple clients, static stream
content causes video to freeze until there's some movement.~~
- Was caused by server tuned profile being `throughput-performance`,
causing CPU latency to be too high.
- [x] Ponder the orb


### Second + third commit
Redid the controller polling handling and fixed multi-controller
handling in vimputti and nestri code sides. Remove some dead relay code
as well to clean up the protocol source file, we'll revisit the meshing
functionality later.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added software rendering option and MangoHud runtime config;
controller sessions now support reconnection and batched state updates
with persistent session IDs.

* **Bug Fixes**
* Restored previously-filtered NES-like gamepads so they connect
correctly.

* **Chores**
* Modernized dependencies and protobuf tooling, migrated to
protobuf-based messaging and streaming, and removed obsolete CUDA build
steps.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DatCaptainHorse <DatCaptainHorse@users.noreply.github.com>
2025-11-08 13:10:28 +02:00

150 lines
3.4 KiB
Protocol Buffer

syntax = "proto3";
option go_package = "relay/internal/proto";
package proto;
/* Mouse messages */
// MouseMove message
message ProtoMouseMove {
int32 x = 1;
int32 y = 2;
}
// MouseMoveAbs message
message ProtoMouseMoveAbs {
int32 x = 1;
int32 y = 2;
}
// MouseWheel message
message ProtoMouseWheel {
int32 x = 1;
int32 y = 2;
}
// MouseKeyDown message
message ProtoMouseKeyDown {
int32 key = 1;
}
// MouseKeyUp message
message ProtoMouseKeyUp {
int32 key = 1;
}
/* Keyboard messages */
// KeyDown message
message ProtoKeyDown {
int32 key = 1;
}
// KeyUp message
message ProtoKeyUp {
int32 key = 1;
}
/* Controller messages */
// ControllerAttach message
message ProtoControllerAttach {
string id = 1; // One of the following enums: "ps", "xbox" or "switch"
int32 session_slot = 2; // Session specific slot number (0-3)
string session_id = 3; // Session ID of the client
}
// ControllerDetach message
message ProtoControllerDetach {
int32 session_slot = 1; // Session specific slot number (0-3)
string session_id = 2; // Session ID of the client
}
// ControllerRumble message
message ProtoControllerRumble {
int32 session_slot = 1; // Session specific slot number (0-3)
string session_id = 2; // Session ID of the client
int32 low_frequency = 3; // Low frequency rumble (0-65535)
int32 high_frequency = 4; // High frequency rumble (0-65535)
int32 duration = 5; // Duration in milliseconds
}
// ControllerStateBatch - single message containing full or partial controller state
message ProtoControllerStateBatch {
int32 session_slot = 1; // Session specific slot number (0-3)
string session_id = 2; // Session ID of the client
enum UpdateType {
FULL_STATE = 0; // Complete controller state
DELTA = 1; // Only changed fields
}
UpdateType update_type = 3;
// Sequence number for packet loss detection
uint32 sequence = 4;
// Button state map (Linux event codes)
map<int32, bool> button_changed_mask = 5;
// Analog inputs
optional int32 left_stick_x = 6; // -32768 to 32767
optional int32 left_stick_y = 7; // -32768 to 32767
optional int32 right_stick_x = 8; // -32768 to 32767
optional int32 right_stick_y = 9; // -32768 to 32767
optional int32 left_trigger = 10; // -32768 to 32767
optional int32 right_trigger = 11; // -32768 to 32767
optional int32 dpad_x = 12; // -1, 0, or 1
optional int32 dpad_y = 13; // -1, 0, or 1
// Bitmask indicating which fields have changed
// Bit 0: button_changed_mask, Bit 1: left_stick_x, Bit 2: left_stick_y, etc.
optional uint32 changed_fields = 14;
}
/* WebRTC + signaling */
message RTCIceCandidateInit {
string candidate = 1;
optional uint32 sdpMLineIndex = 2;
optional string sdpMid = 3;
optional string usernameFragment = 4;
}
message RTCSessionDescriptionInit {
string sdp = 1;
string type = 2;
}
// ProtoICE message
message ProtoICE {
RTCIceCandidateInit candidate = 1;
}
// ProtoSDP message
message ProtoSDP {
RTCSessionDescriptionInit sdp = 1;
}
// ProtoRaw message
message ProtoRaw {
string data = 1;
}
// ProtoClientRequestRoomStream message
message ProtoClientRequestRoomStream {
string room_name = 1;
string session_id = 2;
}
// ProtoClientDisconnected message
message ProtoClientDisconnected {
string session_id = 1;
repeated int32 controller_slots = 2;
}
// ProtoServerPushStream message
message ProtoServerPushStream {
string room_name = 1;
}