diff --git a/bios/bios.go b/bios/bios.go index 9abc8f3..283c40e 100644 --- a/bios/bios.go +++ b/bios/bios.go @@ -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" diff --git a/bios/data/core_subdirectories.json b/bios/data/core_subdirectories.json deleted file mode 100644 index 56d6ae5..0000000 --- a/bios/data/core_subdirectories.json +++ /dev/null @@ -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" -} diff --git a/cache/artwork.go b/cache/artwork.go index 101fb4b..4897c3f 100644 --- a/cache/artwork.go +++ b/cache/artwork.go @@ -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 { diff --git a/cache/errors.go b/cache/errors.go index af752b5..a600d07 100644 --- a/cache/errors.go +++ b/cache/errors.go @@ -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 { diff --git a/cache/games.go b/cache/games.go index adffae3..8ac0111 100644 --- a/cache/games.go +++ b/cache/games.go @@ -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 { diff --git a/cache/manager.go b/cache/manager.go index 1fc443d..7c7ab46 100644 --- a/cache/manager.go +++ b/cache/manager.go @@ -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) diff --git a/internal/imageutil/imageutil.go b/internal/imageutil/imageutil.go index 866b60e..b9c4e23 100644 --- a/internal/imageutil/imageutil.go +++ b/internal/imageutil/imageutil.go @@ -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 } diff --git a/sync/auto_sync.go b/sync/auto_sync.go index 3da4848..c99eefb 100644 --- a/sync/auto_sync.go +++ b/sync/auto_sync.go @@ -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 { diff --git a/sync/roms.go b/sync/roms.go index 17f4833..485fb84 100644 --- a/sync/roms.go +++ b/sync/roms.go @@ -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 } diff --git a/sync/save_sync.go b/sync/save_sync.go index 483cdc7..ffcc435 100644 --- a/sync/save_sync.go +++ b/sync/save_sync.go @@ -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, diff --git a/ui/actions.go b/ui/actions.go index c6b97e8..24ba974 100644 --- a/ui/actions.go +++ b/ui/actions.go @@ -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 ) diff --git a/ui/download.go b/ui/download.go index 7dbb7de..9b5444a 100644 --- a/ui/download.go +++ b/ui/download.go @@ -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, diff --git a/ui/emulator_selection.go b/ui/emulator_selection.go index acaf298..553500d 100644 --- a/ui/emulator_selection.go +++ b/ui/emulator_selection.go @@ -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, diff --git a/ui/footer_helpers.go b/ui/footer_helpers.go index 87d469b..1da9bb5 100644 --- a/ui/footer_helpers.go +++ b/ui/footer_helpers.go @@ -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()} -} diff --git a/ui/games_list.go b/ui/games_list.go index 1308eaf..8610522 100644 --- a/ui/games_list.go +++ b/ui/games_list.go @@ -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() diff --git a/ui/save_sync.go b/ui/save_sync.go index 4e8aa59..9fb22ec 100644 --- a/ui/save_sync.go +++ b/ui/save_sync.go @@ -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{} diff --git a/ui/sync_report.go b/ui/sync_report.go index eb09ece..f742e72 100644 --- a/ui/sync_report.go +++ b/ui/sync_report.go @@ -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)) diff --git a/update/version.go b/update/version.go index f367dd1..4bef14f 100644 --- a/update/version.go +++ b/update/version.go @@ -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"