mirror of
https://github.com/rommapp/grout.git
synced 2026-04-23 06:54:36 +00:00
Cleanup unused code after refactor
This commit is contained in:
@@ -23,11 +23,6 @@ func mustLoadJSONMap[K comparable, V any](path string) map[K]V {
|
||||
var LibretroCoreToBIOS = mustLoadJSONMap[string, CoreBIOS]("data/core_requirements.json")
|
||||
var PlatformToLibretroCores = mustLoadJSONMap[string, []string]("data/platform_cores.json")
|
||||
|
||||
// CoreBIOSSubdirectories maps Libretro core names (without _libretro suffix)
|
||||
// to their required BIOS subdirectory within the system BIOS directory.
|
||||
// Cores not in this map use the root BIOS directory.
|
||||
var CoreBIOSSubdirectories = mustLoadJSONMap[string, string]("data/core_subdirectories.json")
|
||||
|
||||
// File represents a single BIOS/firmware file requirement
|
||||
type File struct {
|
||||
FileName string // e.g., "gba_bios.bin"
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"bk": "bk",
|
||||
"bluemsx": "",
|
||||
"dolphin": "dolphin-emu/Sys",
|
||||
"ep128emu_core": "ep128emu/roms",
|
||||
"fbneo": "fbneo",
|
||||
"fbneo_cps12": "fbneo",
|
||||
"fbneo_neogeo": "fbneo",
|
||||
"flycast": "dc",
|
||||
"flycast_gles2": "dc",
|
||||
"fuse": "fuse",
|
||||
"galaksija": "galaksija",
|
||||
"higan_sfc": "",
|
||||
"higan_sfc_balanced": "",
|
||||
"kronos": "kronos",
|
||||
"mkxp-z": "mkxp-z/RTP",
|
||||
"mupen64plus_next": "Mupen64plus",
|
||||
"mupen64plus_next_develop": "Mupen64plus",
|
||||
"mupen64plus_next_gles2": "Mupen64plus",
|
||||
"mupen64plus_next_gles3": "Mupen64plus",
|
||||
"neocd": "neocd",
|
||||
"np2kai": "np2kai",
|
||||
"pico": "pico8",
|
||||
"pico-8": "pico8",
|
||||
"pcsx2": "pcsx2",
|
||||
"ppsspp": "PPSSPP",
|
||||
"px68k": "keropi",
|
||||
"quasi88": "quasi88",
|
||||
"retrodream": "dc",
|
||||
"same_cdi": "same_cdi/bios",
|
||||
"scummvm": "scummvm",
|
||||
"vice_x128": "vice",
|
||||
"vice_x64": "vice",
|
||||
"vice_x64dtv": "vice",
|
||||
"vice_x64sc": "vice",
|
||||
"vice_xscpu64": "vice",
|
||||
"x1": "xmil"
|
||||
}
|
||||
Vendored
-10
@@ -99,16 +99,6 @@ func isValidPNG(path string) bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func GetRomsWithArtwork(roms []romm.Rom) []romm.Rom {
|
||||
var withArtwork []romm.Rom
|
||||
for _, rom := range roms {
|
||||
if HasArtworkURL(rom) {
|
||||
withArtwork = append(withArtwork, rom)
|
||||
}
|
||||
}
|
||||
return withArtwork
|
||||
}
|
||||
|
||||
func GetMissingArtwork(roms []romm.Rom) []romm.Rom {
|
||||
var missing []romm.Rom
|
||||
for _, rom := range roms {
|
||||
|
||||
Vendored
+2
-4
@@ -6,10 +6,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotInitialized = errors.New("cache manager not initialized")
|
||||
ErrCacheMiss = errors.New("cache miss")
|
||||
ErrDBClosed = errors.New("database connection closed")
|
||||
ErrInvalidCacheKey = errors.New("invalid cache key")
|
||||
ErrNotInitialized = errors.New("cache manager not initialized")
|
||||
ErrCacheMiss = errors.New("cache miss")
|
||||
)
|
||||
|
||||
type Error struct {
|
||||
|
||||
Vendored
-8
@@ -772,14 +772,6 @@ func RecordFailedLookup(fsSlug, localFilename string) error {
|
||||
return cm.RecordFailedLookup(fsSlug, localFilename)
|
||||
}
|
||||
|
||||
func ShouldAttemptLookup(fsSlug, localFilename string) bool {
|
||||
cm := GetCacheManager()
|
||||
if cm == nil {
|
||||
return true
|
||||
}
|
||||
return cm.ShouldAttemptLookup(fsSlug, localFilename)
|
||||
}
|
||||
|
||||
func ShouldAttemptLookupWithNextRetry(fsSlug, localFilename string) (bool, time.Time) {
|
||||
cm := GetCacheManager()
|
||||
if cm == nil {
|
||||
|
||||
Vendored
+6
-6
@@ -22,10 +22,10 @@ type Manager struct {
|
||||
config Config
|
||||
initialized bool
|
||||
|
||||
stats *CacheStats
|
||||
stats *Stats
|
||||
}
|
||||
|
||||
type CacheStats struct {
|
||||
type Stats struct {
|
||||
mu sync.Mutex
|
||||
Hits int64
|
||||
Misses int64
|
||||
@@ -33,21 +33,21 @@ type CacheStats struct {
|
||||
LastAccess time.Time
|
||||
}
|
||||
|
||||
func (s *CacheStats) recordHit() {
|
||||
func (s *Stats) recordHit() {
|
||||
s.mu.Lock()
|
||||
s.Hits++
|
||||
s.LastAccess = time.Now()
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
||||
func (s *CacheStats) recordMiss() {
|
||||
func (s *Stats) recordMiss() {
|
||||
s.mu.Lock()
|
||||
s.Misses++
|
||||
s.LastAccess = time.Now()
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
||||
func (s *CacheStats) recordError() {
|
||||
func (s *Stats) recordError() {
|
||||
s.mu.Lock()
|
||||
s.Errors++
|
||||
s.mu.Unlock()
|
||||
@@ -101,7 +101,7 @@ func newCacheManager(host romm.Host, config Config) (*Manager, error) {
|
||||
host: host,
|
||||
config: config,
|
||||
initialized: true,
|
||||
stats: &CacheStats{},
|
||||
stats: &Stats{},
|
||||
}
|
||||
|
||||
logger.Debug("Cache manager initialized", "path", dbPath)
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/BrandonKowalski/gabagool/v2/pkg/gabagool"
|
||||
go_qr "github.com/piglig/go-qr"
|
||||
goqr "github.com/piglig/go-qr"
|
||||
"golang.org/x/image/draw"
|
||||
_ "golang.org/x/image/webp" // Register WebP decoder
|
||||
)
|
||||
|
||||
func CreateTempQRCode(content string, size int) (string, error) {
|
||||
qr, err := go_qr.EncodeText(content, go_qr.Low)
|
||||
qr, err := goqr.EncodeText(content, goqr.Low)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func CreateTempQRCode(content string, size int) (string, error) {
|
||||
}
|
||||
tempFile.Close()
|
||||
|
||||
config := go_qr.NewQrCodeImgConfig(size/10, 0)
|
||||
config := goqr.NewQrCodeImgConfig(size/10, 0)
|
||||
if err := qr.PNG(config, tempFile.Name()); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
+2
-2
@@ -95,10 +95,10 @@ func (a *AutoSync) run() {
|
||||
logger.Debug("AutoSync: No syncs needed")
|
||||
}
|
||||
return
|
||||
} else {
|
||||
logger.Debug("AutoSync: Found syncs", "count", len(syncs))
|
||||
}
|
||||
|
||||
logger.Debug("AutoSync: Found syncs", "count", len(syncs))
|
||||
|
||||
hadError := false
|
||||
|
||||
for i := range syncs {
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ func (lrf LocalRomFile) baseName() string {
|
||||
return strings.TrimSuffix(lrf.FileName, filepath.Ext(lrf.FileName))
|
||||
}
|
||||
|
||||
func (lrf LocalRomFile) syncAction() SyncAction {
|
||||
func (lrf LocalRomFile) syncAction() Action {
|
||||
hasLocal := lrf.SaveFile != nil
|
||||
baseName := lrf.baseName()
|
||||
|
||||
@@ -54,7 +54,7 @@ func (lrf LocalRomFile) syncAction() SyncAction {
|
||||
return Skip
|
||||
case hasLocal && !hasRemote:
|
||||
return Upload
|
||||
case !hasLocal && hasRemote:
|
||||
case !hasLocal:
|
||||
return Download
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -27,21 +27,21 @@ type SaveSync struct {
|
||||
GameBase string
|
||||
Local *LocalSave
|
||||
Remote romm.Save
|
||||
Action SyncAction
|
||||
Action Action
|
||||
}
|
||||
|
||||
type SyncAction string
|
||||
type Action string
|
||||
|
||||
const (
|
||||
Download SyncAction = "DOWNLOAD"
|
||||
Upload SyncAction = "UPLOAD"
|
||||
Skip SyncAction = "SKIP"
|
||||
Download Action = "DOWNLOAD"
|
||||
Upload Action = "UPLOAD"
|
||||
Skip Action = "SKIP"
|
||||
)
|
||||
|
||||
type SyncResult struct {
|
||||
type Result struct {
|
||||
GameName string
|
||||
RomDisplayName string
|
||||
Action SyncAction
|
||||
Action Action
|
||||
Success bool
|
||||
Error string
|
||||
Err error
|
||||
@@ -84,7 +84,7 @@ type MatchAttemptResult struct {
|
||||
MatchesAttempted []string
|
||||
}
|
||||
|
||||
func (s *SaveSync) Execute(host romm.Host, config *internal.Config) SyncResult {
|
||||
func (s *SaveSync) Execute(host romm.Host, config *internal.Config) Result {
|
||||
logger := gaba.GetLogger()
|
||||
|
||||
displayName := s.RomName
|
||||
@@ -92,7 +92,7 @@ func (s *SaveSync) Execute(host romm.Host, config *internal.Config) SyncResult {
|
||||
displayName = strings.TrimSuffix(displayName, filepath.Ext(displayName))
|
||||
}
|
||||
|
||||
result := SyncResult{
|
||||
result := Result{
|
||||
GameName: s.GameBase,
|
||||
RomDisplayName: displayName,
|
||||
Action: s.Action,
|
||||
|
||||
@@ -126,29 +126,8 @@ const (
|
||||
LogoutConfirmationActionCancel
|
||||
)
|
||||
|
||||
type SaveSyncAction int
|
||||
|
||||
const (
|
||||
SaveSyncActionComplete SaveSyncAction = iota
|
||||
SaveSyncActionBack
|
||||
)
|
||||
|
||||
type BIOSDownloadAction int
|
||||
|
||||
const (
|
||||
BIOSDownloadActionComplete BIOSDownloadAction = iota
|
||||
BIOSDownloadActionBack
|
||||
)
|
||||
|
||||
type ArtworkSyncAction int
|
||||
|
||||
const (
|
||||
ArtworkSyncActionComplete ArtworkSyncAction = iota
|
||||
)
|
||||
|
||||
type UpdateCheckAction int
|
||||
|
||||
const (
|
||||
UpdateCheckActionComplete UpdateCheckAction = iota
|
||||
UpdateCheckActionBack
|
||||
)
|
||||
|
||||
+7
-7
@@ -27,7 +27,7 @@ import (
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
type downloadInput struct {
|
||||
type DownloadInput struct {
|
||||
Config internal.Config
|
||||
Host romm.Host
|
||||
Platform romm.Platform
|
||||
@@ -37,7 +37,7 @@ type downloadInput struct {
|
||||
SelectedFileID int
|
||||
}
|
||||
|
||||
type downloadOutput struct {
|
||||
type DownloadOutput struct {
|
||||
DownloadedGames []romm.Rom
|
||||
Platform romm.Platform
|
||||
AllGames []romm.Rom
|
||||
@@ -56,8 +56,8 @@ func NewDownloadScreen() *DownloadScreen {
|
||||
return &DownloadScreen{}
|
||||
}
|
||||
|
||||
func (s *DownloadScreen) Execute(config internal.Config, host romm.Host, platform romm.Platform, selectedGames []romm.Rom, allGames []romm.Rom, searchFilter string, selectedFileID int) downloadOutput {
|
||||
result, err := s.draw(downloadInput{
|
||||
func (s *DownloadScreen) Execute(config internal.Config, host romm.Host, platform romm.Platform, selectedGames []romm.Rom, allGames []romm.Rom, searchFilter string, selectedFileID int) DownloadOutput {
|
||||
result, err := s.draw(DownloadInput{
|
||||
Config: config,
|
||||
Host: host,
|
||||
Platform: platform,
|
||||
@@ -69,7 +69,7 @@ func (s *DownloadScreen) Execute(config internal.Config, host romm.Host, platfor
|
||||
|
||||
if err != nil {
|
||||
gaba.GetLogger().Error("Download failed", "error", err)
|
||||
return downloadOutput{
|
||||
return DownloadOutput{
|
||||
AllGames: allGames,
|
||||
Platform: platform,
|
||||
SearchFilter: searchFilter,
|
||||
@@ -83,10 +83,10 @@ func (s *DownloadScreen) Execute(config internal.Config, host romm.Host, platfor
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *DownloadScreen) draw(input downloadInput) (downloadOutput, error) {
|
||||
func (s *DownloadScreen) draw(input DownloadInput) (DownloadOutput, error) {
|
||||
logger := gaba.GetLogger()
|
||||
|
||||
output := downloadOutput{
|
||||
output := DownloadOutput{
|
||||
Platform: input.Platform,
|
||||
AllGames: input.AllGames,
|
||||
SearchFilter: input.SearchFilter,
|
||||
|
||||
@@ -33,10 +33,6 @@ type EmulatorSelectionOutput struct {
|
||||
|
||||
type EmulatorSelectionScreen struct{}
|
||||
|
||||
func NewEmulatorSelectionScreen() *EmulatorSelectionScreen {
|
||||
return &EmulatorSelectionScreen{}
|
||||
}
|
||||
|
||||
func (s *EmulatorSelectionScreen) Draw(input EmulatorSelectionInput) (EmulatorSelectionOutput, error) {
|
||||
output := EmulatorSelectionOutput{
|
||||
LastSelectedIndex: input.LastSelectedIndex,
|
||||
|
||||
@@ -15,24 +15,10 @@ func footerItem(button, msgID, fallback string) gaba.FooterHelpItem {
|
||||
}
|
||||
|
||||
func FooterContinue() gaba.FooterHelpItem { return footerItem("A", "button_continue", "Continue") }
|
||||
func FooterSelect() gaba.FooterHelpItem { return footerItem("A", "button_select", "Select") }
|
||||
func FooterConfirm() gaba.FooterHelpItem { return footerItem("A", "button_confirm", "Confirm") }
|
||||
func FooterDownload() gaba.FooterHelpItem { return footerItem("A", "button_download", "Download") }
|
||||
func FooterBack() gaba.FooterHelpItem { return footerItem("B", "button_back", "Back") }
|
||||
func FooterCancel() gaba.FooterHelpItem { return footerItem("B", "button_cancel", "Cancel") }
|
||||
func FooterClose() gaba.FooterHelpItem { return footerItem("B", "button_close", "Close") }
|
||||
func FooterQuit() gaba.FooterHelpItem { return footerItem("B", "button_quit", "Quit") }
|
||||
func FooterSearch() gaba.FooterHelpItem { return footerItem("X", "button_search", "Search") }
|
||||
func FooterSettings() gaba.FooterHelpItem { return footerItem("X", "button_settings", "Settings") }
|
||||
func FooterOptions() gaba.FooterHelpItem { return footerItem("X", "button_options", "Options") }
|
||||
func FooterLogout() gaba.FooterHelpItem { return footerItem("X", "button_logout", "Logout") }
|
||||
func FooterBIOS() gaba.FooterHelpItem { return footerItem("Y", "button_bios", "BIOS") }
|
||||
func FooterSaveSync() gaba.FooterHelpItem { return footerItem("Y", "button_save_sync", "Sync") }
|
||||
func FooterMenu() gaba.FooterHelpItem { return footerItem("Start", "button_menu", "Menu") }
|
||||
|
||||
func FooterStartConfirm() gaba.FooterHelpItem {
|
||||
return footerItem("Start", "button_confirm", "Confirm")
|
||||
}
|
||||
|
||||
func FooterSave() gaba.FooterHelpItem {
|
||||
return footerItem(icons.Start, "button_save", "Save")
|
||||
@@ -49,7 +35,3 @@ func ContinueFooter() []gaba.FooterHelpItem {
|
||||
func OptionsListFooter() []gaba.FooterHelpItem {
|
||||
return []gaba.FooterHelpItem{FooterCancel(), FooterCycle(), FooterSave()}
|
||||
}
|
||||
|
||||
func BackSelectFooter() []gaba.FooterHelpItem {
|
||||
return []gaba.FooterHelpItem{FooterBack(), FooterSelect()}
|
||||
}
|
||||
|
||||
+3
-3
@@ -314,7 +314,7 @@ func (s *GameListScreen) loadGames(input GameListInput) (loadGamesResult, error)
|
||||
|
||||
if ft == ftPlatform {
|
||||
cached, err = cm.GetPlatformGames(id)
|
||||
} else if ft == ftCollection {
|
||||
} else {
|
||||
cached, err = cm.GetCollectionGames(collection)
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ func (s *GameListScreen) loadGames(input GameListInput) (loadGamesResult, error)
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
roms, err := fetchList(config, host, id, ft)
|
||||
roms, err := fetchList(id, ft)
|
||||
if err != nil {
|
||||
logger.Error("Error downloading game list", "error", err)
|
||||
gamesFetchErr = err
|
||||
@@ -528,7 +528,7 @@ func (s *GameListScreen) showErrorMessage(err error) {
|
||||
)
|
||||
}
|
||||
|
||||
func fetchList(config *internal.Config, host romm.Host, queryID int, fetchType fetchType) ([]romm.Rom, error) {
|
||||
func fetchList(queryID int, fetchType fetchType) ([]romm.Rom, error) {
|
||||
logger := gaba.GetLogger()
|
||||
cm := cache.GetCacheManager()
|
||||
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ func (s *SaveSyncScreen) Draw(input SaveSyncInput) (SaveSyncOutput, error) {
|
||||
return scanResult{Syncs: syncs, Unmatched: unmatched, FuzzyMatches: fuzzyMatches}, nil
|
||||
})
|
||||
|
||||
var results []sync.SyncResult
|
||||
var results []sync.Result
|
||||
var unmatched []sync.UnmatchedSave
|
||||
|
||||
if scan, ok := scanData.(scanResult); ok {
|
||||
@@ -101,7 +101,7 @@ func (s *SaveSyncScreen) Draw(input SaveSyncInput) (SaveSyncOutput, error) {
|
||||
}
|
||||
}
|
||||
|
||||
results = make([]sync.SyncResult, 0, len(syncs))
|
||||
results = make([]sync.Result, 0, len(syncs))
|
||||
|
||||
if len(syncs) > 0 {
|
||||
progress := &atomic.Float64{}
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type syncReportInput struct {
|
||||
Results []sync.SyncResult
|
||||
Results []sync.Result
|
||||
Unmatched []sync.UnmatchedSave
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *SyncReportScreen) draw(input syncReportInput) (syncReportOutput, error)
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func (s *SyncReportScreen) buildSections(results []sync.SyncResult, unmatched []sync.UnmatchedSave) []gaba.Section {
|
||||
func (s *SyncReportScreen) buildSections(results []sync.Result, unmatched []sync.UnmatchedSave) []gaba.Section {
|
||||
logger := gaba.GetLogger()
|
||||
logger.Debug("Building sync report", "totalResults", len(results), "unmatched", len(unmatched))
|
||||
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ func CompareVersions(current, latest string) int {
|
||||
// Current is prerelease, latest is full release - latest is newer
|
||||
return -1
|
||||
}
|
||||
if currentHasPrerelease && latestHasPrerelease {
|
||||
if currentHasPrerelease {
|
||||
// Both are prereleases - compare prerelease strings lexicographically
|
||||
// For simplicity, we'll just do a string comparison
|
||||
// In practice, this handles cases like "beta.1" vs "beta.2"
|
||||
|
||||
Reference in New Issue
Block a user