rvglutils

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 16 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 EncodeSettingsINI added in v0.5.0

func EncodeSettingsINI(w io.Writer, v any) error

func RegisterSink

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

func ResolveSessionCSV

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

func ResolveSettingsINI added in v0.5.0

func ResolveSettingsINI(opts ...ResolveSettingsINIOpt) (string, error)

Types

type AudioSettings added in v0.5.0

type AudioSettings struct {
	SfxVol      int `toml:"SfxVol" ini:"SfxVol"`
	MusicVol    int `toml:"MusicVol" ini:"MusicVol"`
	SfxChannels int `toml:"SfxChannels" ini:"SfxChannels"`
	SampleRate  int `toml:"SampleRate" ini:"SampleRate"`
	MusicOn     int `toml:"MusicOn" ini:"MusicOn"`
}

type EditorSettings added in v0.5.0

type EditorSettings struct {
	LegacyCameraControls int `toml:"LegacyCameraControls" ini:"LegacyCameraControls"`
	LegacyEditorControls int `toml:"LegacyEditorControls" ini:"LegacyEditorControls"`
}

type MiscSettings added in v0.5.0

type MiscSettings struct {
	UseProfiles    int    `toml:"UseProfiles" ini:"UseProfiles"`
	DefaultProfile string `toml:"DefaultProfile" ini:"DefaultProfile"`
	Frontend       string `toml:"Frontend" ini:"Frontend"`
	Version        string `toml:"Version" ini:"Version"`
}

type NetworkSettings added in v0.5.0

type NetworkSettings struct {
	HostComputer string `toml:"HostComputer" ini:"HostComputer"`
	LocalPort    int    `toml:"LocalPort" ini:"LocalPort"`
	DiscordRPC   int    `toml:"DiscordRPC" ini:"DiscordRPC"`
}

type ProfileControllerSettings added in v0.5.0

type ProfileControllerSettings struct {
	Joystick          int    `toml:"Joystick" ini:"Joystick"`
	ForceFeedback     int    `toml:"ForceFeedback" ini:"ForceFeedback"`
	NonLinearSteering int    `toml:"NonLinearSteering" ini:"NonLinearSteering"`
	SteeringDeadzone  int    `toml:"SteeringDeadzone" ini:"SteeringDeadzone"`
	SteeringRange     int    `toml:"SteeringRange" ini:"SteeringRange"`
	ButtonOpacity     int    `toml:"ButtonOpacity" ini:"ButtonOpacity"`
	KeyLeft           uint32 `toml:"KeyLeft" ini:"KeyLeft"`
	KeyRight          uint32 `toml:"KeyRight" ini:"KeyRight"`
	KeyFwd            uint32 `toml:"KeyFwd" ini:"KeyFwd"`
	KeyBack           uint32 `toml:"KeyBack" ini:"KeyBack"`
	KeyFire           uint32 `toml:"KeyFire" ini:"KeyFire"`
	KeyReset          uint32 `toml:"KeyReset" ini:"KeyReset"`
	KeyReposition     uint32 `toml:"KeyReposition" ini:"KeyReposition"`
	KeyHonka          uint32 `toml:"KeyHonka" ini:"KeyHonka"`
	KeyChangeCamera   uint32 `toml:"KeyChangeCamera" ini:"KeyChangeCamera"`
	KeyRearView       uint32 `toml:"KeyRearView" ini:"KeyRearView"`
	KeyPause          uint32 `toml:"KeyPause" ini:"KeyPause"`
}

type ProfileGameSettings added in v0.5.0

type ProfileGameSettings struct {
	Pickups         int    `toml:"Pickups" ini:"Pickups"`
	NCars           int    `toml:"NCars" ini:"NCars"`
	NLaps           int    `toml:"NLaps" ini:"NLaps"`
	PlayMode        int    `toml:"PlayMode" ini:"PlayMode"`
	Language        string `toml:"Language" ini:"Language"`
	LevelDir        string `toml:"LevelDir" ini:"LevelDir"`
	PlayerName1     string `toml:"PlayerName1" ini:"PlayerName1"`
	CarDir1         string `toml:"CarDir1" ini:"CarDir1"`
	PlayerName2     string `toml:"PlayerName2" ini:"PlayerName2"`
	CarDir2         string `toml:"CarDir2" ini:"CarDir2"`
	PlayerName3     string `toml:"PlayerName3" ini:"PlayerName3"`
	CarDir3         string `toml:"CarDir3" ini:"CarDir3"`
	PlayerName4     string `toml:"PlayerName4" ini:"PlayerName4"`
	CarDir4         string `toml:"CarDir4" ini:"CarDir4"`
	SpeedUnits      int    `toml:"SpeedUnits" ini:"SpeedUnits"`
	LocalCamera     int    `toml:"LocalCamera" ini:"LocalCamera"`
	DrawRearView    int    `toml:"DrawRearView" ini:"DrawRearView"`
	AnimateRearView int    `toml:"AnimateRearView" ini:"AnimateRearView"`
	RearViewType    int    `toml:"RearViewType" ini:"RearViewType"`
	GhostType       int    `toml:"GhostType" ini:"GhostType"`
	ShowGhost       int    `toml:"ShowGhost" ini:"ShowGhost"`
	CatchUp         int    `toml:"CatchUp" ini:"CatchUp"`
	CupDC           int    `toml:"CupDC" ini:"CupDC"`
	Difficulty      int    `toml:"Difficulty" ini:"Difficulty"`
	BattleTagTime   int    `toml:"BattleTagTime" ini:"BattleTagTime"`
	NumberOfPlayers int    `toml:"NumberOfPlayers" ini:"NumberOfPlayers"`
	MultiPlayerCPU  int    `toml:"MultiPlayerCPU" ini:"MultiPlayerCPU"`
	FinalLapMsg     int    `toml:"FinalLapMsg" ini:"FinalLapMsg"`
	FinalCam        int    `toml:"FinalCam" ini:"FinalCam"`
	WeaponCam       int    `toml:"WeaponCam" ini:"WeaponCam"`
	RandomSkins     int    `toml:"RandomSkins" ini:"RandomSkins"`
}

type ProfileSettings added in v0.5.0

type ProfileSettings struct {
	Game        ProfileGameSettings       `toml:"Game" ini:"Game"`
	Controller1 ProfileControllerSettings `toml:"Controller1" ini:"Controller1"`
	Controller2 ProfileControllerSettings `toml:"Controller2" ini:"Controller2"`
	Controller3 ProfileControllerSettings `toml:"Controller3" ini:"Controller3"`
	Controller4 ProfileControllerSettings `toml:"Controller4" ini:"Controller4"`
}

func DecodeProfileSettingsINI added in v0.5.0

func DecodeProfileSettingsINI(r io.Reader) (*ProfileSettings, error)

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 ResolveSettingsINIOpt added in v0.5.0

type ResolveSettingsINIOpt interface {
	Apply(*ResolveSettingsINIOpts)
}

type ResolveSettingsINIOpts added in v0.5.0

type ResolveSettingsINIOpts struct {
	Profile  string
	PathList string
}

func (*ResolveSettingsINIOpts) Apply added in v0.5.0

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 Settings added in v0.5.0

type Settings struct {
	Video   VideoSettings   `toml:"Video" ini:"Video"`
	Audio   AudioSettings   `toml:"Audio" ini:"Audio"`
	Network NetworkSettings `toml:"Network" ini:"Network"`
	Editor  EditorSettings  `toml:"Editor" ini:"Editor"`
	Misc    MiscSettings    `toml:"Misc" ini:"Misc"`
}

func DecodeSettingsINI added in v0.5.0

func DecodeSettingsINI(r io.Reader) (*Settings, 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)

type VideoSettings added in v0.5.0

type VideoSettings struct {
	EnvLevel         int `toml:"EnvLevel" ini:"EnvLevel"`
	ParticleLevel    int `toml:"ParticleLevel" ini:"ParticleLevel"`
	MirrorFlag       int `toml:"MirrorFlag" ini:"MirrorFlag"`
	ShadowFlag       int `toml:"ShadowFlag" ini:"ShadowFlag"`
	LightFlag        int `toml:"LightFlag" ini:"LightFlag"`
	RippleFlag       int `toml:"RippleFlag" ini:"RippleFlag"`
	InstanceFlag     int `toml:"InstanceFlag" ini:"InstanceFlag"`
	SkidFlag         int `toml:"SkidFlag" ini:"SkidFlag"`
	EffectFlag       int `toml:"EffectFlag" ini:"EffectFlag"`
	ScreenWidth      int `toml:"ScreenWidth" ini:"ScreenWidth"`
	ScreenHeight     int `toml:"ScreenHeight" ini:"ScreenHeight"`
	ScreenBpp        int `toml:"ScreenBpp" ini:"ScreenBpp"`
	ScreenHz         int `toml:"ScreenHz" ini:"ScreenHz"`
	Orientation      int `toml:"Orientation" ini:"Orientation"`
	Brightness       int `toml:"Brightness" ini:"Brightness"`
	Contrast         int `toml:"Contrast" ini:"Contrast"`
	DrawDist         int `toml:"DrawDist" ini:"DrawDist"`
	Texture32        int `toml:"Texture32" ini:"Texture32"`
	Vsync            int `toml:"Vsync" ini:"Vsync"`
	ShowFPS          int `toml:"ShowFPS" ini:"ShowFPS"`
	LimitFPS         int `toml:"LimitFPS" ini:"LimitFPS"`
	LimitLatency     int `toml:"LimitLatency" ini:"LimitLatency"`
	CenterHud        int `toml:"CenterHud" ini:"CenterHud"`
	SplitScreenMode  int `toml:"SplitScreenMode" ini:"SplitScreenMode"`
	MaintainAspect   int `toml:"MaintainAspect" ini:"MaintainAspect"`
	TextureFilter    int `toml:"TextureFilter" ini:"TextureFilter"`
	MipmapFilter     int `toml:"MipmapFilter" ini:"MipmapFilter"`
	Anisotropy       int `toml:"Anisotropy" ini:"Anisotropy"`
	Antialias        int `toml:"Antialias" ini:"Antialias"`
	GenerateMipmaps  int `toml:"GenerateMipmaps" ini:"GenerateMipmaps"`
	CompressTextures int `toml:"CompressTextures" ini:"CompressTextures"`
	Threaded         int `toml:"Threaded" ini:"Threaded"`
	Profile          int `toml:"Profile" ini:"Profile"`
	Shaders          int `toml:"Shaders" ini:"Shaders"`
	ShaderLights     int `toml:"ShaderLights" ini:"ShaderLights"`
	ShaderShadows    int `toml:"ShaderShadows" ini:"ShaderShadows"`
	ShaderEffects    int `toml:"ShaderEffects" ini:"ShaderEffects"`
	EnableFBO        int `toml:"EnableFBO" ini:"EnableFBO"`
	EnableUBO        int `toml:"EnableUBO" ini:"EnableUBO"`
	EnableSSO        int `toml:"EnableSSO" ini:"EnableSSO"`
	SortLevel        int `toml:"SortLevel" ini:"SortLevel"`
	Compositor       int `toml:"Compositor" ini:"Compositor"`
	HighDPI          int `toml:"HighDPI" ini:"HighDPI"`
}

Directories

Path Synopsis
cmd
sinks

Jump to

Keyboard shortcuts

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