Documentation
¶
Overview ¶
Package psremote plays a PlayStation 4 or 5 on the home network through Matinee, with Remote Play: matinee-psremote (games/psremote, built on chiaki-ng) pairs with the console and receives its picture and sound, and this package turns them into the RTP packets the game stream sends on to players (see gamestream.Remote). The stream stays between the console, the server and the player, on the home network: it never goes through Sony's servers or anyone else's. Only pairing talks to Sony, once, to learn the player's PSN account ID (psn.go).
Index ¶
- Constants
- Variables
- func AccountID(s string) (string, error)
- func AccountIDFromUserID(id uint64) string
- func CheckHost(host string) error
- func CodeFromRedirect(s string) (string, error)
- func SignIn(ctx context.Context, client *http.Client, code string) (string, error)
- func SignInURL() string
- type Bridge
- func (b *Bridge) Available() bool
- func (b *Bridge) Pair(ctx context.Context, host string, ps5 bool, account, pin string) (Console, error)
- func (b *Bridge) Play(ctx context.Context, c Console, account string, height, fps int, ...) (*Stream, error)
- func (b *Bridge) Status(ctx context.Context, host string) (Status, error)
- func (b *Bridge) Wake(ctx context.Context, c Console) error
- func (b *Bridge) WakeAndWait(ctx context.Context, c Console) error
- type Console
- type Hello
- type Status
- type Stream
Constants ¶
const ( KindVideo = 0x10 KindAudio = 0x11 )
Packet kinds, as the game stream's (gamehost.KindVideo and KindAudio).
Variables ¶
var ErrNoAnswer = errors.New("no PlayStation answered at that address")
ErrNoAnswer means no PlayStation answered at that address: it's off, unplugged, or the address is wrong.
Functions ¶
func AccountID ¶
AccountID turns a PSN account ID as people paste it (base64, as Sony's pages and other Remote Play apps show it, or 16 hex digits) into hex.
func AccountIDFromUserID ¶
AccountIDFromUserID is the account ID of a PSN user id, the number Sony's sign-in gives: its 8 bytes, little-endian.
func CheckHost ¶
CheckHost says whether host is an address on the home network, so the server never sends Remote Play anywhere else.
func CodeFromRedirect ¶
CodeFromRedirect finds the one-time code in the address Sony's page ended on.
Types ¶
type Bridge ¶
type Bridge struct {
// Path is matinee-psremote's.
Path string
}
Bridge runs matinee-psremote.
func (*Bridge) Pair ¶
func (b *Bridge) Pair(ctx context.Context, host string, ps5 bool, account, pin string) (Console, error)
Pair pairs with the console at host, with the code it shows under Settings → System → Remote Play → Pair Device (PS5), or Settings → Remote Play Connection Settings → Add Device (PS4). account is the PSN account ID, in hex (see AccountID).
func (*Bridge) Play ¶
func (b *Bridge) Play(ctx context.Context, c Console, account string, height, fps int, log *slog.Logger) (*Stream, error)
Play connects to the console and waits until its stream starts. The console must be on (see WakeAndWait). height is 1080, 720 or 540 (a PS4 that isn't a Pro sends 720 at most); fps 60 or 30.
type Console ¶
type Console struct {
ID string `json:"id"`
Name string `json:"name"`
// Host is its address on the home network.
Host string `json:"host"`
PS5 bool `json:"ps5"`
MAC string `json:"mac,omitempty"`
// What pairing gave, which Remote Play needs: 32 hex digits each.
RegistKey string `json:"registKey"`
RPKey string `json:"rpKey"`
Target int `json:"target,omitempty"`
}
Console is a paired PlayStation.
type Status ¶
type Status struct {
// State is "ready" (on) or "standby" (in rest mode).
State string `json:"state"`
Name string `json:"name"`
PS5 bool `json:"ps5"`
// App is the game or app it's running, when it's on.
App string `json:"app,omitempty"`
}
Status is what a console says about itself.
type Stream ¶
type Stream struct {
Hello Hello
// contains filtered or unexported fields
}
Stream is a console being played: its picture and sound as RTP packets, and the player's controller back to it.
func (*Stream) Input ¶
Input takes the player's input messages (see gamestream.Session.input): the first controller's buttons and sticks.