diff --git a/internal/presets/linux_scan_test.go b/internal/presets/linux_scan_test.go index adfaa061..41890790 100644 --- a/internal/presets/linux_scan_test.go +++ b/internal/presets/linux_scan_test.go @@ -251,6 +251,43 @@ func TestEmuDeckDetection(t *testing.T) { } } +// RetroDECK keeps every system's saves in retrodeck/saves/: each +// system's folder surfaces as its own candidate, as EmuDeck's do. Asked for +// by a Steam Deck user whose RetroDECK games the scan did not find. +func TestRetroDECKDetection(t *testing.T) { + t.Setenv("XDG_DATA_HOME", "") + t.Setenv("XDG_CONFIG_HOME", "") + home := t.TempDir() + for _, system := range []string{"psx", "gc"} { + p := filepath.Join(home, "retrodeck", "saves", system) + if err := os.MkdirAll(p, 0o777); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(p, "game.srm"), []byte("x"), 0o666); err != nil { + t.Fatal(err) + } + } + + sc := &Scanner{CacheFile: filepath.Join(t.TempDir(), "cache.json"), GOOS: "linux", HomeDir: home} + found := sc.Scan(nil) + + got := map[string]string{} + for _, d := range found { + if strings.HasPrefix(d.ID, "retrodeck-") { + got[d.ID] = d.Name + } + } + if len(got) != 2 { + t.Fatalf("expected 2 RetroDECK discoveries, got %d: %v", len(got), got) + } + if got["retrodeck-psx"] != "RetroDECK (psx)" { + t.Errorf("psx entry = %q", got["retrodeck-psx"]) + } + if got["retrodeck-gc"] != "RetroDECK (gc)" { + t.Errorf("gc entry = %q", got["retrodeck-gc"]) + } +} + // TestPresetGlobPaths: SD-card style wildcard locations resolve through // filepath.Glob. func TestPresetGlobPaths(t *testing.T) { diff --git a/internal/presets/presets.go b/internal/presets/presets.go index 07b2c882..dce33461 100644 --- a/internal/presets/presets.go +++ b/internal/presets/presets.go @@ -188,6 +188,16 @@ var presetDefs = []preset{ "/run/media/*/*/Emulation/saves", }}, + // RetroDECK keeps every system's saves in one tree as well: + // retrodeck/saves/, in the home folder, or on an SD card when it + // was moved there. + {ID: "retrodeck", Name: "RetroDECK", Type: "emulator", IsWrapper: true, + LinuxPath: []string{ + "~/retrodeck/saves", + "/run/media/*/retrodeck/saves", + "/run/media/*/*/retrodeck/saves", + }}, + // Steam-emulator / repack wrappers (each subfolder = one game). These // are Windows conventions; on Linux the same games run under Proton and // their saves live in the compatdata prefix (see scanProtonCompat).