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
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ jobs:
GROUT_VERSION: ${{ needs.prepare.outputs.version }}

- name: Package ARM64 platforms
run: task package:next package:muos package:knulli package:rocknix package:trimui package:batocera
run: task package:next package:muos package:knulli package:rocknix package:amberelec package:trimui package:batocera

- name: Create distributions
run: |
cd dist/Grout.pak && zip -r ../Grout.pak.zip . && cd ../..
cd dist/muOS && zip -r Grout.muxapp Grout && mv Grout.muxapp ../Grout.muxapp && cd ../..
cd dist/Knulli && zip -r ../Grout-Knulli.zip Grout && cd ../..
cd dist/ROCKNIX && zip -r ../Grout-ROCKNIX.zip Grout.sh Grout && cd ../..
cd dist/AmberELEC && zip -r ../Grout-AmberELEC.zip Grout.sh Grout && cd ../..
cd dist/Trimui && zip -r ../Grout-Trimui.zip Grout && cd ../..
cd dist/Batocera-arm64 && zip -r ../Grout-Batocera-arm64.zip Grout.sh Grout && cd ../..

Expand All @@ -113,6 +114,7 @@ jobs:
dist/Grout.muxapp
dist/Grout-Knulli.zip
dist/Grout-ROCKNIX.zip
dist/Grout-AmberELEC.zip
dist/Grout-Trimui.zip
dist/Grout-Batocera-arm64.zip
build64/grout
Expand Down Expand Up @@ -301,6 +303,7 @@ jobs:
**/Grout-Koriki.zip
**/Grout-Knulli.zip
**/Grout-ROCKNIX.zip
**/Grout-AmberELEC.zip
**/Grout-Trimui.zip
**/Grout-MinUI.zip
**/Grout-Batocera-arm64.zip
Expand Down Expand Up @@ -375,6 +378,7 @@ jobs:
"Grout-Knulli.zip"
"Grout.spruce.zip"
"Grout-ROCKNIX.zip"
"Grout-AmberELEC.zip"
"Grout-Trimui.zip"
"Grout-Allium.zip"
"Grout-Onion.zip"
Expand Down
3 changes: 3 additions & 0 deletions app/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"grout/cache"
"grout/cfw"
"grout/cfw/amberelec"
"grout/cfw/allium"
"grout/cfw/koriki"
"grout/cfw/minui"
Expand Down Expand Up @@ -77,6 +78,8 @@ func setupInputMapping(currentCFW cfw.CFW) {
var mappingBytes []byte
var mappingErr error
switch currentCFW {
case cfw.AmberELEC:
mappingBytes, mappingErr = amberelec.GetInputMappingBytes()
case cfw.MuOS:
mappingBytes, mappingErr = muos.GetInputMappingBytes()
case cfw.Allium:
Expand Down
108 changes: 108 additions & 0 deletions cfw/amberelec/amberelec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package amberelec

import (
"embed"
"fmt"
"os"
"path/filepath"
"strings"

"grout/internal/jsonutil"
)

//go:embed data/*.json input_mappings/*.json
var embeddedFiles embed.FS

type Device string

const (
DeviceGeneric Device = "generic"
DeviceRG351P Device = "rg351p"
DeviceRG351V Device = "rg351v"
)

// Platforms is sourced from dedicated AmberELEC data instead of inheriting ROCKNIX folders at runtime.
// AmberELEC wiki systems that are still absent from RomM fs_slugs remain intentionally out of
// platforms.json for now: atomiswave, laserdisc, naomi, advision, gamepocketcomputer, gamate,
// gamemaster, gamecom, gameking, gameking3, pspminis, pv1000, satellaview, scv, sufami,
// tvboy, uzebox, vsmile, chip-8, lowresnx, piece, vircon32, wasm4, build, doom, easyrpg,
// ecwolf, scummvm, solarus, zmachine, ep64-128, sc-3000, thomson, tvc.
var Platforms = jsonutil.MustLoadJSONMap[string, []string](embeddedFiles, "data/platforms.json")

func DetectDevice() Device {
arch, err := os.ReadFile("/storage/.config/.OS_ARCH")
if err != nil {
return DeviceGeneric
}

switch strings.ToUpper(strings.TrimSpace(string(arch))) {
case "RG351P":
return DeviceRG351P
case "RG351V":
return DeviceRG351V
default:
return DeviceGeneric
}
}

func GetInputMappingBytes() ([]byte, error) {
var filename string
switch DetectDevice() {
case DeviceRG351P:
filename = "input_mappings/rg351p.json"
case DeviceRG351V:
filename = "input_mappings/rg351v.json"
default:
return nil, nil
}

overridePath := filepath.Join("overrides", "cfw", "amberelec", filename)
data, err := os.ReadFile(overridePath)
if err != nil {
data, err = embeddedFiles.ReadFile(filename)
if err != nil {
return nil, fmt.Errorf("failed to read embedded input mapping %s: %w", filename, err)
}
}

return data, nil
}

func GetBasePath() string {
if basePath := os.Getenv("BASE_PATH"); basePath != "" {
return basePath
}
return "/storage"
}

func GetRomDirectory() string {
return filepath.Join(GetBasePath(), "roms")
}

func GetBIOSDirectory() string {
return filepath.Join(GetRomDirectory(), "bios")
}

func GetBaseSavePath() string {
return GetRomDirectory()
}

func GetArtDirectory(romDir string) string {
return filepath.Join(romDir, "images")
}

func GetGroutGamelist() string {
return filepath.Join(GetRomDirectory(), "ports", "gamelist.xml")
}

func GetVideoDirectory(romDir string) string {
return filepath.Join(romDir, "videos")
}

func GetManualDirectory(romDir string) string {
return filepath.Join(romDir, "manuals")
}

func GetBezelDirectory(romDir string) string {
return filepath.Join(romDir, "bezels")
}
Loading