plugging

package
v0.35.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package plugging conceptualises the act of plugging devices into the VCS ports. This includes the panel in addition to the various peripherals that plug into the player ports (ie. controllers, savekey, etc.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitorable

type Monitorable interface {
	AttachPlugMonitor(m PlugMonitor)
}

Monitorable implementations are capable of having a PlugMonitor attached to it. The VCS Ports themselves are monitorable but we also use this mechanism in the "auto" controller type and in the future, devices like the Quadtari will be implemented similarly.

It is expected that such implementations will call PlugMonitor.Plugged() as required. Note that PlugMonitor.Plugged() should not be called on the event of AttachPlugMonitor except in the special case of the ports.Ports type

Implementations of Monitorable should also test peripherals that are daisy-chained and call AttachPlusMonitor() as appropriate.

if a, ok := periph.daisychain.(pluggin.Monitorable); ok {
	a.AttachPlugMonitor(m)
}

type PeripheralID added in v0.14.0

type PeripheralID string

PeripheralID identifies the class of device a Peripheral implemenation represents.

const (
	PeriphNone     PeripheralID = "None"
	PeriphPanel    PeripheralID = "Panel"
	PeriphStick    PeripheralID = "Stick"
	PeriphGamepad  PeripheralID = "Gamepad"
	PeriphPaddles  PeripheralID = "Paddles"
	PeriphKeypad   PeripheralID = "Keypad"
	PeriphSavekey  PeripheralID = "Savekey"
	PeriphAtariVox PeripheralID = "AtariVox"
)

List of valid PeripheralID values.

type PlugMonitor

type PlugMonitor interface {
	Plugged(port PortID, peripheral PeripheralID)
}

PlugMonitor interface implementations will be notified of newly plugged peripherals.

type PortID

type PortID string

PortID differentiates the different ports in the VCS into which peripherals can be plugged.

const (
	PortUnplugged PortID = "Unplugged"
	PortLeft      PortID = "Left"
	PortRight     PortID = "Right"
	PortPanel     PortID = "Panel"
)

List of defined PortIDs. These refer to the physical ports at the back of the console. In the case of paired paddles, two paddles use a single player port so thinking of these ports as left and right "players" might be misleading. So long as restrict our thinking to left and right "ports" we're okay.

Also, "left" and "right" are from the point of view of somebody using the console normally (ie. the ports are at the back of the console)

Similarly, in the case of devices like the Quadtari, many players can be plugged into a single port

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL