Skip to content

Commit

Permalink
roblox: drop for rbxbin & rbxweb
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Mar 8, 2024
1 parent e4be3b3 commit 1918d8c
Show file tree
Hide file tree
Showing 30 changed files with 135 additions and 1,154 deletions.
13 changes: 10 additions & 3 deletions bloxstraprpc/bloxstraprpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import (
"fmt"
"log/slog"
"regexp"
"strconv"
"strings"
"time"

"github.com/altfoxie/drpc"
"github.com/apprehensions/rbxweb/games"
)

const Reset = "<reset>"
Expand Down Expand Up @@ -48,7 +50,7 @@ type Activity struct {
teleporting bool
server ServerType

universeID string
universeID games.UniverseID
placeID string
jobID string
}
Expand Down Expand Up @@ -126,8 +128,13 @@ func (a *Activity) handleGameJoinReport(line string) error {
return fmt.Errorf("log game join report entry is invalid")
}

uid, err := strconv.ParseInt(m[2], 10, 64)
if err != nil {
return err
}

a.placeID = m[1]
a.universeID = m[2]
a.universeID = games.UniverseID(uid)

slog.Info("Handled GameJoinReport", "universeid", a.universeID, "placeid", a.placeID)

Expand Down Expand Up @@ -163,7 +170,7 @@ func (a *Activity) handleGameLeave() error {
a.gameTime = time.Time{}
a.teleporting = false
a.server = Public
a.universeID = ""
a.universeID = games.UniverseID(0)
a.placeID = ""
a.jobID = ""

Expand Down
7 changes: 4 additions & 3 deletions bloxstraprpc/discordrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"log/slog"

"github.com/altfoxie/drpc"
"github.com/vinegarhq/vinegar/roblox/api"
"github.com/apprehensions/rbxweb/games"
"github.com/apprehensions/rbxweb/thumbnails"
)

func (a *Activity) Connect() error {
Expand Down Expand Up @@ -43,7 +44,7 @@ func (a *Activity) UpdateGamePresence(initial bool) error {
if initial || (a.presence.Details == Reset ||
a.presence.State == Reset ||
a.presence.Assets.LargeText == Reset) {
gd, err := api.GetGameDetails(a.universeID)
gd, err := games.GetGameDetail(a.universeID)
if err != nil {
return err
}
Expand All @@ -69,7 +70,7 @@ func (a *Activity) UpdateGamePresence(initial bool) error {
}

if initial || a.presence.Assets.LargeImage == Reset {
tn, err := api.GetGameIcon(a.universeID, "PlaceHolder", "512x512", "Png", false)
tn, err := thumbnails.GetGameIcon(a.universeID, "PlaceHolder", "512x512", "Png", false)
if err != nil {
return err
}
Expand Down
37 changes: 17 additions & 20 deletions cmd/vinegar/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"syscall"
"time"

"github.com/apprehensions/rbxbin"
"github.com/apprehensions/rbxweb/clientsettings"
"github.com/fsnotify/fsnotify"
"github.com/godbus/dbus/v5"
"github.com/lmittmann/tint"
Expand All @@ -20,8 +22,6 @@ import (
"github.com/vinegarhq/vinegar/config"
"github.com/vinegarhq/vinegar/internal/dirs"
"github.com/vinegarhq/vinegar/internal/state"
"github.com/vinegarhq/vinegar/roblox"
boot "github.com/vinegarhq/vinegar/roblox/bootstrapper"
"github.com/vinegarhq/vinegar/splash"
"github.com/vinegarhq/vinegar/sysinfo"
"github.com/vinegarhq/vinegar/wine"
Expand Down Expand Up @@ -50,23 +50,21 @@ type Binary struct {
GlobalConfig *config.Config
Config *config.Binary

Alias string
Name string
Dir string
Prefix *wine.Prefix
Type roblox.BinaryType
Deploy *boot.Deployment
Type clientsettings.BinaryType
Deploy *rbxbin.Deployment

// Logging
Auth bool
Activity bsrpc.Activity
}

func BinaryPrefixDir(bt roblox.BinaryType) string {
return filepath.Join(dirs.Prefixes, strings.ToLower(bt.String()))
func BinaryPrefixDir(bt clientsettings.BinaryType) string {
return filepath.Join(dirs.Prefixes, strings.ToLower(bt.Short()))
}

func NewBinary(bt roblox.BinaryType, cfg *config.Config) (*Binary, error) {
func NewBinary(bt clientsettings.BinaryType, cfg *config.Config) (*Binary, error) {
var bcfg *config.Binary
var bstate *state.Binary

Expand All @@ -76,10 +74,10 @@ func NewBinary(bt roblox.BinaryType, cfg *config.Config) (*Binary, error) {
}

switch bt {
case roblox.Player:
case clientsettings.WindowsPlayer:
bcfg = &cfg.Player
bstate = &s.Player
case roblox.Studio:
case clientsettings.WindowsStudio64:
bcfg = &cfg.Studio
bstate = &s.Studio
}
Expand All @@ -100,15 +98,13 @@ func NewBinary(bt roblox.BinaryType, cfg *config.Config) (*Binary, error) {
GlobalConfig: cfg,
Config: bcfg,

Alias: bt.String(),
Name: bt.BinaryName(),
Type: bt,
Prefix: pfx,
}, nil
}

func (b *Binary) Main(args ...string) int {
logFile, err := LogFile(b.Type.String())
logFile, err := LogFile(b.Type.Short())
if err != nil {
slog.Error(fmt.Sprintf("create log file: %s", err))
return 1
Expand Down Expand Up @@ -199,9 +195,9 @@ func (b *Binary) Init() error {

var err error
switch b.Type {
case roblox.Player:
case clientsettings.WindowsPlayer:
err = b.Prefix.Init()
case roblox.Studio:
case clientsettings.WindowsStudio64:
// Studio accepts all DPIs except the default, which is 96.
// Technically this is 'initializing wineprefix', as SetDPI calls Wine which
// automatically create the Wineprefix.
Expand Down Expand Up @@ -248,7 +244,7 @@ func (b *Binary) Execute(args ...string) error {
}

// Studio can run in multiple instances, not Player
if b.GlobalConfig.MultipleInstances && b.Type == roblox.Player {
if b.GlobalConfig.MultipleInstances && b.Type == clientsettings.WindowsPlayer {
slog.Info("Running robloxmutexer")

mutexer := b.Prefix.Wine(filepath.Join(BinPrefix, "robloxmutexer.exe"))
Expand Down Expand Up @@ -289,8 +285,8 @@ func (b *Binary) Execute(args ...string) error {
signal.Stop(c)
}()

slog.Info("Running Binary", "name", b.Name, "cmd", cmd)
b.Splash.SetMessage("Launching " + b.Alias)
slog.Info("Running Binary", "name", b.Type, "cmd", cmd)
b.Splash.SetMessage("Launching " + b.Type.Short())

go func() {
// Wait for process to start
Expand Down Expand Up @@ -405,7 +401,8 @@ func (b *Binary) Command(args ...string) (*wine.Cmd, error) {
args = []string{"-protocolString", args[0]}
}

cmd := b.Prefix.Wine(filepath.Join(b.Dir, b.Type.Executable()), args...)
exe := "Roblox" + b.Type.Short() + "Beta.exe"
cmd := b.Prefix.Wine(filepath.Join(b.Dir, exe), args...)

launcher := strings.Fields(b.Config.Launcher)
if len(launcher) >= 1 {
Expand Down
Loading

0 comments on commit 1918d8c

Please sign in to comment.