api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: AGPL-3.0 Imports: 68 Imported by: 0

Documentation

Overview

Package api is WittyPlay's own HTTP API (module API 5): the routes WittyMediaServer passes to it once it has checked who may call them, at /api/modules/wittyplay/... and at the server's own paths it takes over (integration.json, alias). It keeps its data in WittyPlay's own database (package store), and asks the server only what only the server knows, through the host API.

Moved from the server route group by route group (WittyMediaServer docs/plans/MODULAR-MODULES.md): controller layouts, controller profiles and the controller screen's background first.

Index

Constants

View Source
const DataEnv = "WITTYMODULE_DATA"

DataEnv is where the server says WittyPlay's own folder is.

Variables

This section is empty.

Functions

func Lifecycle

func Lifecycle(ctx context.Context, call string, args wittymodule.LifecycleArgs) error

Lifecycle answers the server's lifecycle calls (module API 5): WittyPlay's data starts with it, and goes when it is taken off unless the administrator keeps it.

func ReadyEmulator

func ReadyEmulator(offers []rpc.Offer) *rpc.Offer

ReadyEmulator is the first emulator ready to play a console here, or nil.

func Routes

func Routes(mux *http.ServeMux)

Routes adds the routes to a service's mux (service.Config.HTTP).

func SDUIItems

func SDUIItems(req sdui.ItemsRequest) (sdui.ItemsAnswer, error)

SDUIItems answers the server's sdui.items call for every WittyPlay source: the library and the store (sdui_store.go), WittyPlay Online's here, and the consoles (rpc.ConsoleItems) for the rest.

func ScanHooks

func ScanHooks() *service.ScanHooks

ScanHooks answers the server's scan calls (service.Config.Scan).

func StandaloneWords

func StandaloneWords(c *wittyplay.Console, offers []rpc.Offer) string

StandaloneWords says what a console with no core needs, when nothing is set up to play it.

func Watch

func Watch()

Watch follows the server's events while the service runs: an account that goes takes its layouts, profiles and picture with it, as the server's own tables did.

Types

type AchievementView

type AchievementView struct {
	ID          int    `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Points      int    `json:"points"`
	Badge       string `json:"badge"`
}

AchievementView is one achievement. Badge is this server's address for its greyed-out picture, "" if it has none.

type AchievementsAnswer

type AchievementsAnswer struct {
	State        string            `json:"state"`
	Game         *AchievementsGame `json:"game"`
	Achievements []AchievementView `json:"achievements"`
	Message      string            `json:"message"`
}

AchievementsAnswer is GET /items/{id}/achievements.

type AchievementsGame

type AchievementsGame struct {
	ID     int    `json:"id"`
	Title  string `json:"title"`
	URL    string `json:"url"`
	Points int    `json:"points"`
}

AchievementsGame is the game as RetroAchievements knows it.

type App

type App struct {
	DB   *store.DB
	Dir  string
	Host *host.Client
	Log  *slog.Logger
}

App is what the routes need: WittyPlay's database and folder, and the way back to the server.

func Get

func Get() (*App, error)

Get opens WittyPlay's database and reaches the server the first time something needs them.

func (*App) CheckCustomCore

func (a *App) CheckCustomCore(ctx context.Context, core *cores.Core) error

CheckCustomCore is the last thing between an approved file and a game starting. It reads the whole file, every time: on a low-end machine that's a moment against a game's load, and it's the promise this feature makes.

func (*App) CheckGame

func (a *App) CheckGame(ctx context.Context, it *service.Item, console *wittyplay.Console) map[string]any

CheckGame says what a game needs and whether this server has it, in time for its page to say so rather than the Play button finding out: GET /games/{id}/check's answer (ready, reason, message, bios, core, needsGpu, software, notice, runsOn, alternative, noBuild, emulator, file). A console this server doesn't know is {"ready": false, "reason": "unknown", "bios": []}.

func (*App) Config

func (a *App) Config(ctx context.Context, key string, v any) (bool, error)

Config reads a setting into v; false when it isn't set (v is left as it was).

func (*App) Configure

func (a *App) Configure(ctx context.Context) error

Configure sets how the next game runs (rpc.Mgr), with no restart needed for a new runner: the runner, FFmpeg and the hardware encoders the server found working (those switched on in hwEncoders go first), how many games at once, and the network settings.

func (*App) ConsoleOffers

func (a *App) ConsoleOffers(ctx context.Context) map[string][]rpc.Offer

ConsoleOffers are the standalone emulators set up for each console here; empty with them off.

func (*App) ConsoleViews

func (a *App) ConsoleViews(ctx context.Context) []ConsoleView

ConsoleViews are the consoles this server plays, with what it has for each: everything about them an administrator may see (hideCustom takes out what nobody else may).

func (*App) CoreStartFailed

func (a *App) CoreStartFailed(ctx context.Context, p *Plan, item int64, on host.On, err error)

CoreStartFailed writes down a core that failed to start a game: against the core, and in the server's audit log for a custom core.

func (*App) Cores

func (a *App) Cores() *cores.Manager

Cores is the cores on this machine: those installed here, RetroArch's, and approved custom cores while custom cores are on.

func (*App) CustomFor

func (a *App) CustomFor(ctx context.Context, console string) bool

CustomFor says whether an approved custom core has been assigned to a console. That is an administrator's choice to try it, which is what lifts a console's "not playable yet": they know more about their core than our table does.

func (*App) FindBIOSNear

func (a *App) FindBIOSNear(ctx context.Context, gamePath string)

FindBIOSNear looks beside a game, when it's checked or started.

func (*App) GPUMissing

func (a *App) GPUMissing(ctx context.Context) string

GPUMissing says why games drawn on a graphics card can't run on this server, or "" when they can, or may. The first time anything asks, the check starts in the background, and the answer counts from when it comes in, a second or two later.

func (*App) GPUStatus

func (a *App) GPUStatus(ctx context.Context) stream.GPUProbe

GPUStatus is what's known about the graphics card (the server's gpuStatus). Finding out takes a second or two, or half a minute if a security scanner holds the runner's first start, so it happens in the background and nothing waits for it. An answer about the card is final; a failure to ask gets asked again next time.

func (*App) NoteCorePlay

func (a *App) NoteCorePlay(ctx context.Context, core string, item int64, starts, failures int, seconds float64, lastErr string)

NoteCorePlay adds to what's known about a core on a game. Every core is counted, the table's too: it's how "works best" can mean something.

func (*App) PickCore

func (a *App) PickCore(ctx context.Context, console *wittyplay.Console, itemID int64) Pick

PickCore chooses a game's core (itemID 0 for a console's games in general). On a server without a graphics card it can use, a core that draws on one starts with the processor drawing, if it can; if not, it gives way to another installed core that needs no card, and then to one that can do without. When none can play it here, NoGPU says why, ahead of a missing BIOS or core: finding either would change nothing.

func (*App) PlanGame

func (a *App) PlanGame(ctx context.Context, it *service.Item) (*Plan, *Refusal)

PlanGame decides how a game starts on this machine: its console (404 when this server doesn't play it), whether that console plays here at all, the BIOS files beside it, which core, and that core's options, its region's BIOS and the cores to try next. A refusal is the answer to give. The game's file is the server's: it's read, never written.

func (*App) PlanOnly

func (a *App) PlanOnly(ctx context.Context, p *Plan, core cores.Core)

PlanOnly changes a plan to start on exactly this core, with nothing else to try: what a Satellaview game (Mesen-S) and a libdragon one (ParaLLEl N64) need, which no other core loads. It keeps the plan's software drawing, where the processor draws.

func (*App) PreferredCore

func (a *App) PreferredCore(ctx context.Context, console *wittyplay.Console, itemID int64) string

PreferredCore decides what to ask the cores for: this game's own choice, then the console's, then, when nothing in the table is here, the first custom core assigned to the console. Only cores from the table, or approved and assigned for this console, count, so no setting can reach a file nobody approved. "" asks for the first core here.

func (*App) PreferredCores

func (a *App) PreferredCores(ctx context.Context) map[string]string

PreferredCores is which core each console plays on unless a game says otherwise.

func (*App) Runner

func (a *App) Runner(ctx context.Context) (path string, args []string)

Runner is the program that runs a game here: WittyRetroArch when it's installed and the gamingRunner setting is auto or retroarch, else WittyPlay's own runner beside this program. Both speak the same protocol over pipes, so a GPL program runs as a separate process.

func (*App) SetConfig

func (a *App) SetConfig(ctx context.Context, key string, v any) error

SetConfig keeps a setting; nil removes it.

func (*App) StartOptions

func (a *App) StartOptions(ctx context.Context, consoleID, coreID string) map[string]string

StartOptions are the options a core starts a console's games with here: WittyPlay's own for it, at the resolution an administrator chose.

func (*App) SystemDir

func (a *App) SystemDir() string

SystemDir is the folder cores read BIOS files and their support files from (the server's <data>/gaming/system).

func (*App) WatchCorePlay

func (a *App) WatchCorePlay(sess *stream.Session, core *cores.Core, on host.On, item int64)

WatchCorePlay notes a game started on a core, waits for it to end and notes how it did. Run it in a goroutine once the game has started.

type ConsoleCapabilities

type ConsoleCapabilities struct {
	Screens ScreenCaps  `json:"screens"`
	Input   InputCaps   `json:"input"`
	Media   MediaCaps   `json:"media"`
	Play    PlayCaps    `json:"play"`
	Picture PictureCaps `json:"picture"`
}

ConsoleCapabilities is everything a game menu, a player and a controller screen build from.

type ConsoleView

type ConsoleView struct {
	wittyplay.Console
	Installed []cores.Core `json:"installed"`
	NeedsGPU  bool         `json:"needsGpu,omitempty"` // every core on offer draws with a graphics card
	GPUCores  []string     `json:"gpuCores,omitempty"`
	// For an administrator: approved custom cores assigned to it, and which core it uses unless a
	// game says otherwise.
	Custom      []cores.Core `json:"customCores,omitempty"`
	DefaultCore string       `json:"defaultCore,omitempty"`
	Ready       bool         `json:"ready"`
	// When it isn't ready: why, as a word (unavailable, core, gpu or emulator) and in words for
	// people. GPUMissing is the reason this server can't draw it, with reason gpu.
	Reason     string `json:"reason,omitempty"`
	Message    string `json:"message,omitempty"`
	GPUMissing string `json:"gpuMissing,omitempty"`
	// Software: the processor draws its games, and Notice says what that means for how they run.
	Software bool   `json:"software,omitempty"`
	Notice   string `json:"notice,omitempty"`
	// SoftwareWhy, with Software: no-card (this server has none games can use) or card-fault (it
	// has one, and the core draws wrongly on it on this system).
	SoftwareWhy string `json:"softwareWhy,omitempty"`
	// PlaysOn is the core Play starts its games on, unless a game has its own; BIOSMissing, with
	// none, is the BIOS file the core it wants is missing.
	PlaysOn     string `json:"playsOn,omitempty"`
	BIOSMissing string `json:"biosMissing,omitempty"`
	// CoreSupport is, for each core on offer, the server platforms it runs on and how it draws on
	// each, and here. CoreAbout is what each is good at beside the console's others.
	CoreSupport map[string]coreSupport `json:"coreSupport,omitempty"`
	CoreAbout   map[string]coreNote    `json:"coreAbout,omitempty"`
	Pad         wittyplay.PadLayout    `json:"pad"`
	// Count: with ?library=<id>, how many games that library holds for this console.
	Count int `json:"count,omitempty"`
	// Era, years, how its games come and what it can do.
	Era          string               `json:"era,omitempty"`
	Launched     int                  `json:"launched,omitempty"`
	Ended        int                  `json:"ended,omitempty"`
	Media        string               `json:"media,omitempty"`
	Capabilities *ConsoleCapabilities `json:"capabilities,omitempty"`
	Shelf        *ShelfLook           `json:"shelf,omitempty"` // its case and cartridge, for the games home
	// For Settings, Consoles & cores: BIOS files in place, what's stopping it from starting if
	// that's a missing BIOS, and how many games every library holds for it.
	BiosFound  []string       `json:"biosFound,omitempty"`
	BiosFiles  []biosFileView `json:"biosFiles,omitempty"` // in the system folder, and where each came from
	Blocked    string         `json:"blocked,omitempty"`
	TotalGames int            `json:"totalGames,omitempty"`
	// LogoName is the name to ask the logo service for, kind "console".
	LogoName string `json:"logoName,omitempty"`
	// Emulators are the standalone emulators set up to play it here, and Standalone the one Play
	// starts when no core plays it.
	Emulators  []rpc.Offer `json:"standaloneEmulators,omitempty"`
	Standalone string      `json:"standalone,omitempty"`
}

ConsoleView is a console with what this server has for it.

type CorePickOption

type CorePickOption struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

CorePickOption is something to choose from a list.

type CorePlays

type CorePlays struct {
	Starts    int     `json:"starts"`
	Failures  int     `json:"failures"`
	Seconds   float64 `json:"seconds"`
	LastError string  `json:"lastError,omitempty"`
	LastAt    int64   `json:"lastAt,omitempty"`
}

CorePlays is how a core has really gone, across every game played with it.

type CoreReport

type CoreReport struct {
	ID            string           `json:"id"` // the name this server would use
	File          string           `json:"file"`
	Size          int64            `json:"size"`
	SHA256        string           `json:"sha256"`
	Binary        cores.Binary     `json:"binary"`
	Arch          string           `json:"arch"`
	Name          string           `json:"name"`
	Version       string           `json:"version"`
	Extensions    []string         `json:"extensions"`
	NeedFullPath  bool             `json:"needFullPath,omitempty"`
	BlockExtract  bool             `json:"blockExtract,omitempty"`
	NoGame        bool             `json:"noGame,omitempty"`
	Options       int              `json:"options,omitempty"`
	NeedsGPU      string           `json:"needsGpu"` // yes | maybe | no
	GPUWhy        string           `json:"gpuWhy,omitempty"`
	BIOS          []cores.Firmware `json:"bios"`
	BIOSKnown     bool             `json:"biosKnown"` // an info file said which, so its absence means something
	License       string           `json:"license"`
	LicenseSource string           `json:"licenseSource,omitempty"` // info | table
	NonCommercial bool             `json:"nonCommercial,omitempty"`
	HasInfo       bool             `json:"hasInfo,omitempty"`
	System        string           `json:"system,omitempty"` // the system its info file names
	Notes         string           `json:"notes,omitempty"`
	Assets        int              `json:"assets,omitempty"`
	SystemFiles   int              `json:"systemFiles,omitempty"`
	Ignored       []string         `json:"ignored,omitempty"`
	SandboxNote   string           `json:"sandboxNote,omitempty"`
	Warnings      []string         `json:"warnings"`
	Consoles      []string         `json:"consoles"` // consoles its extensions say it may be for
	Source        string           `json:"source"`
	SourceURL     string           `json:"sourceUrl,omitempty"`
}

CoreReport is what a test-load and the file's own headers said. Everything in it came from the file, so it's shown as what the core says, never as fact.

type CoreVersion

type CoreVersion struct {
	SHA256  string `json:"sha256"`
	Version string `json:"version"`
	AddedAt int64  `json:"addedAt"`
	Current bool   `json:"current"`
}

CoreVersion is a version kept for going back to.

type CustomConsoleView

type CustomConsoleView struct {
	wittyplay.CustomConsole
	Games     int `json:"games"`
	Libraries int `json:"libraries"`
}

CustomConsoleView is a custom console as it can be edited or exported.

type CustomCore

type CustomCore struct {
	ID            string              `json:"id"`
	Name          string              `json:"name"`
	Version       string              `json:"version"`
	SHA256        string              `json:"sha256"`
	Size          int64               `json:"size"`
	License       string              `json:"license"`
	LicenseSource string              `json:"licenseSource,omitempty"` // info | table | admin
	NonCommercial bool                `json:"nonCommercial,omitempty"`
	Consoles      []string            `json:"consoles"`
	DefaultFor    []string            `json:"defaultFor"`
	Note          string              `json:"note,omitempty"`
	Source        string              `json:"source"`
	SourceURL     string              `json:"sourceUrl,omitempty"`
	AddedBy       string              `json:"addedBy"`
	AddedAt       int64               `json:"addedAt"`
	UpdatedAt     int64               `json:"updatedAt"`
	Report        CoreReport          `json:"report"`
	State         cores.CoreFileState `json:"state"`
	Versions      []CoreVersion       `json:"versions"`
	Plays         CorePlays           `json:"plays"`
	Running       int                 `json:"running"`
	// contains filtered or unexported fields
}

CustomCore is a core somebody approved, as the settings page sees it.

type CustomStatus

type CustomStatus struct {
	Enabled     bool                `json:"enabled"`
	Locked      bool                `json:"locked,omitempty"`
	CanEnable   bool                `json:"canEnable"`
	NeedsSwitch bool                `json:"needsSwitch"` // not allowed on the machine yet
	Sandbox     string              `json:"sandbox"`
	HaveRunner  bool                `json:"haveRunner"`
	Platform    string              `json:"platform"`
	LibraryExt  string              `json:"libraryExt"`
	MaxUploadMB int64               `json:"maxUploadMB"`
	CoresDir    string              `json:"coresDir"`
	SystemDir   string              `json:"systemDir"`
	Cores       []*CustomCore       `json:"cores"`
	Consoles    []CustomConsoleView `json:"consoles"`
	Placed      []cores.PlacedFile  `json:"placed"`
	// Audit is WittyPlay's rows of the server's audit log (custom cores, refused passwords), newest first.
	Audit      []host.AuditRow  `json:"audit"`
	PadChoices []CorePickOption `json:"padChoices"`
	OtherCores []CorePickOption `json:"otherCores"` // cores already here a custom console could use
}

CustomStatus is everything the settings page needs for this section.

type GameBackground

type GameBackground struct {
	Version int64  `json:"version"` // 0 when there's no picture; changes with each new one
	Fit     string `json:"fit"`     // cover | contain
	X       int    `json:"x"`
	Y       int    `json:"y"`
	Dim     int    `json:"dim"`
}

GameBackground is how a person's picture sits behind their controller screen.

type GameBezel

type GameBezel struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Size      int64  `json:"size"`
	CreatedAt int64  `json:"createdAt"`
}

GameBezel is an image of a person's own for around the picture.

type GamePatch

type GamePatch struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Kind      string `json:"kind"` // ips | bps
	Size      int64  `json:"size"`
	Enabled   bool   `json:"enabled"`
	CreatedAt int64  `json:"createdAt"`
}

GamePatch is a patch file of a person's own for one game.

type GamePersonal

type GamePersonal struct {
	Favourite  bool              `json:"favourite"`
	Note       string            `json:"note"`
	Plays      int               `json:"plays"`
	LastPlayed int64             `json:"lastPlayed"` // seconds since 1970; 0 for never
	Cheats     []wittyplay.Cheat `json:"cheats"`
	HasBattery bool              `json:"hasBattery"` // it has a battery save to download
}

GamePersonal is what a person keeps about one game.

type InputCaps

type InputCaps struct {
	Ports          int  `json:"ports"`
	Multitap       int  `json:"multitap,omitempty"` // how many players with an adapter
	Sticks         int  `json:"sticks,omitempty"`
	AnalogTriggers bool `json:"analogTriggers,omitempty"`
	Touch          bool `json:"touch,omitempty"` // a touch screen: pointer states go to it
	LightGun       bool `json:"lightGun,omitempty"`
	Mouse          bool `json:"mouse,omitempty"`
	Motion         bool `json:"motion,omitempty"`
	Keyboard       bool `json:"keyboard,omitempty"`
	Mic            bool `json:"mic,omitempty"`
}

InputCaps: what a player can hold. The console's own buttons are in its pad (GET /consoles/{id}/controls).

type MediaCaps

type MediaCaps struct {
	Discs       bool `json:"discs,omitempty"` // games can come on several discs, changed from the game menu
	MemoryCards int  `json:"memoryCards,omitempty"`
	// BIOS is none, optional or required, from the console's list of BIOS files.
	BIOS string `json:"bios"`
	// Region is the core option that picks the console's region, by core ID.
	Region map[string]string `json:"region,omitempty"`
}

MediaCaps: discs, memory cards, BIOS and region.

type Pick

type Pick struct {
	Core     *cores.Core // what it starts on, or nil
	Software bool        // it draws on a graphics card, which this server hasn't got or draws it wrongly on, so the processor draws it
	Notice   string      // with Software: the speed caveat, and why
	Blocked  *cores.Core // with no Core: the one wanted, which is missing a BIOS
	NoGPU    string      // with no Core: why what could play it can't draw on this server
}

Pick is the core a game would start on, as pressing Play chooses it.

type PictureCaps

type PictureCaps struct {
	Aspect  string `json:"aspect"`
	Integer bool   `json:"integer,omitempty"` // whole-pixel scaling suits it
	// Look is the display preset a console starts with until someone chooses: Clean,
	// Scanlines or Handheld LCD (GET /games/settings/schema, presets).
	Look string `json:"look"`
}

PictureCaps: the picture's shape and the Look it starts with.

type Plan

type Plan struct {
	Console  *wittyplay.Console
	Core     *cores.Core // nil for the test console
	CorePath string      // the core's library, or ipc.TestCore
	CoreID   string      // "test" for the test console
	GPU      bool        // it draws on the graphics card
	// Software: it draws on a graphics card, which this server hasn't got or draws wrongly on, so
	// the processor draws it: CPUOptions go over every other option, whoever chose them, or the
	// core asks for a card that isn't there.
	Software    bool
	CPUOptions  map[string]string
	Notices     []string
	RunnerArgs  []string
	CoreOptions map[string]string
	// Fallbacks are the console's other cores, tried in turn if the game won't load on this one.
	Fallbacks []stream.CoreChoice
	SystemDir string
	// A custom core's assets, and longer to load: a virus scanner may look again at a file that
	// has only just moved here.
	CoreAssets string
	LoadLimit  time.Duration
}

Plan is what a game starts with here. Put it into stream.Options: Core (CorePath), CoreID, GPU, RunnerArgs, CoreOptions (with anyone's own options laid over), Fallbacks, SystemDir, CoreAssets and LoadLimit; add Notices; and with Software, lay CPUOptions over everything last.

type PlayCaps

type PlayCaps struct {
	Rumble bool `json:"rumble,omitempty"`
	// RewindByDefault: rewind is on for these games unless someone turns it off. A console's
	// states have to be small enough to keep 20 seconds of them in the memory an
	// administrator allows (gamingRewindMB).
	RewindByDefault bool `json:"rewindByDefault,omitempty"`
}

PlayCaps: what a game menu can offer while playing.

type Presence

type Presence struct {
	Playing bool `json:"sharePlaying"`
	Online  bool `json:"appearOnline"`
}

Presence is what a profile lets its friends know: what it plays (Playing), and whether it's here at all (Online). Someone who isn't online is offline to everyone, playing or not; someone who doesn't share what they play is shown online, with no game.

type Refusal

type Refusal struct {
	Status int
	Body   map[string]any
}

Refusal is why a game can't start or be got ready here: the status and the JSON answer the server gave ({"error": "...", and needBios, needCore, reason gpu and the like}).

func GPURefusal

func GPURefusal(console *wittyplay.Console, why string) *Refusal

GPURefusal is the answer to a request for a game that can't draw here, and why.

func StartRefusal

func StartRefusal(console *wittyplay.Console, err error) *Refusal

StartRefusal is the answer when a game's runner said, starting it, that there's no graphics card it can use; nil for any other failure.

func (*Refusal) Error

func (r *Refusal) Error() string

func (*Refusal) Write

func (r *Refusal) Write(w http.ResponseWriter)

Write answers with the refusal.

type ScreenCaps

type ScreenCaps struct {
	Count int `json:"count"`
	// Touch is the screen that takes touch, counted from 1, or 0 for none.
	Touch int `json:"touch,omitempty"`
	// Layouts a client can offer, in order: stacked, side, big (one big, the other small),
	// single (one at a time).
	Layouts []string `json:"layouts,omitempty"`
	// Options are how each core sets those layouts, by core ID.
	Options map[string]ScreenOptions `json:"options,omitempty"`
	// Frame is where each screen is in a frame of the stacked layout the core is started in, as
	// fractions of the frame, so a client can draw each where the person placed it (Edit layout).
	Frame []ScreenRect `json:"frame,omitempty"`
}

ScreenCaps: one screen, or two (DS, 3DS), and how two can be arranged.

type ScreenOptions

type ScreenOptions struct {
	Layout     string               `json:"layout"`
	Values     map[string][2]string `json:"values"`
	Swap       string               `json:"swap,omitempty"`
	SwapValues *[2]string           `json:"swapValues,omitempty"`
}

ScreenOptions: the core option that picks a layout, and the value for each of ours, as it is and with the two screens swapped. A core that swaps with an option of its own names that too.

type ScreenRect

type ScreenRect struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	W float64 `json:"w"`
	H float64 `json:"h"`
}

ScreenRect is one screen's part of a frame.

type ShelfLook

type ShelfLook struct {
	Case ShelfShape `json:"case"`
	Cart ShelfShape `json:"cart"`
}

ShelfLook is how a console's games stand on a shelf: its case, and its cartridge or disc, as shapes a client draws itself around the game's own cover. They follow the console's real forms in proportion and material (a cardboard box, a plastic clamshell, a CD jewel case, a DVD-style keep case, a cartridge, a card, a disc), never a maker's banners, logos, colours or exact outline.

type ShelfShape

type ShelfShape struct {
	Kind   string  `json:"kind"`
	Aspect float64 `json:"aspect"`
	Height float64 `json:"height"`
}

ShelfShape: Kind is what it is; Aspect its front's width over height; Height how tall it stands beside the others of its kind (a full-size box or keep case is 1, a handheld's box about 0.6).

Jump to

Keyboard shortcuts

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