Skip to content

Commit

Permalink
update go modules
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Nov 8, 2024
1 parent 553767b commit 28488ca
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 50 deletions.
1 change: 0 additions & 1 deletion cmd/vinegar/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ func (b *Binary) Init() error {
slog.Warn("Running roblox without AVX, Roblox will most likely fail to run!")
}


if b.Type == clientsettings.WindowsPlayer {
b.Splash.Dialog(DialogWineBlock, false, "https://sober.vinegarhq.org/")
}
Expand Down
90 changes: 49 additions & 41 deletions cmd/vinegar/binary_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"sort"
"strings"
"sync/atomic"

"github.com/apprehensions/rbxbin"
"github.com/apprehensions/rbxweb/clientsettings"
Expand Down Expand Up @@ -111,25 +112,8 @@ func (b *Binary) Install() error {
return err
}

m, err := rbxbin.GetMirror()
if err != nil {
return fmt.Errorf("fetch mirror: %w", err)
}
pkgs, err := m.GetPackages(b.Deploy)
if err != nil {
return fmt.Errorf("fetch packages: %w", err)
}

// Prioritize smaller files first, to have less pressure
// on network and extraction
//
// *Theoretically*, this should be better
sort.SliceStable(pkgs, func(i, j int) bool {
return pkgs[i].ZipSize < pkgs[j].ZipSize
})

if err := b.SetupPackages(&pkgs, &m); err != nil {
return fmt.Errorf("setup: %w", err)
if err := b.SetupPackages(); err != nil {
return err
}

if b.Type == clientsettings.WindowsStudio64 {
Expand All @@ -145,11 +129,6 @@ func (b *Binary) Install() error {
return fmt.Errorf("appsettings: %w", err)
}

b.State.Version = b.Deploy.GUID
for _, pkg := range pkgs {
b.State.Packages = append(b.State.Packages, pkg.Checksum)
}

if err := b.GlobalState.CleanPackages(); err != nil {
return fmt.Errorf("clean packages: %w", err)
}
Expand All @@ -161,19 +140,38 @@ func (b *Binary) Install() error {
return nil
}

func (b *Binary) SetupPackages(pkgs *[]rbxbin.Package, m *rbxbin.Mirror) error {
dsts := rbxbin.BinaryDirectories(b.Type)
d := 0
n := len(*pkgs) * 2 // download & extraction
eg := new(errgroup.Group)
func (b *Binary) SetupPackages() error {
m, err := rbxbin.GetMirror()
if err != nil {
return fmt.Errorf("fetch mirror: %w", err)
}

done := func() {
d++
b.Splash.SetProgress(float32(d) / float32(n))
pkgs, err := m.GetPackages(b.Deploy)
if err != nil {
return fmt.Errorf("fetch packages: %w", err)
}

slog.Info("Installing Packages", "guid", b.Deploy.GUID, "count", n)
for _, p := range *pkgs {
// Prioritize smaller files first, to have less pressure
// on network and extraction
//
// *Theoretically*, this should be better
sort.SliceStable(pkgs, func(i, j int) bool {
return pkgs[i].ZipSize < pkgs[j].ZipSize
})

slog.Info("Fetching package directories")

pd, err := m.BinaryDirectories(b.Deploy)
if err != nil {
return fmt.Errorf("fetch package dirs: %w", err)
}

total := len(pkgs) * 2 // download & extraction
var done atomic.Uint32
eg := new(errgroup.Group)

slog.Info("Installing Packages", "count", len(pkgs))
for _, p := range pkgs {
p := p

if p.Name == "RobloxPlayerLauncher.exe" {
Expand All @@ -182,15 +180,19 @@ func (b *Binary) SetupPackages(pkgs *[]rbxbin.Package, m *rbxbin.Mirror) error {

eg.Go(func() error {
src := filepath.Join(dirs.Downloads, p.Checksum)
dst, ok := dsts[p.Name]

dst, ok := pd[p.Name]
if !ok {
return fmt.Errorf("unhandled package: %s", p.Name)
}

defer func() {
done.Add(1)
b.Splash.SetProgress(float32(done.Load()) / float32(total))
}()

if err := p.Verify(src); err != nil {
url := m.PackageURL(b.Deploy, p.Name)
slog.Info("Downloading package", "url", url, "path", src)
slog.Info("Downloading Package", "name", p.Name)

if err := netutil.Download(url, src); err != nil {
return err
Expand All @@ -200,20 +202,26 @@ func (b *Binary) SetupPackages(pkgs *[]rbxbin.Package, m *rbxbin.Mirror) error {
return err
}
} else {
slog.Info("Package is already downloaded", "name", p.Name, "file", src)
slog.Info("Package is already downloaded", "name", p.Name)
}
done()

if err := p.Extract(src, filepath.Join(b.Dir, dst)); err != nil {
return err
}
done()

return nil
})
}

return eg.Wait()
if err := eg.Wait(); err != nil {
return err
}

b.State.Version = b.Deploy.GUID
for _, pkg := range pkgs {
b.State.Packages = append(b.State.Packages, pkg.Checksum)
}
return nil
}

func (b *Binary) SetupDxvk() error {
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ go 1.22.0

require (
github.com/BurntSushi/toml v1.4.0
github.com/adrg/xdg v0.5.0
github.com/adrg/xdg v0.5.3
github.com/otiai10/copy v1.14.1-0.20240925044834-49b0b590f1e1
golang.org/x/sync v0.8.0
golang.org/x/sync v0.9.0
)

require (
gioui.org v0.7.1
github.com/altfoxie/drpc v0.0.0-20231214171500-0a4e3a3b1c53
github.com/apprehensions/rbxbin v0.0.0-20240925121238-cb74166ca649
github.com/altfoxie/drpc v0.0.0-20240929140334-e714e6291275
github.com/apprehensions/rbxbin v0.0.0-20241108182759-6d92e1ecbfab
github.com/apprehensions/rbxweb v0.0.0-20240329184049-0bdedc184942
github.com/apprehensions/wine v0.0.0-20240402112551-874f01f9e84d
github.com/folbricht/pefile v0.1.0
github.com/fsnotify/fsnotify v1.7.0
github.com/fsnotify/fsnotify v1.8.0
github.com/godbus/dbus/v5 v5.1.0
github.com/lmittmann/tint v1.0.5
github.com/nxadm/tail v1.4.11
github.com/samber/slog-multi v1.2.2
golang.org/x/sys v0.25.0
golang.org/x/term v0.24.0
github.com/samber/slog-multi v1.2.4
golang.org/x/sys v0.27.0
golang.org/x/term v0.26.0
)

require (
Expand Down
18 changes: 18 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/adrg/xdg v0.5.0 h1:dDaZvhMXatArP1NPHhnfaQUqWBLBsmx1h1HXQdMoFCY=
github.com/adrg/xdg v0.5.0/go.mod h1:dDdY4M4DF9Rjy4kHPeNL+ilVF+p2lK8IdM9/rTSGcI4=
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
github.com/altfoxie/drpc v0.0.0-20231214171500-0a4e3a3b1c53 h1:NcI4SrGv7yDhMRFc6SOQnmTvkOWya6WT/eXVjQoT+TA=
github.com/altfoxie/drpc v0.0.0-20231214171500-0a4e3a3b1c53/go.mod h1:vV4ApNpKIGN4PT5NYmWqw1IEIsFzqj0pspTUSltS+gk=
github.com/altfoxie/drpc v0.0.0-20240929140334-e714e6291275 h1:CZsW9r4+WUPyVaulBlF8GPTznDw4o+6y6sr15YMK8XA=
github.com/altfoxie/drpc v0.0.0-20240929140334-e714e6291275/go.mod h1:vV4ApNpKIGN4PT5NYmWqw1IEIsFzqj0pspTUSltS+gk=
github.com/apprehensions/rbxbin v0.0.0-20240925121238-cb74166ca649 h1:YXcNpRZbGSeUbryg5G7MD3GkGwzzT1usuH/iizfz7LE=
github.com/apprehensions/rbxbin v0.0.0-20240925121238-cb74166ca649/go.mod h1:FRJLfv2+HPYGcR7xP2VLG4O6QjkFCf05rBcdfUq1j3M=
github.com/apprehensions/rbxbin v0.0.0-20241108182759-6d92e1ecbfab h1:WDGkrfg6C2q9PmlQp4N7itv6v3+QLkwH79aB0HUHW0Y=
github.com/apprehensions/rbxbin v0.0.0-20241108182759-6d92e1ecbfab/go.mod h1:FRJLfv2+HPYGcR7xP2VLG4O6QjkFCf05rBcdfUq1j3M=
github.com/apprehensions/rbxweb v0.0.0-20240329184049-0bdedc184942 h1:pNRoIKlv329La+msdHmJSPYYf1y4hY4s5ou2mEQDHqU=
github.com/apprehensions/rbxweb v0.0.0-20240329184049-0bdedc184942/go.mod h1:F7WKRLrQxuRgfXxhwnlFJ059ZBMRxkXxvIhUxP4Qc5g=
github.com/apprehensions/wine v0.0.0-20240402112551-874f01f9e84d h1:gf4oF5BVh6GEAfjVlt5/0HJ+2pohrbf+5LZAh29fyY0=
Expand All @@ -26,6 +32,8 @@ github.com/folbricht/pefile v0.1.0/go.mod h1:QP4MiHKu0BG/jiftQCJoiH+mM1UMNncR3S+
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-text/typesetting v0.1.1 h1:bGAesCuo85nXnEN5LmFMVGAGpGkCPtHrZLi//qD7EJo=
github.com/go-text/typesetting v0.1.1/go.mod h1:d22AnmeKq/on0HNv73UFriMKc4Ez6EqZAofLhAzpSzI=
github.com/go-text/typesetting-utils v0.0.0-20231211103740-d9332ae51f04 h1:zBx+p/W2aQYtNuyZNcTfinWvXBQwYtDfme051PR/lAY=
Expand All @@ -52,6 +60,8 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/samber/slog-multi v1.2.2 h1:tJfAyxFDk7CGiEumFTj1iXpD3Uu9rFPUKldpsTgUTGk=
github.com/samber/slog-multi v1.2.2/go.mod h1:uLAvHpGqbYgX4FSL0p1ZwoLuveIAJvBECtE07XmYvFo=
github.com/samber/slog-multi v1.2.4 h1:k9x3JAWKJFPKffx+oXZ8TasaNuorIW4tG+TXxkt6Ry4=
github.com/samber/slog-multi v1.2.4/go.mod h1:ACuZ5B6heK57TfMVkVknN2UZHoFfjCwRxR0Q2OXKHlo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
Expand All @@ -62,11 +72,19 @@ golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw=
golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
Expand Down

0 comments on commit 28488ca

Please sign in to comment.