rvglutils

package module
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 12 Imported by: 0

README

rvgl-utils CI godoc goreportcard

Tools for tracking scores in RVGL sessions.

Install

From a release.

Using brew:

brew install frantjc/tap/forge

Using go:

go install github.com/frantjc/forge/cmd/forge

From source:

git clone https://github.com/frantjc/rvgl-utils
cd rvgl-utils
go install ./cmd/rvglsm

Use

Launch rvgl with the -sessionlog parameter.

Example

Start or join a multiplayer game in RVGL. This begins a session.

Now, run rvglsm:

rvglsm

This will watch for updates to the session from RVGL and write them to the "sink," which is stdout by default. RVGL seems to update the session when a new race is selected after the previous one is finished.

rvglsm can write updates to different destinations. As of writing, Discord is the only additional supported sink:

rvglsm --sink {webhook_url}

Where {webhook_url} is a Discord webhook URL like https://discordapp.com/api/webhooks/{webhook_id}/{webhook_token}[/messages/{message_id}].

If you use a custom -prefpath with rvgl, you'll have to tell rvglsm about it, too:

rvglsm --prefpath {-prefpath}

For a full list of available flags:

rvglsm --help
Usage:
  rvglsm [flags]

Flags:
  -x, --exclude count          Number of races at the beginning of the session to exclude
  -H, --handicap stringToInt   Handicap to apply (default [])
  -h, --help                   Help for rvglsm
      --include-ai             Score AI players
      --prefpath string        RVGL -prefpath to search for the session in
      --session string         Name of the session to resolve instead of using the latest one
  -s, --sink string            URL of the sink to send updates to (e.g. a Discord webhook URL)
      --version                Version for rvglsm

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FlatpakPrefPath = func() string {
		home, err := os.UserHomeDir()
		if err != nil {
			panic(err)
		}
		return filepath.Join(home, ".var", "app", "org.rvgl.rvmm/data/rvmm/save")
	}()
	SystemPrefPath = func() string {
		home, err := os.UserHomeDir()
		if err != nil {
			panic(err)
		}
		return filepath.Join(home, ".local", "share", "RVGL")
	}()
	DefaultPrefPathList = func() string {
		return strings.Join([]string{SystemPrefPath, FlatpakPrefPath}, string(os.PathListSeparator))
	}()
)

Functions

func RegisterSink

func RegisterSink(o SinkOpener, scheme string, schemes ...string)

func ResolveSessionCSV

func ResolveSessionCSV(opts ...ResolveSessionCSVOpt) (string, error)

Types

type Race

type Race struct {
	Track   string
	Results []Result
}

type ResolveSessionCSVOpt

type ResolveSessionCSVOpt interface {
	Apply(*ResolveSessionCSVOpts)
}

type ResolveSessionCSVOpts

type ResolveSessionCSVOpts struct {
	Time     time.Time
	Name     string
	PathList string
}

func (*ResolveSessionCSVOpts) Apply

type Result

type Result struct {
	Position int
	Player   string
	Car      string
	Time     time.Duration
	BestLap  time.Duration
	Finished bool
	Cheating bool
}

type Score

type Score struct {
	Player string
	Points int
}

func ScoreSession

func ScoreSession(session *Session, opts ...ScoreSessionOpt) []Score

type ScoreSessionOpt

type ScoreSessionOpt interface {
	Apply(*ScoreSessionOpts)
}

type ScoreSessionOpts

type ScoreSessionOpts struct {
	IncludeAI    bool
	ExcludeRaces int
	Handicap     map[string]int
}

func (*ScoreSessionOpts) Apply

func (o *ScoreSessionOpts) Apply(opts *ScoreSessionOpts)

type Session

type Session struct {
	Version string
	Date    time.Time
	Host    string
	Mode    string
	Laps    int
	AI      bool
	Races   []Race
}

func DecodeSessionCSV

func DecodeSessionCSV(r io.Reader) (*Session, error)

type Sink

type Sink interface {
	UpdateSession(context.Context, *Session, ...UpdateSessionOpt) error
}

func OpenSink

func OpenSink(ctx context.Context, s string) (Sink, error)

type SinkOpener

type SinkOpener interface {
	Open(context.Context, *url.URL) (Sink, error)
}

type UpdateSessionOpt added in v0.2.0

type UpdateSessionOpt interface {
	Apply(*UpdateSessionOpts)
}

type UpdateSessionOpts added in v0.2.0

type UpdateSessionOpts struct {
	Final            bool
	ScoreSessionOpts *ScoreSessionOpts
}

func (*UpdateSessionOpts) Apply added in v0.2.0

func (o *UpdateSessionOpts) Apply(opts *UpdateSessionOpts)

Directories

Path Synopsis
cmd
rvglsm command
sinks

Jump to

Keyboard shortcuts

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