Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,21 @@ jobs:
env:
GROUT_VERSION: ${{ needs.prepare.outputs.version }}

- name: Package Batocera AMD64
run: task package:batocera-amd64
- name: Package AMD64 platforms
run: task package:batocera-amd64 package:retrodeck

- name: Create distribution
run: |
cd dist/Batocera-amd64 && zip -r ../Grout-Batocera-amd64.zip Grout.sh Grout
cd dist/RetroDECK && zip -r ../Grout-RetroDECK.zip Grout.sh Grout

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: amd64-artifacts
path: |
dist/Grout-Batocera-amd64.zip
dist/Grout-RetroDECK.zip

build-x86:
needs: prepare
Expand Down Expand Up @@ -306,6 +308,7 @@ jobs:
**/Grout-Batocera-arm64.zip
**/Grout-Batocera-x86.zip
**/Grout-Batocera-amd64.zip
**/Grout-RetroDECK.zip
**/grout
draft: false
prerelease: ${{ inputs.beta }}
Expand Down Expand Up @@ -383,6 +386,7 @@ jobs:
"Grout-Batocera-arm64.zip"
"Grout-Batocera-amd64.zip"
"Grout-Batocera-x86.zip"
"Grout-RetroDECK.zip"
)

# Build the assets JSON object
Expand Down
19 changes: 4 additions & 15 deletions cache/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cache

import (
"database/sql"
"grout/internal/appdir"
"grout/internal/fileutil"
"grout/romm"
"os"
Expand Down Expand Up @@ -446,27 +447,15 @@ func (cm *Manager) SyncPlatformGames(platforms []romm.Platform) (int, error) {
}

func getCacheDBPath() string {
wd, err := os.Getwd()
if err != nil {
return filepath.Join(os.TempDir(), ".cache", "grout.db")
}
return filepath.Join(wd, ".cache", "grout.db")
return filepath.Join(appdir.CacheDir(), "grout.db")
}

func GetArtworkCacheDir() string {
wd, err := os.Getwd()
if err != nil {
return filepath.Join(os.TempDir(), ".cache", "artwork")
}
return filepath.Join(wd, ".cache", "artwork")
return filepath.Join(appdir.CacheDir(), "artwork")
}

func GetCacheDir() string {
wd, err := os.Getwd()
if err != nil {
return filepath.Join(os.TempDir(), ".cache")
}
return filepath.Join(wd, ".cache")
return appdir.CacheDir()
}

// DeleteCacheFolder removes the entire cache directory and resets the singleton
Expand Down
29 changes: 15 additions & 14 deletions cfw/cfw.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,37 @@ import (
type CFW string

const (
NextUI CFW = "NEXTUI"
MuOS CFW = "MUOS"
Knulli CFW = "KNULLI"
Spruce CFW = "SPRUCE"
ROCKNIX CFW = "ROCKNIX"
Trimui CFW = "TRIMUI"
Allium CFW = "ALLIUM"
Onion CFW = "ONION"
Koriki CFW = "KORIKI"
Batocera CFW = "BATOCERA"
MinUI CFW = "MINUI"
NextUI CFW = "NEXTUI"
MuOS CFW = "MUOS"
Knulli CFW = "KNULLI"
Spruce CFW = "SPRUCE"
ROCKNIX CFW = "ROCKNIX"
Trimui CFW = "TRIMUI"
Allium CFW = "ALLIUM"
Onion CFW = "ONION"
Koriki CFW = "KORIKI"
Batocera CFW = "BATOCERA"
MinUI CFW = "MINUI"
RetroDECK CFW = "RETRODECK"
)

func GetCFW() CFW {
cfwEnv := strings.ToUpper(os.Getenv("CFW"))
cfw := CFW(cfwEnv)

switch cfw {
case MuOS, NextUI, Knulli, Spruce, ROCKNIX, Trimui, Allium, Onion, Koriki, Batocera, MinUI:
case MuOS, NextUI, Knulli, Spruce, ROCKNIX, Trimui, Allium, Onion, Koriki, Batocera, MinUI, RetroDECK:
return cfw
default:
log.SetOutput(os.Stderr)
log.Fatalf("Unsupported CFW: '%s'. Valid options: NextUI, muOS, Knulli, Spruce, ROCKNIX, Trimui, Allium, Onion, Koriki, Batocera, MinUI", cfwEnv)
log.Fatalf("Unsupported CFW: '%s'. Valid options: NextUI, muOS, Knulli, Spruce, ROCKNIX, Trimui, Allium, Onion, Koriki, Batocera, MinUI, RetroDECK", cfwEnv)
return ""
}
}

func (c CFW) IsBasedOnEmulationStation() bool {
switch c {
case Knulli, ROCKNIX, Batocera:
case Knulli, ROCKNIX, Batocera, RetroDECK:
return true
default:
return false
Expand Down
23 changes: 23 additions & 0 deletions cfw/directories.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"grout/cfw/muos"
"grout/cfw/nextui"
"grout/cfw/onion"
"grout/cfw/retrodeck"
"grout/cfw/rocknix"
"grout/cfw/spruce"
"grout/cfw/trimui"
Expand Down Expand Up @@ -40,6 +41,8 @@ func GetRomDirectory() string {
return batocera.GetRomDirectory()
case MinUI:
return minui.GetRomDirectory()
case RetroDECK:
return retrodeck.GetRomDirectory()
}
return ""
}
Expand Down Expand Up @@ -81,6 +84,8 @@ func GetBIOSDirectory() string {
return batocera.GetBIOSDirectory()
case MinUI:
return minui.GetBIOSDirectory()
case RetroDECK:
return retrodeck.GetBIOSDirectory()
}
return ""
}
Expand Down Expand Up @@ -132,6 +137,8 @@ func GetArtDirectory(romDir string, platformFSSlug, platformName string) string
return batocera.GetArtDirectory(romDir)
case MinUI:
return minui.GetArtDirectory(romDir)
case RetroDECK:
return retrodeck.GetArtDirectory(romDir)
default:
return ""
}
Expand Down Expand Up @@ -180,6 +187,8 @@ func BaseSavePath() string {
return batocera.GetBaseSavePath()
case MinUI:
return minui.GetBaseSavePath()
case RetroDECK:
return retrodeck.GetBaseSavePath()
}
return ""
}
Expand All @@ -192,6 +201,8 @@ func GetArtMarqueeDirectory(romDir string, platformFSSlug, platformName string)
return knulli.GetArtDirectory(romDir)
case Batocera:
return batocera.GetArtDirectory(romDir)
case RetroDECK:
return retrodeck.GetArtDirectory(romDir)
default:
return ""
}
Expand All @@ -205,6 +216,8 @@ func GetArtVideoDirectory(romDir string, platformFSSlug, platformName string) st
return knulli.GetVideoDirectory(romDir)
case Batocera:
return batocera.GetVideoDirectory(romDir)
case RetroDECK:
return retrodeck.GetVideoDirectory(romDir)
default:
return ""

Expand All @@ -219,6 +232,8 @@ func GetArtThumbnailDirectory(romDir string, platformFSSlug, platformName string
return knulli.GetArtDirectory(romDir)
case Batocera:
return knulli.GetArtDirectory(romDir)
case RetroDECK:
return retrodeck.GetArtDirectory(romDir)
default:
return ""
}
Expand All @@ -232,6 +247,8 @@ func GetArtBezelDirectory(romDir string, platformFSSlug, platformName string) st
return knulli.GetBezelDirectory(romDir)
case Batocera:
return batocera.GetBezelDirectory(romDir)
case RetroDECK:
return retrodeck.GetBezelDirectory(romDir)
default:
return ""
}
Expand All @@ -245,6 +262,8 @@ func GetManualDirectory(romDir string, platformFSSlug, platformName string) stri
return knulli.GetManualDirectory(romDir)
case Batocera:
return batocera.GetManualDirectory(romDir)
case RetroDECK:
return retrodeck.GetManualDirectory(romDir)
default:
return ""
}
Expand All @@ -258,6 +277,8 @@ func GetBoxbackDirectory(romDir string, platformFSSlug, platformName string) str
return knulli.GetArtDirectory(romDir)
case Batocera:
return batocera.GetArtDirectory(romDir)
case RetroDECK:
return retrodeck.GetArtDirectory(romDir)
default:
return ""
}
Expand All @@ -271,6 +292,8 @@ func GetFanartDirectory(romDir string, platformFSSlug, platformName string) stri
return knulli.GetArtDirectory(romDir)
case Batocera:
return batocera.GetArtDirectory(romDir)
case RetroDECK:
return retrodeck.GetArtDirectory(romDir)
default:
return ""
}
Expand Down
14 changes: 12 additions & 2 deletions cfw/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"grout/cfw/batocera"
"grout/cfw/knulli"
"grout/cfw/muos"
"grout/cfw/retrodeck"
"grout/cfw/rocknix"
"grout/internal/emulationstation"
"grout/internal/gamelist"
Expand Down Expand Up @@ -36,12 +37,21 @@ func FillGamesMetadata(entries []gamelist.RomGameEntry) {
logger := gaba.GetLogger()
switch GetCFW() {
case Knulli, ROCKNIX, Batocera:
if err := gamelist.AddRomGamesToGamelist(entries, gamelist.GameListFileName); err != nil {
if err := gamelist.AddRomGamesToGamelist(entries, gamelist.GameListFileName, nil); err != nil {
logger.Warn("Failed to add games to ES gamelist.xml", "error", err)
}
scheduleESRestart()
case RetroDECK:
options := &gamelist.AddRomGamesToGamelistOptions{
PathResolver: func(entry gamelist.RomGameEntry, filename gamelist.FileName) string {
return retrodeck.GetGamelistPath(entry.RomDirectory, string(filename))
},
}
if err := gamelist.AddRomGamesToGamelist(entries, gamelist.GameListFileName, options); err != nil {
logger.Warn("Failed to add games to ES gamelist.xml", "error", err)
}
case Spruce, Allium, Onion, Koriki:
if err := gamelist.AddRomGamesToGamelist(entries, gamelist.MiyooGameListFileName); err != nil {
if err := gamelist.AddRomGamesToGamelist(entries, gamelist.MiyooGameListFileName, nil); err != nil {
logger.Warn("Failed to add games to miyoogamelist.xml", "error", err)
}
case MuOS:
Expand Down
4 changes: 4 additions & 0 deletions cfw/platforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"grout/cfw/muos"
"grout/cfw/nextui"
"grout/cfw/onion"
"grout/cfw/retrodeck"
"grout/cfw/rocknix"
"grout/cfw/spruce"
"grout/cfw/trimui"
Expand All @@ -33,6 +34,7 @@ func buildPlatformAliasMap() map[string][]string {
koriki.Platforms,
batocera.Platforms,
minui.Platforms,
retrodeck.Platforms,
}

// Build reverse map: primary folder -> list of RomM slugs that use it as primary
Expand Down Expand Up @@ -138,6 +140,8 @@ func GetPlatformMap(c CFW) map[string][]string {
return batocera.Platforms
case MinUI:
return minui.Platforms
case RetroDECK:
return retrodeck.Platforms
default:
return nil
}
Expand Down
47 changes: 47 additions & 0 deletions cfw/retrodeck/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package retrodeck

import (
"encoding/json"
"fmt"
"os"
)

const configPathEnv = "RETRODECK_CFG"

// Paths holds the subset of RetroDECK path configuration relevant to Grout.
type Paths struct {
RDHomePath string `json:"rd_home_path"`
RomsPath string `json:"roms_path"`
SavesPath string `json:"saves_path"`
BiosPath string `json:"bios_path"`
DownloadedMediaPath string `json:"downloaded_media_path"`
VideosPath string `json:"videos_path"`
}

type retrodeckConfig struct {
Paths Paths `json:"paths"`
}

// LoadConfig reads the RetroDECK config file from the path set in RETRODECK_CFG.
func LoadConfig() (*Paths, error) {
cfgPath := os.Getenv(configPathEnv)
if cfgPath == "" {
return nil, fmt.Errorf("%s environment variable not set", configPathEnv)
}
return ParseConfig(cfgPath)
}

// ParseConfig reads and parses the RetroDECK config file at the given path.
func ParseConfig(path string) (*Paths, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("reading retrodeck config: %w", err)
}

var cfg retrodeckConfig
if err := json.Unmarshal(data, &cfg); err != nil {
return nil, fmt.Errorf("parsing retrodeck config: %w", err)
}

return &cfg.Paths, nil
}
Loading