From a59f8dbfe2480da70963210ce976eb354df7a32a Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 09:51:32 +0800 Subject: [PATCH 1/9] Update system ID name, add MAME as alias for Arcade --- pkg/api/methods/media.go | 12 +- pkg/api/methods/run.go | 4 +- pkg/api/methods/systems.go | 2 +- pkg/configui/configui.go | 2 +- pkg/database/gamesdb/gamesdb.go | 30 +-- pkg/database/gamesdb/indexing.go | 6 +- pkg/database/systemdefs/systemdefs.go | 275 +++++++++++++------------- pkg/platforms/mister/tracker.go | 8 +- pkg/zapscript/launch.go | 4 +- 9 files changed, 172 insertions(+), 171 deletions(-) diff --git a/pkg/api/methods/media.go b/pkg/api/methods/media.go index 9db6d73b..2677ea06 100644 --- a/pkg/api/methods/media.go +++ b/pkg/api/methods/media.go @@ -73,9 +73,9 @@ func (s *IndexingStatus) GenerateMediaDB( if err != nil { s.CurrentDesc = status.SystemId } else { - md, err := assets.GetSystemMetadata(system.Id) + md, err := assets.GetSystemMetadata(system.ID) if err != nil { - s.CurrentDesc = system.Id + s.CurrentDesc = system.ID } else { s.CurrentDesc = md.Name } @@ -209,8 +209,8 @@ func HandleMediaSearch(env requests.RequestEnv) (any, error) { results = append(results, models.SearchResultMedia{ System: models.System{ - Id: system.Id, - Name: system.Id, + Id: system.ID, + Name: system.ID, }, Name: result.Name, Path: env.Platform.NormalizePath(env.Config, result.Path), @@ -283,13 +283,13 @@ func HandleUpdateActiveMedia(env requests.RequestEnv) (any, error) { return nil, fmt.Errorf("error looking up system: %w", err) } - systemMeta, err := assets.GetSystemMetadata(system.Id) + systemMeta, err := assets.GetSystemMetadata(system.ID) if err != nil { return nil, fmt.Errorf("error getting system metadata: %w", err) } activeMedia := models.ActiveMedia{ - SystemId: system.Id, + SystemId: system.ID, SystemName: systemMeta.Name, MediaName: params.MediaName, MediaPath: env.Platform.NormalizePath(env.Config, params.MediaPath), diff --git a/pkg/api/methods/run.go b/pkg/api/methods/run.go index 5198ad6a..c41495c2 100644 --- a/pkg/api/methods/run.go +++ b/pkg/api/methods/run.go @@ -244,13 +244,13 @@ func InstallRunMedia( var launchers []platforms.Launcher for _, l := range pl.Launchers() { - if l.SystemId == system.Id { + if l.SystemId == system.ID { launchers = append(launchers, l) } } if len(launchers) == 0 { - return "", fmt.Errorf("no launchers for system: %s", system.Id) + return "", fmt.Errorf("no launchers for system: %s", system.ID) } // just use the first launcher for now diff --git a/pkg/api/methods/systems.go b/pkg/api/methods/systems.go index 4bbe1f11..23a84de1 100644 --- a/pkg/api/methods/systems.go +++ b/pkg/api/methods/systems.go @@ -32,7 +32,7 @@ func HandleSystems(env requests.RequestEnv) (any, error) { } sr := models.System{ - Id: system.Id, + Id: system.ID, } sm, err := assets.GetSystemMetadata(id) diff --git a/pkg/configui/configui.go b/pkg/configui/configui.go index 89343bfc..922bf829 100644 --- a/pkg/configui/configui.go +++ b/pkg/configui/configui.go @@ -311,7 +311,7 @@ func BuildScanModeMenu(cfg *config.Instance, pages *tview.Pages, app *tview.Appl allSystems := []string{""} for _, item := range systemdefs.AllSystems() { - allSystems = append(allSystems, item.Id) + allSystems = append(allSystems, item.ID) } exitDelay := cfg.ReadersScan().ExitDelay diff --git a/pkg/database/gamesdb/gamesdb.go b/pkg/database/gamesdb/gamesdb.go index a22c0381..6e3b221d 100644 --- a/pkg/database/gamesdb/gamesdb.go +++ b/pkg/database/gamesdb/gamesdb.go @@ -197,7 +197,7 @@ func NewNamesIndex( filteredIds := make([]string, 0) for _, s := range systems { - filteredIds = append(filteredIds, s.Id) + filteredIds = append(filteredIds, s.ID) } indexed, err := readIndexedSystems(db) @@ -221,13 +221,13 @@ func NewNamesIndex( update(status) systemPaths := make(map[string][]string) for _, v := range GetSystemPaths(platform, platform.RootDirs(cfg), systems) { - systemPaths[v.System.Id] = append(systemPaths[v.System.Id], v.Path) + systemPaths[v.System.ID] = append(systemPaths[v.System.ID], v.Path) } g := new(errgroup.Group) scanned := make(map[string]bool) for _, s := range systemdefs.AllSystems() { - scanned[s.Id] = false + scanned[s.ID] = false } sysPathIds := utils.AlphaMapKeys(systemPaths) @@ -325,20 +325,20 @@ func NewNamesIndex( for _, l := range anyScanners { for _, s := range systems { - log.Debug().Msgf("running %s scanner for system: %s", l.Id, s.Id) - results, err := l.Scanner(cfg, s.Id, []platforms.ScanResult{}) + log.Debug().Msgf("running %s scanner for system: %s", l.Id, s.ID) + results, err := l.Scanner(cfg, s.ID, []platforms.ScanResult{}) if err != nil { - log.Error().Err(err).Msgf("error running %s scanner for system: %s", l.Id, s.Id) + log.Error().Err(err).Msgf("error running %s scanner for system: %s", l.Id, s.ID) continue } - log.Debug().Msgf("scanned %d files for system: %s", len(results), s.Id) + log.Debug().Msgf("scanned %d files for system: %s", len(results), s.ID) if len(results) > 0 { status.Files += len(results) - scanned[s.Id] = true + scanned[s.ID] = true - systemId := s.Id + systemId := s.ID g.Go(func() error { fis := make([]fileInfo, 0) for _, p := range results { @@ -416,7 +416,7 @@ func searchNamesGeneric( bn := tx.Bucket([]byte(BucketNames)) for _, system := range systems { - pre := []byte(system.Id + ":") + pre := []byte(system.ID + ":") nameIdx := bytes.Index(pre, []byte(":")) c := bn.Cursor() @@ -425,7 +425,7 @@ func searchNamesGeneric( if test(query, keyName) { results = append(results, SearchResult{ - SystemId: system.Id, + SystemId: system.ID, Name: keyName, Path: string(v), }) @@ -535,7 +535,7 @@ func SystemIndexed(platform platforms.Platform, system systemdefs.System) bool { return false } - return utils.Contains(systems, system.Id) + return utils.Contains(systems, system.ID) } // Return all systems indexed in the gamesdb @@ -592,14 +592,14 @@ func RandomGame(platform platforms.Platform, systems []systemdefs.System) (Searc err = db.View(func(tx *bolt.Tx) error { bn := tx.Bucket([]byte(BucketNames)) - pre := []byte(system.Id + ":") + pre := []byte(system.ID + ":") nameIdx := bytes.Index(pre, []byte(":")) c := bn.Cursor() for k, v := c.Seek(pre); k != nil && bytes.HasPrefix(k, pre); k, v = c.Next() { keyName := string(k[nameIdx+1:]) possible = append(possible, SearchResult{ - SystemId: system.Id, + SystemId: system.ID, Name: keyName, Path: string(v), }) @@ -612,7 +612,7 @@ func RandomGame(platform platforms.Platform, systems []systemdefs.System) (Searc } if len(possible) == 0 { - return result, fmt.Errorf("no games found for system: %s", system.Id) + return result, fmt.Errorf("no games found for system: %s", system.ID) } result, err = utils.RandomElem(possible) diff --git a/pkg/database/gamesdb/indexing.go b/pkg/database/gamesdb/indexing.go index 1133b3aa..4b75451f 100644 --- a/pkg/database/gamesdb/indexing.go +++ b/pkg/database/gamesdb/indexing.go @@ -52,7 +52,7 @@ func GetSystemPaths(pl platforms.Platform, rootFolders []string, systems []syste for _, system := range systems { var launchers []platforms.Launcher for _, l := range pl.Launchers() { - if l.SystemId == system.Id { + if l.SystemId == system.ID { launchers = append(launchers, l) } } @@ -200,13 +200,13 @@ func GetFiles( for i := range zipFiles { abs := filepath.Join(path, zipFiles[i]) - if utils.MatchSystemFile(cfg, platform, (*system).Id, abs) { + if utils.MatchSystemFile(cfg, platform, (*system).ID, abs) { *results = append(*results, abs) } } } else { // regular files - if utils.MatchSystemFile(cfg, platform, (*system).Id, path) { + if utils.MatchSystemFile(cfg, platform, (*system).ID, path) { *results = append(*results, path) } } diff --git a/pkg/database/systemdefs/systemdefs.go b/pkg/database/systemdefs/systemdefs.go index b2c772a9..4e4fc28c 100644 --- a/pkg/database/systemdefs/systemdefs.go +++ b/pkg/database/systemdefs/systemdefs.go @@ -16,7 +16,7 @@ import ( // be used to attempt to associate a file with a system. type System struct { - Id string + ID string Aliases []string } @@ -208,456 +208,457 @@ const ( var Systems = map[string]System{ // Consoles System3DO: { - Id: System3DO, + ID: System3DO, }, System3DS: { - Id: System3DS, + ID: System3DS, }, SystemAdventureVision: { - Id: SystemAdventureVision, + ID: SystemAdventureVision, Aliases: []string{"AVision"}, }, SystemArcadia: { - Id: SystemArcadia, + ID: SystemArcadia, }, SystemAmigaCD32: { - Id: SystemAmigaCD32, + ID: SystemAmigaCD32, }, SystemAstrocade: { - Id: SystemAstrocade, + ID: SystemAstrocade, }, SystemAtari2600: { - Id: SystemAtari2600, + ID: SystemAtari2600, }, SystemAtari5200: { - Id: SystemAtari5200, + ID: SystemAtari5200, }, SystemAtari7800: { - Id: SystemAtari7800, + ID: SystemAtari7800, }, SystemAtariLynx: { - Id: SystemAtariLynx, + ID: SystemAtariLynx, }, SystemAtariXEGS: { - Id: SystemAtariXEGS, + ID: SystemAtariXEGS, }, SystemCasioPV1000: { - Id: SystemCasioPV1000, + ID: SystemCasioPV1000, Aliases: []string{"Casio_PV-1000"}, }, SystemCDI: { - Id: SystemCDI, + ID: SystemCDI, Aliases: []string{"CD-i"}, }, SystemChannelF: { - Id: SystemChannelF, + ID: SystemChannelF, }, SystemColecoVision: { - Id: SystemColecoVision, + ID: SystemColecoVision, Aliases: []string{"Coleco"}, }, SystemCreatiVision: { - Id: SystemCreatiVision, + ID: SystemCreatiVision, }, SystemDreamcast: { - Id: SystemDreamcast, + ID: SystemDreamcast, }, SystemFDS: { - Id: SystemFDS, + ID: SystemFDS, Aliases: []string{"FamicomDiskSystem"}, }, SystemGamate: { - Id: SystemGamate, + ID: SystemGamate, }, SystemGameboy: { - Id: SystemGameboy, + ID: SystemGameboy, Aliases: []string{"GB"}, }, SystemGameboyColor: { - Id: SystemGameboyColor, + ID: SystemGameboyColor, Aliases: []string{"GBC"}, }, SystemGameboy2P: { // TODO: Split 2P core into GB and GBC? - Id: SystemGameboy2P, + ID: SystemGameboy2P, }, SystemGameCube: { - Id: SystemGameCube, + ID: SystemGameCube, }, SystemGameGear: { - Id: SystemGameGear, + ID: SystemGameGear, Aliases: []string{"GG"}, }, SystemGameNWatch: { - Id: SystemGameNWatch, + ID: SystemGameNWatch, }, SystemGameCom: { - Id: SystemGameCom, + ID: SystemGameCom, }, SystemGBA: { - Id: SystemGBA, + ID: SystemGBA, Aliases: []string{"GameboyAdvance"}, }, SystemGBA2P: { - Id: SystemGBA2P, + ID: SystemGBA2P, }, SystemGenesis: { - Id: SystemGenesis, + ID: SystemGenesis, Aliases: []string{"MegaDrive"}, }, SystemIntellivision: { - Id: SystemIntellivision, + ID: SystemIntellivision, }, SystemJaguar: { - Id: SystemJaguar, + ID: SystemJaguar, }, SystemJaguarCD: { - Id: SystemJaguarCD, + ID: SystemJaguarCD, }, SystemMasterSystem: { - Id: SystemMasterSystem, + ID: SystemMasterSystem, Aliases: []string{"SMS"}, }, SystemMegaCD: { - Id: SystemMegaCD, + ID: SystemMegaCD, Aliases: []string{"SegaCD"}, }, SystemMegaDuck: { - Id: SystemMegaDuck, + ID: SystemMegaDuck, }, SystemNDS: { - Id: SystemNDS, + ID: SystemNDS, Aliases: []string{"NintendoDS"}, }, SystemNeoGeo: { - Id: SystemNeoGeo, + ID: SystemNeoGeo, }, SystemNeoGeoCD: { - Id: SystemNeoGeoCD, + ID: SystemNeoGeoCD, }, SystemNeoGeoPocket: { - Id: SystemNeoGeoPocket, + ID: SystemNeoGeoPocket, }, SystemNeoGeoPocketColor: { - Id: SystemNeoGeoPocketColor, + ID: SystemNeoGeoPocketColor, }, SystemNES: { - Id: SystemNES, + ID: SystemNES, }, SystemNESMusic: { - Id: SystemNESMusic, + ID: SystemNESMusic, }, SystemNintendo64: { - Id: SystemNintendo64, + ID: SystemNintendo64, Aliases: []string{"N64"}, }, SystemOdyssey2: { - Id: SystemOdyssey2, + ID: SystemOdyssey2, }, SystemOuya: { - Id: SystemOuya, + ID: SystemOuya, }, SystemPocketChallengeV2: { - Id: SystemPocketChallengeV2, + ID: SystemPocketChallengeV2, }, SystemPokemonMini: { - Id: SystemPokemonMini, + ID: SystemPokemonMini, }, SystemPSX: { - Id: SystemPSX, + ID: SystemPSX, Aliases: []string{"Playstation", "PS1"}, }, SystemPS2: { - Id: SystemPS2, + ID: SystemPS2, Aliases: []string{"Playstation2"}, }, SystemPS3: { - Id: SystemPS3, + ID: SystemPS3, Aliases: []string{"Playstation3"}, }, SystemPS4: { - Id: SystemPS4, + ID: SystemPS4, Aliases: []string{"Playstation4"}, }, SystemPS5: { - Id: SystemPS5, + ID: SystemPS5, Aliases: []string{"Playstation5"}, }, SystemPSP: { - Id: SystemPSP, + ID: SystemPSP, Aliases: []string{"PlaystationPortable"}, }, SystemSega32X: { - Id: SystemSega32X, + ID: SystemSega32X, Aliases: []string{"S32X", "32X"}, }, SystemSeriesXS: { - Id: SystemSeriesXS, + ID: SystemSeriesXS, Aliases: []string{"SeriesX", "SeriesS"}, }, SystemSG1000: { - Id: SystemSG1000, + ID: SystemSG1000, }, SystemSuperGameboy: { - Id: SystemSuperGameboy, + ID: SystemSuperGameboy, Aliases: []string{"SGB"}, }, SystemSuperVision: { - Id: SystemSuperVision, + ID: SystemSuperVision, }, SystemSaturn: { - Id: SystemSaturn, + ID: SystemSaturn, }, SystemSNES: { - Id: SystemSNES, + ID: SystemSNES, Aliases: []string{"SuperNintendo"}, }, SystemSNESMusic: { - Id: SystemSNESMusic, + ID: SystemSNESMusic, }, SystemSuperGrafx: { - Id: SystemSuperGrafx, + ID: SystemSuperGrafx, }, SystemSwitch: { - Id: SystemSwitch, + ID: SystemSwitch, Aliases: []string{"NintendoSwitch"}, }, SystemTurboGrafx16: { - Id: SystemTurboGrafx16, + ID: SystemTurboGrafx16, Aliases: []string{"TGFX16", "PCEngine"}, }, SystemTurboGrafx16CD: { - Id: SystemTurboGrafx16CD, + ID: SystemTurboGrafx16CD, Aliases: []string{"TGFX16-CD", "PCEngineCD"}, }, SystemVC4000: { - Id: SystemVC4000, + ID: SystemVC4000, }, SystemVectrex: { - Id: SystemVectrex, + ID: SystemVectrex, }, SystemVirtualBoy: { - Id: SystemVirtualBoy, + ID: SystemVirtualBoy, }, SystemVita: { - Id: SystemVita, + ID: SystemVita, Aliases: []string{"PSVita"}, }, SystemWii: { - Id: SystemWii, + ID: SystemWii, Aliases: []string{"NintendoWii"}, }, SystemWiiU: { - Id: SystemWiiU, + ID: SystemWiiU, Aliases: []string{"NintendoWiiU"}, }, SystemWonderSwan: { - Id: SystemWonderSwan, + ID: SystemWonderSwan, }, SystemWonderSwanColor: { - Id: SystemWonderSwanColor, + ID: SystemWonderSwanColor, }, SystemXbox: { - Id: SystemXbox, + ID: SystemXbox, }, SystemXbox360: { - Id: SystemXbox360, + ID: SystemXbox360, }, SystemXboxOne: { - Id: SystemXboxOne, + ID: SystemXboxOne, }, // Computers SystemAcornAtom: { - Id: SystemAcornAtom, + ID: SystemAcornAtom, }, SystemAcornElectron: { - Id: SystemAcornElectron, + ID: SystemAcornElectron, }, SystemAliceMC10: { - Id: SystemAliceMC10, + ID: SystemAliceMC10, }, SystemAmiga: { - Id: SystemAmiga, + ID: SystemAmiga, Aliases: []string{"Minimig"}, }, SystemAmstrad: { - Id: SystemAmstrad, + ID: SystemAmstrad, }, SystemAmstradPCW: { - Id: SystemAmstradPCW, + ID: SystemAmstradPCW, Aliases: []string{"Amstrad-PCW"}, }, SystemDOS: { - Id: SystemDOS, + ID: SystemDOS, Aliases: []string{"ao486", "MS-DOS"}, }, SystemApogee: { - Id: SystemApogee, + ID: SystemApogee, }, SystemAppleI: { - Id: SystemAppleI, + ID: SystemAppleI, Aliases: []string{"Apple-I"}, }, SystemAppleII: { - Id: SystemAppleII, + ID: SystemAppleII, Aliases: []string{"Apple-II"}, }, SystemAquarius: { - Id: SystemAquarius, + ID: SystemAquarius, }, SystemAtari800: { - Id: SystemAtari800, + ID: SystemAtari800, }, SystemBBCMicro: { - Id: SystemBBCMicro, + ID: SystemBBCMicro, }, SystemBK0011M: { - Id: SystemBK0011M, + ID: SystemBK0011M, }, SystemC16: { - Id: SystemC16, + ID: SystemC16, }, SystemC64: { - Id: SystemC64, + ID: SystemC64, }, SystemCasioPV2000: { - Id: SystemCasioPV2000, + ID: SystemCasioPV2000, Aliases: []string{"Casio_PV-2000"}, }, SystemCoCo2: { - Id: SystemCoCo2, + ID: SystemCoCo2, }, SystemEDSAC: { - Id: SystemEDSAC, + ID: SystemEDSAC, }, SystemGalaksija: { - Id: SystemGalaksija, + ID: SystemGalaksija, }, SystemInteract: { - Id: SystemInteract, + ID: SystemInteract, }, SystemJupiter: { - Id: SystemJupiter, + ID: SystemJupiter, }, SystemLaser: { - Id: SystemLaser, + ID: SystemLaser, Aliases: []string{"Laser310"}, }, SystemLynx48: { - Id: SystemLynx48, + ID: SystemLynx48, }, SystemMacPlus: { - Id: SystemMacPlus, + ID: SystemMacPlus, }, SystemMacOS: { - Id: SystemMacOS, + ID: SystemMacOS, }, SystemMSX: { - Id: SystemMSX, + ID: SystemMSX, }, SystemMultiComp: { - Id: SystemMultiComp, + ID: SystemMultiComp, }, SystemOrao: { - Id: SystemOrao, + ID: SystemOrao, }, SystemOric: { - Id: SystemOric, + ID: SystemOric, }, SystemPC: { - Id: SystemPC, + ID: SystemPC, }, SystemPCXT: { - Id: SystemPCXT, + ID: SystemPCXT, }, SystemPDP1: { - Id: SystemPDP1, + ID: SystemPDP1, }, SystemPET2001: { - Id: SystemPET2001, + ID: SystemPET2001, }, SystemPMD85: { - Id: SystemPMD85, + ID: SystemPMD85, }, SystemQL: { - Id: SystemQL, + ID: SystemQL, }, SystemRX78: { - Id: SystemRX78, + ID: SystemRX78, }, SystemSAMCoupe: { - Id: SystemSAMCoupe, + ID: SystemSAMCoupe, }, SystemSordM5: { - Id: SystemSordM5, + ID: SystemSordM5, Aliases: []string{"Sord M5"}, }, SystemSpecialist: { - Id: SystemSpecialist, + ID: SystemSpecialist, Aliases: []string{"SPMX"}, }, SystemSVI328: { - Id: SystemSVI328, + ID: SystemSVI328, }, SystemTatungEinstein: { - Id: SystemTatungEinstein, + ID: SystemTatungEinstein, }, SystemTI994A: { - Id: SystemTI994A, + ID: SystemTI994A, Aliases: []string{"TI-99_4A"}, }, SystemTomyTutor: { - Id: SystemTomyTutor, + ID: SystemTomyTutor, }, SystemTRS80: { - Id: SystemTRS80, + ID: SystemTRS80, }, SystemTSConf: { - Id: SystemTSConf, + ID: SystemTSConf, }, SystemUK101: { - Id: SystemUK101, + ID: SystemUK101, }, SystemVector06C: { - Id: SystemVector06C, + ID: SystemVector06C, Aliases: []string{"Vector06"}, }, SystemVIC20: { - Id: SystemVIC20, + ID: SystemVIC20, }, SystemX68000: { - Id: SystemX68000, + ID: SystemX68000, }, SystemZX81: { - Id: SystemZX81, + ID: SystemZX81, }, SystemZXSpectrum: { - Id: SystemZXSpectrum, + ID: SystemZXSpectrum, Aliases: []string{"Spectrum"}, }, SystemZXNext: { - Id: SystemZXNext, + ID: SystemZXNext, }, // Other SystemAndroid: { - Id: SystemAndroid, + ID: SystemAndroid, }, SystemArcade: { - Id: SystemArcade, + ID: SystemArcade, + Aliases: []string{"MAME"}, }, SystemArduboy: { - Id: SystemArduboy, + ID: SystemArduboy, }, SystemChip8: { - Id: SystemChip8, + ID: SystemChip8, }, SystemGroovy: { - Id: SystemGroovy, + ID: SystemGroovy, }, SystemIOS: { - Id: SystemIOS, + ID: SystemIOS, }, SystemVideo: { - Id: SystemVideo, + ID: SystemVideo, }, } diff --git a/pkg/platforms/mister/tracker.go b/pkg/platforms/mister/tracker.go index 6f4b10bf..245f417a 100644 --- a/pkg/platforms/mister/tracker.go +++ b/pkg/platforms/mister/tracker.go @@ -289,24 +289,24 @@ func (tr *Tracker) loadGame() { return } - meta, err := assets.GetSystemMetadata(system.Id) + meta, err := assets.GetSystemMetadata(system.ID) if err != nil { log.Error().Msgf("error getting system metadata %s", err) return } - id := fmt.Sprintf("%s/%s", system.Id, filename) + id := fmt.Sprintf("%s/%s", system.ID, filename) if id != tr.ActiveGameId { tr.ActiveGameId = id tr.ActiveGameName = name tr.ActiveGamePath = path - tr.ActiveSystem = system.Id + tr.ActiveSystem = system.ID tr.ActiveSystemName = meta.Name notifications.MediaStarted(tr.ns, models.MediaStartedParams{ - SystemID: system.Id, + SystemID: system.ID, SystemName: meta.Name, MediaName: name, MediaPath: path, diff --git a/pkg/zapscript/launch.go b/pkg/zapscript/launch.go index 2173b28e..65cdfe44 100644 --- a/pkg/zapscript/launch.go +++ b/pkg/zapscript/launch.go @@ -222,7 +222,7 @@ func cmdLaunch(pl platforms.Platform, env platforms.CmdEnv) (platforms.CmdResult var launchers []platforms.Launcher for _, l := range pl.Launchers() { - if l.SystemId == system.Id { + if l.SystemId == system.ID { launchers = append(launchers, l) } } @@ -255,7 +255,7 @@ func cmdLaunch(pl platforms.Platform, env platforms.CmdEnv) (platforms.CmdResult // TODO: passthrough advanced args return cmdSearch(pl, env) } else { - log.Info().Msgf("searching in %s: %s", system.Id, path) + log.Info().Msgf("searching in %s: %s", system.ID, path) // treat as a direct title launch res, err := gamesdb.SearchNamesExact( pl, From 66fe0d06d97da09a6c7685ba1c51482f24db5ec3 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 10:28:47 +0800 Subject: [PATCH 2/9] Fix makezip dirs handling --- scripts/tasks/makezip.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/tasks/makezip.py b/scripts/tasks/makezip.py index f261b9c9..0639ed94 100755 --- a/scripts/tasks/makezip.py +++ b/scripts/tasks/makezip.py @@ -20,7 +20,9 @@ "steamos": "steamos.md", "windows": "windows/index.md" } -extra_files: dict[str, list[str]] = { +# files will be copied to the root of the zip +# dirs will copy the entire dir and preserve the structure +extra_items: dict[str, list[str]] = { "batocera": ["cmd/batocera/scripts"] } @@ -76,9 +78,7 @@ def download_doc(platform_id: str, to_dir: str): os.remove(zip_path) readme_path = os.path.join(build_dir, "README.txt") - if os.path.exists(readme_path): - print(f"File '{readme_path}' already exists. Skipping download.") - else: + if not os.path.exists(readme_path): download_doc(platform, build_dir) with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as dist: @@ -86,10 +86,19 @@ def download_doc(platform_id: str, to_dir: str): dist.write(license_path, arcname=os.path.basename(license_path)) dist.write(readme_path, arcname=os.path.basename(readme_path)) - if platform in extra_files: - for file in extra_files[platform]: - if os.path.isfile(file): - shutil.copy(file, build_dir) - if os.path.isdir(file): - shutil.copytree(file, build_dir, dirs_exist_ok=True) - dist.write(file, arcname=os.path.basename(file)) + if platform in extra_items: + for item in extra_items[platform]: + if os.path.isfile(item): + # copy single files to the root of the zip + extra_file = os.path.join(build_dir, os.path.basename(item)) + shutil.copy(item, build_dir) + dist.write(extra_file, arcname=os.path.basename(item)) + if os.path.isdir(item): + extra_dir = os.path.join(build_dir, os.path.basename(item)) + if not os.path.exists(extra_dir): + os.makedirs(extra_dir) + shutil.copytree(item, extra_dir, dirs_exist_ok=True) + for root, dirs, files in os.walk(extra_dir): + for file in files: + path = str(os.path.join(root, file)) + dist.write(path, arcname=os.path.join(os.path.relpath(root, build_dir), file)) From 30a3a96e2541981df73cc939098e3231812a19d8 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 10:39:02 +0800 Subject: [PATCH 3/9] Add MSU-1 system --- pkg/assets/systems/MSU1.json | 7 +++++++ pkg/database/systemdefs/systemdefs.go | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 pkg/assets/systems/MSU1.json diff --git a/pkg/assets/systems/MSU1.json b/pkg/assets/systems/MSU1.json new file mode 100644 index 00000000..961603da --- /dev/null +++ b/pkg/assets/systems/MSU1.json @@ -0,0 +1,7 @@ +{ + "id": "MSU1", + "name": "SNES MSU-1", + "category": "Console", + "releaseDate": "2012-05-25", + "manufacturer": "Nintendo" +} diff --git a/pkg/database/systemdefs/systemdefs.go b/pkg/database/systemdefs/systemdefs.go index 4e4fc28c..01cc257c 100644 --- a/pkg/database/systemdefs/systemdefs.go +++ b/pkg/database/systemdefs/systemdefs.go @@ -119,6 +119,7 @@ const ( SystemSuperVision = "SuperVision" SystemSaturn = "Saturn" SystemSNES = "SNES" + SystemSNESMSU1 = "SNESMSU1" SystemSNESMusic = "SNESMusic" SystemSuperGrafx = "SuperGrafx" SystemSwitch = "Switch" @@ -412,6 +413,10 @@ var Systems = map[string]System{ ID: SystemSNES, Aliases: []string{"SuperNintendo"}, }, + SystemSNESMSU1: { + ID: SystemSNESMSU1, + Aliases: []string{"MSU1", "MSU-1"}, + }, SystemSNESMusic: { ID: SystemSNESMusic, }, From d41a1dd63ff41c89ff40f5612504b52b96ea3334 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 10:41:24 +0800 Subject: [PATCH 4/9] Fix SNES indexing issue --- pkg/platforms/batocera/systemmap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/platforms/batocera/systemmap.go b/pkg/platforms/batocera/systemmap.go index eca3124d..380c1d03 100644 --- a/pkg/platforms/batocera/systemmap.go +++ b/pkg/platforms/batocera/systemmap.go @@ -129,7 +129,7 @@ var SystemMap = map[string]string{ "sg1000": systemdefs.SystemSG1000, "sgb": systemdefs.SystemSuperGameboy, "snes": systemdefs.SystemSNES, - "snes-msu1": systemdefs.SystemSNES, + "snes-msu1": systemdefs.SystemSNESMSU1, "supergrafx": systemdefs.SystemSuperGrafx, "supervision": systemdefs.SystemSuperVision, "ti99": systemdefs.SystemTI994A, From 4dac3df8a1ad0920e5d0f5512a35f47cba830a21 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 10:51:57 +0800 Subject: [PATCH 5/9] Fix scanning Batocera launchers with duplicate systems --- pkg/platforms/batocera/platform.go | 28 +++++++++++++++------------- pkg/platforms/batocera/systemmap.go | 21 ++++++++------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/pkg/platforms/batocera/platform.go b/pkg/platforms/batocera/platform.go index 36f2566a..a86ff737 100644 --- a/pkg/platforms/batocera/platform.go +++ b/pkg/platforms/batocera/platform.go @@ -432,23 +432,25 @@ func (p *Platform) Launchers() []platforms.Launcher { systemID string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error) { - batSysName, err := toBatoceraSystem(systemID) + batSysNames, err := toBatoceraSystems(systemID) if err != nil { return nil, err } - for _, rootDir := range p.RootDirs(cfg) { - gameListPath := filepath.Join(rootDir, batSysName, "gamelist.xml") - gameList, err := readESGameListXML(gameListPath) - if err != nil { - log.Error().Msgf("error reading gamelist.xml: %s", err) - continue - } - for _, game := range gameList.Games { - results = append(results, platforms.ScanResult{ - Name: game.Name, - Path: filepath.Join(rootDir, batSysName, game.Path), - }) + for _, batSysName := range batSysNames { + for _, rootDir := range p.RootDirs(cfg) { + gameListPath := filepath.Join(rootDir, batSysName, "gamelist.xml") + gameList, err := readESGameListXML(gameListPath) + if err != nil { + log.Error().Msgf("error reading gamelist.xml: %s", err) + continue + } + for _, game := range gameList.Games { + results = append(results, platforms.ScanResult{ + Name: game.Name, + Path: filepath.Join(rootDir, batSysName, game.Path), + }) + } } } diff --git a/pkg/platforms/batocera/systemmap.go b/pkg/platforms/batocera/systemmap.go index 380c1d03..72825b20 100644 --- a/pkg/platforms/batocera/systemmap.go +++ b/pkg/platforms/batocera/systemmap.go @@ -3,6 +3,7 @@ package batocera import ( "fmt" "github.com/ZaparooProject/zaparoo-core/pkg/database/systemdefs" + "strings" ) var SystemMap = map[string]string{ @@ -147,14 +148,6 @@ var SystemMap = map[string]string{ "zxspectrum": systemdefs.SystemZXSpectrum, } -var ReverseSystemMap = map[string]string{} - -func init() { - for k, v := range SystemMap { - ReverseSystemMap[v] = k - } -} - func fromBatoceraSystem(batoceraSystem string) (string, error) { v, ok := SystemMap[batoceraSystem] if !ok { @@ -163,10 +156,12 @@ func fromBatoceraSystem(batoceraSystem string) (string, error) { return v, nil } -func toBatoceraSystem(zaparooSystem string) (string, error) { - v, ok := ReverseSystemMap[zaparooSystem] - if !ok { - return "", fmt.Errorf("unknown system: %s", zaparooSystem) +func toBatoceraSystems(zaparooSystem string) ([]string, error) { + var results []string + for k, v := range SystemMap { + if strings.EqualFold(zaparooSystem, v) { + results = append(results, k) + } } - return v, nil + return results, nil } From c7e9ca5b8e5231d6e278137f2a781c9c4219fd7c Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 11:31:42 +0800 Subject: [PATCH 6/9] MiSTer-like normalize path on Batocera --- pkg/api/methods/run.go | 2 +- pkg/database/gamesdb/gamesdb.go | 6 +- pkg/database/gamesdb/indexing.go | 2 +- pkg/platforms/batocera/platform.go | 38 +++- pkg/platforms/mister/launchers.go | 274 ++++++++++++++--------------- pkg/platforms/mister/platform.go | 6 +- pkg/platforms/mister/tracker.go | 2 +- pkg/platforms/platforms.go | 2 +- pkg/platforms/steamos/platform.go | 2 +- pkg/platforms/windows/platform.go | 4 +- pkg/service/readers.go | 4 +- pkg/utils/paths.go | 2 +- pkg/zapscript/launch.go | 3 +- 13 files changed, 190 insertions(+), 157 deletions(-) diff --git a/pkg/api/methods/run.go b/pkg/api/methods/run.go index c41495c2..3a16379c 100644 --- a/pkg/api/methods/run.go +++ b/pkg/api/methods/run.go @@ -244,7 +244,7 @@ func InstallRunMedia( var launchers []platforms.Launcher for _, l := range pl.Launchers() { - if l.SystemId == system.ID { + if l.SystemID == system.ID { launchers = append(launchers, l) } } diff --git a/pkg/database/gamesdb/gamesdb.go b/pkg/database/gamesdb/gamesdb.go index 6e3b221d..3ea1addf 100644 --- a/pkg/database/gamesdb/gamesdb.go +++ b/pkg/database/gamesdb/gamesdb.go @@ -257,7 +257,7 @@ func NewNamesIndex( // for each system launcher in platform, run the results through its // custom scan function if one exists for _, l := range platform.Launchers() { - if l.SystemId == k && l.Scanner != nil { + if l.SystemID == k && l.Scanner != nil { log.Debug().Msgf("running %s scanner for system: %s", l.Id, systemId) files, err = l.Scanner(cfg, systemId, files) if err != nil { @@ -288,7 +288,7 @@ func NewNamesIndex( // run each custom scanner at least once, even if there are no paths // defined or results from regular index for _, l := range platform.Launchers() { - systemId := l.SystemId + systemId := l.SystemID if !scanned[systemId] && l.Scanner != nil { log.Debug().Msgf("running %s scanner for system: %s", l.Id, systemId) results, err := l.Scanner(cfg, systemId, []platforms.ScanResult{}) @@ -318,7 +318,7 @@ func NewNamesIndex( // launcher scanners with no system defined are run against every system var anyScanners []platforms.Launcher for _, l := range platform.Launchers() { - if l.SystemId == "" && l.Scanner != nil { + if l.SystemID == "" && l.Scanner != nil { anyScanners = append(anyScanners, l) } } diff --git a/pkg/database/gamesdb/indexing.go b/pkg/database/gamesdb/indexing.go index 4b75451f..506faf14 100644 --- a/pkg/database/gamesdb/indexing.go +++ b/pkg/database/gamesdb/indexing.go @@ -52,7 +52,7 @@ func GetSystemPaths(pl platforms.Platform, rootFolders []string, systems []syste for _, system := range systems { var launchers []platforms.Launcher for _, l := range pl.Launchers() { - if l.SystemId == system.ID { + if l.SystemID == system.ID { launchers = append(launchers, l) } } diff --git a/pkg/platforms/batocera/platform.go b/pkg/platforms/batocera/platform.go index a86ff737..eb181715 100644 --- a/pkg/platforms/batocera/platform.go +++ b/pkg/platforms/batocera/platform.go @@ -163,7 +163,38 @@ func (p *Platform) TempDir() string { } func (p *Platform) NormalizePath(_ *config.Instance, path string) string { - return path + originalPath := path + newPath := strings.ReplaceAll(path, "\\", "/") + lowerPath := strings.ToLower(newPath) + + gotRoot := false + for _, rootDir := range p.RootDirs(nil) { + rootDir = strings.ReplaceAll(rootDir, "\\", "/") + rootDir = strings.ToLower(rootDir) + if strings.HasPrefix(lowerPath, rootDir) { + gotRoot = true + newPath = path[len(rootDir):] + if newPath[0] == '/' { + newPath = newPath[1:] + } + break + } + } + if !gotRoot { + return originalPath + } + + parts := strings.Split(newPath, "/") + if len(parts) < 2 { + return originalPath + } + + system, err := fromBatoceraSystem(parts[0]) + if err != nil || system == "" { + return originalPath + } + + return system + "/" + strings.Join(parts[1:], "/") } func (p *Platform) KillLauncher() error { @@ -422,8 +453,9 @@ func (p *Platform) Launchers() []platforms.Launcher { for k, v := range SystemMap { launchers = append(launchers, platforms.Launcher{ - Id: v, - Folders: []string{k}, + Id: v, + SystemID: v, + Folders: []string{k}, Launch: func(cfg *config.Instance, path string) error { return apiLaunch(path) }, diff --git a/pkg/platforms/mister/launchers.go b/pkg/platforms/mister/launchers.go index d84c936f..9ed1500c 100644 --- a/pkg/platforms/mister/launchers.go +++ b/pkg/platforms/mister/launchers.go @@ -340,512 +340,512 @@ var Launchers = []platforms.Launcher{ // Consoles { Id: systemdefs.SystemAdventureVision, - SystemId: systemdefs.SystemAdventureVision, + SystemID: systemdefs.SystemAdventureVision, Folders: []string{"AVision"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemAdventureVision), }, { Id: systemdefs.SystemArcadia, - SystemId: systemdefs.SystemArcadia, + SystemID: systemdefs.SystemArcadia, Folders: []string{"Arcadia"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemArcadia), }, { Id: systemdefs.SystemAmigaCD32, - SystemId: systemdefs.SystemAmigaCD32, + SystemID: systemdefs.SystemAmigaCD32, Folders: []string{"AmigaCD32"}, Extensions: []string{".cue", ".chd"}, Launch: launch(systemdefs.SystemAmigaCD32), }, { Id: systemdefs.SystemAstrocade, - SystemId: systemdefs.SystemAstrocade, + SystemID: systemdefs.SystemAstrocade, Folders: []string{"Astrocade"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemAstrocade), }, { Id: systemdefs.SystemAtari2600, - SystemId: systemdefs.SystemAtari2600, + SystemID: systemdefs.SystemAtari2600, Folders: []string{"ATARI7800", "Atari2600"}, Extensions: []string{".a26"}, Launch: launch(systemdefs.SystemAtari2600), }, { Id: "LLAPIAtari2600", - SystemId: systemdefs.SystemAtari2600, + SystemID: systemdefs.SystemAtari2600, Launch: launchAltCore(systemdefs.SystemAtari2600, "_LLAPI/Atari7800_LLAPI"), }, { Id: systemdefs.SystemAtari5200, - SystemId: systemdefs.SystemAtari5200, + SystemID: systemdefs.SystemAtari5200, Folders: []string{"ATARI5200"}, Extensions: []string{".a52"}, Launch: launch(systemdefs.SystemAtari5200), }, { Id: systemdefs.SystemAtari7800, - SystemId: systemdefs.SystemAtari7800, + SystemID: systemdefs.SystemAtari7800, Folders: []string{"ATARI7800"}, Extensions: []string{".a78"}, Launch: launch(systemdefs.SystemAtari7800), }, { Id: "LLAPIAtari7800", - SystemId: systemdefs.SystemAtari7800, + SystemID: systemdefs.SystemAtari7800, Launch: launchAltCore(systemdefs.SystemAtari7800, "_LLAPI/Atari7800_LLAPI"), }, { Id: systemdefs.SystemAtariLynx, - SystemId: systemdefs.SystemAtariLynx, + SystemID: systemdefs.SystemAtariLynx, Folders: []string{"AtariLynx"}, Extensions: []string{".lnx"}, Launch: launch(systemdefs.SystemAtariLynx), }, { Id: systemdefs.SystemCasioPV1000, - SystemId: systemdefs.SystemCasioPV1000, + SystemID: systemdefs.SystemCasioPV1000, Folders: []string{"Casio_PV-1000"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemCasioPV1000), }, { Id: systemdefs.SystemCDI, - SystemId: systemdefs.SystemCDI, + SystemID: systemdefs.SystemCDI, Folders: []string{"CD-i"}, Extensions: []string{".cue", ".chd"}, Launch: launch(systemdefs.SystemCDI), }, { Id: systemdefs.SystemChannelF, - SystemId: systemdefs.SystemChannelF, + SystemID: systemdefs.SystemChannelF, Folders: []string{"ChannelF"}, Extensions: []string{".rom", ".bin"}, Launch: launch(systemdefs.SystemChannelF), }, { Id: systemdefs.SystemColecoVision, - SystemId: systemdefs.SystemColecoVision, + SystemID: systemdefs.SystemColecoVision, Folders: []string{"Coleco"}, Extensions: []string{".col", ".bin", ".rom"}, Launch: launch(systemdefs.SystemColecoVision), }, { Id: systemdefs.SystemCreatiVision, - SystemId: systemdefs.SystemCreatiVision, + SystemID: systemdefs.SystemCreatiVision, Folders: []string{"CreatiVision"}, Extensions: []string{".rom", ".bin", ".bas"}, Launch: launch(systemdefs.SystemCreatiVision), }, { Id: systemdefs.SystemFDS, - SystemId: systemdefs.SystemFDS, + SystemID: systemdefs.SystemFDS, Folders: []string{"NES", "FDS"}, Extensions: []string{".fds"}, Launch: launch(systemdefs.SystemFDS), }, { Id: systemdefs.SystemGamate, - SystemId: systemdefs.SystemGamate, + SystemID: systemdefs.SystemGamate, Folders: []string{"Gamate"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemGamate), }, { Id: systemdefs.SystemGameboy, - SystemId: systemdefs.SystemGameboy, + SystemID: systemdefs.SystemGameboy, Folders: []string{"GAMEBOY"}, Extensions: []string{".gb"}, Launch: launch(systemdefs.SystemGameboy), }, { Id: "LLAPIGameboy", - SystemId: systemdefs.SystemGameboy, + SystemID: systemdefs.SystemGameboy, Launch: launchAltCore(systemdefs.SystemGameboy, "_LLAPI/Gameboy_LLAPI"), }, { Id: systemdefs.SystemGameboyColor, - SystemId: systemdefs.SystemGameboyColor, + SystemID: systemdefs.SystemGameboyColor, Folders: []string{"GAMEBOY", "GBC"}, Extensions: []string{".gbc"}, Launch: launch(systemdefs.SystemGameboyColor), }, { Id: systemdefs.SystemGameboy2P, - SystemId: systemdefs.SystemGameboy2P, + SystemID: systemdefs.SystemGameboy2P, Folders: []string{"GAMEBOY2P"}, Extensions: []string{".gb", ".gbc"}, Launch: launch(systemdefs.SystemGameboy2P), }, { Id: systemdefs.SystemGameGear, - SystemId: systemdefs.SystemGameGear, + SystemID: systemdefs.SystemGameGear, Folders: []string{"SMS", "GameGear"}, Extensions: []string{".gg"}, Launch: launch(systemdefs.SystemGameGear), }, { Id: systemdefs.SystemGameNWatch, - SystemId: systemdefs.SystemGameNWatch, + SystemID: systemdefs.SystemGameNWatch, Folders: []string{"GameNWatch"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemGameNWatch), }, { Id: "GameAndWatch", - SystemId: systemdefs.SystemGameNWatch, + SystemID: systemdefs.SystemGameNWatch, Folders: []string{"Game and Watch"}, Extensions: []string{".gnw"}, Launch: launchAggGnw, }, { Id: systemdefs.SystemGBA, - SystemId: systemdefs.SystemGBA, + SystemID: systemdefs.SystemGBA, Folders: []string{"GBA"}, Extensions: []string{".gba"}, Launch: launch(systemdefs.SystemGBA), }, { Id: "LLAPIGBA", - SystemId: systemdefs.SystemGBA, + SystemID: systemdefs.SystemGBA, Launch: launchAltCore(systemdefs.SystemGBA, "_LLAPI/GBA_LLAPI"), }, { Id: systemdefs.SystemGBA2P, - SystemId: systemdefs.SystemGBA2P, + SystemID: systemdefs.SystemGBA2P, Folders: []string{"GBA2P"}, Extensions: []string{".gba"}, Launch: launch(systemdefs.SystemGBA2P), }, { Id: systemdefs.SystemGenesis, - SystemId: systemdefs.SystemGenesis, + SystemID: systemdefs.SystemGenesis, Folders: []string{"MegaDrive", "Genesis"}, Extensions: []string{".gen", ".bin", ".md"}, Launch: launch(systemdefs.SystemGenesis), }, { Id: "SindenGenesis", - SystemId: systemdefs.SystemGenesis, + SystemID: systemdefs.SystemGenesis, Launch: launchSinden(systemdefs.SystemGenesis, "Genesis"), }, { Id: "SindenMegaDrive", - SystemId: systemdefs.SystemGenesis, + SystemID: systemdefs.SystemGenesis, Launch: launchSinden(systemdefs.SystemGenesis, "MegaDrive"), }, { Id: "LLAPIMegaDrive", - SystemId: systemdefs.SystemGenesis, + SystemID: systemdefs.SystemGenesis, Launch: launchAltCore(systemdefs.SystemGenesis, "_LLAPI/MegaDrive_LLAPI"), }, { Id: systemdefs.SystemIntellivision, - SystemId: systemdefs.SystemIntellivision, + SystemID: systemdefs.SystemIntellivision, Folders: []string{"Intellivision"}, Extensions: []string{".int", ".bin"}, Launch: launch(systemdefs.SystemIntellivision), }, { Id: systemdefs.SystemJaguar, - SystemId: systemdefs.SystemJaguar, + SystemID: systemdefs.SystemJaguar, Folders: []string{"Jaguar"}, Extensions: []string{".jag", ".j64", ".rom", ".bin"}, Launch: launch(systemdefs.SystemJaguar), }, { Id: systemdefs.SystemMasterSystem, - SystemId: systemdefs.SystemMasterSystem, + SystemID: systemdefs.SystemMasterSystem, Folders: []string{"SMS"}, Extensions: []string{".sms"}, Launch: launch(systemdefs.SystemMasterSystem), }, { Id: "SindenSMS", - SystemId: systemdefs.SystemMasterSystem, + SystemID: systemdefs.SystemMasterSystem, Launch: launchSinden(systemdefs.SystemMasterSystem, "SMS"), }, { Id: "LLAPISMS", - SystemId: systemdefs.SystemMasterSystem, + SystemID: systemdefs.SystemMasterSystem, Launch: launchAltCore(systemdefs.SystemMasterSystem, "_LLAPI/SMS_LLAPI"), }, { Id: systemdefs.SystemMegaCD, - SystemId: systemdefs.SystemMegaCD, + SystemID: systemdefs.SystemMegaCD, Folders: []string{"MegaCD"}, Extensions: []string{".cue", ".chd"}, Launch: launch(systemdefs.SystemMegaCD), }, { Id: "SindenMegaCD", - SystemId: systemdefs.SystemMegaCD, + SystemID: systemdefs.SystemMegaCD, Launch: launchSinden(systemdefs.SystemMegaCD, "MegaCD"), }, { Id: "LLAPIMegaCD", - SystemId: systemdefs.SystemMegaCD, + SystemID: systemdefs.SystemMegaCD, Launch: launchAltCore(systemdefs.SystemMegaCD, "_LLAPI/MegaCD_LLAPI"), }, { Id: systemdefs.SystemMegaDuck, - SystemId: systemdefs.SystemMegaDuck, + SystemID: systemdefs.SystemMegaDuck, Folders: []string{"GAMEBOY", "MegaDuck"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemMegaDuck), }, { Id: "LLAPINeoGeo", - SystemId: systemdefs.SystemNeoGeo, + SystemID: systemdefs.SystemNeoGeo, Launch: launchAltCore(systemdefs.SystemNeoGeo, "_LLAPI/NeoGeo_LLAPI"), }, { Id: systemdefs.SystemNeoGeoCD, - SystemId: systemdefs.SystemNeoGeoCD, + SystemID: systemdefs.SystemNeoGeoCD, Folders: []string{"NeoGeo-CD", "NEOGEO"}, Extensions: []string{".cue", ".chd"}, Launch: launch(systemdefs.SystemNeoGeoCD), }, { Id: systemdefs.SystemNES, - SystemId: systemdefs.SystemNES, + SystemID: systemdefs.SystemNES, Folders: []string{"NES"}, Extensions: []string{".nes"}, Launch: launch(systemdefs.SystemNES), }, { Id: "SindenNES", - SystemId: systemdefs.SystemNES, + SystemID: systemdefs.SystemNES, Launch: launchSinden(systemdefs.SystemNES, "NES"), }, { Id: systemdefs.SystemNESMusic, - SystemId: systemdefs.SystemNESMusic, + SystemID: systemdefs.SystemNESMusic, Folders: []string{"NES"}, Extensions: []string{".nsf"}, Launch: launch(systemdefs.SystemNESMusic), }, { Id: "LLAPINES", - SystemId: systemdefs.SystemNES, + SystemID: systemdefs.SystemNES, Launch: launchAltCore(systemdefs.SystemNES, "_LLAPI/NES_LLAPI"), }, { Id: systemdefs.SystemNintendo64, - SystemId: systemdefs.SystemNintendo64, + SystemID: systemdefs.SystemNintendo64, Folders: []string{"N64"}, Extensions: []string{".n64", ".z64"}, Launch: launch(systemdefs.SystemNintendo64), }, { Id: "LLAPINintendo64", - SystemId: systemdefs.SystemNintendo64, + SystemID: systemdefs.SystemNintendo64, Launch: launchAltCore(systemdefs.SystemNintendo64, "_LLAPI/N64_LLAPI"), }, { Id: "LLAPI80MHzNintendo64", - SystemId: systemdefs.SystemNintendo64, + SystemID: systemdefs.SystemNintendo64, Launch: launchAltCore(systemdefs.SystemNintendo64, "_LLAPI/N64_80MHz_LLAPI"), }, { Id: "80MHzNintendo64", - SystemId: systemdefs.SystemNintendo64, + SystemID: systemdefs.SystemNintendo64, Launch: launchAltCore(systemdefs.SystemNintendo64, "_Console/N64_80MHz"), }, { Id: "PWMNintendo64", - SystemId: systemdefs.SystemNintendo64, + SystemID: systemdefs.SystemNintendo64, Launch: launchAltCore(systemdefs.SystemNintendo64, "_ConsolePWM/N64_PWM"), }, { Id: "PWM80MHzNintendo64", - SystemId: systemdefs.SystemNintendo64, + SystemID: systemdefs.SystemNintendo64, Launch: launchAltCore(systemdefs.SystemNintendo64, "_ConsolePWM/_Turbo/N64_80MHz_PWM"), }, { Id: systemdefs.SystemOdyssey2, - SystemId: systemdefs.SystemOdyssey2, + SystemID: systemdefs.SystemOdyssey2, Folders: []string{"ODYSSEY2"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemOdyssey2), }, { Id: systemdefs.SystemPocketChallengeV2, - SystemId: systemdefs.SystemPocketChallengeV2, + SystemID: systemdefs.SystemPocketChallengeV2, Folders: []string{"WonderSwan", "PocketChallengeV2"}, Extensions: []string{".pc2"}, Launch: launch(systemdefs.SystemPocketChallengeV2), }, { Id: systemdefs.SystemPokemonMini, - SystemId: systemdefs.SystemPokemonMini, + SystemID: systemdefs.SystemPokemonMini, Folders: []string{"PokemonMini"}, Extensions: []string{".min"}, Launch: launch(systemdefs.SystemPokemonMini), }, { Id: systemdefs.SystemPSX, - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Folders: []string{"PSX"}, Extensions: []string{".cue", ".chd", ".exe"}, Launch: launch(systemdefs.SystemPSX), }, { Id: "LLAPIPSX", - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Launch: launchAltCore(systemdefs.SystemPSX, "_LLAPI/PSX_LLAPI"), }, { Id: "SindenPSX", - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Launch: launchSinden(systemdefs.SystemPSX, "PSX"), }, { Id: "2XPSX", - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Launch: launchAltCore(systemdefs.SystemPSX, "_Console/PSX2XCPU"), }, { Id: "PWMPSX", - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Launch: launchAltCore(systemdefs.SystemPSX, "_ConsolePWM/PSX_PWM"), }, { Id: "PWM2XPSX", - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Launch: launchAltCore(systemdefs.SystemPSX, "_ConsolePWM/_Turbo/PSX2XCPU_PWM"), }, { Id: systemdefs.SystemSega32X, - SystemId: systemdefs.SystemSega32X, + SystemID: systemdefs.SystemSega32X, Folders: []string{"S32X"}, Extensions: []string{".32x"}, Launch: launch(systemdefs.SystemSega32X), }, { Id: "LLAPIS32X", - SystemId: systemdefs.SystemSega32X, + SystemID: systemdefs.SystemSega32X, Launch: launchAltCore(systemdefs.SystemPSX, "_LLAPI/S32X_LLAPI"), }, { Id: systemdefs.SystemSG1000, - SystemId: systemdefs.SystemSG1000, + SystemID: systemdefs.SystemSG1000, Folders: []string{"SG1000", "Coleco", "SMS"}, Extensions: []string{".sg"}, Launch: launch(systemdefs.SystemSG1000), }, { Id: systemdefs.SystemSuperGameboy, - SystemId: systemdefs.SystemSuperGameboy, + SystemID: systemdefs.SystemSuperGameboy, Folders: []string{"SGB"}, Extensions: []string{".sgb", ".gb", ".gbc"}, Launch: launch(systemdefs.SystemSuperGameboy), }, { Id: "LLAPISuperGameboy", - SystemId: systemdefs.SystemSuperGameboy, + SystemID: systemdefs.SystemSuperGameboy, Launch: launchAltCore(systemdefs.SystemSuperGameboy, "_LLAPI/SGB_LLAPI"), }, { Id: systemdefs.SystemSuperVision, - SystemId: systemdefs.SystemSuperVision, + SystemID: systemdefs.SystemSuperVision, Folders: []string{"SuperVision"}, Extensions: []string{".bin", ".sv"}, Launch: launch(systemdefs.SystemSuperVision), }, { Id: systemdefs.SystemSaturn, - SystemId: systemdefs.SystemSaturn, + SystemID: systemdefs.SystemSaturn, Folders: []string{"Saturn"}, Extensions: []string{".cue", ".chd"}, Launch: launch(systemdefs.SystemSaturn), }, { Id: "LLAPISaturn", - SystemId: systemdefs.SystemSaturn, + SystemID: systemdefs.SystemSaturn, Launch: launchAltCore(systemdefs.SystemSaturn, "_LLAPI/Saturn_LLAPI"), }, { Id: "PWMSaturn", - SystemId: systemdefs.SystemPSX, + SystemID: systemdefs.SystemPSX, Launch: launchAltCore(systemdefs.SystemPSX, "_ConsolePWM/Saturn_PWM"), }, { Id: systemdefs.SystemSNES, - SystemId: systemdefs.SystemSNES, + SystemID: systemdefs.SystemSNES, Folders: []string{"SNES"}, Extensions: []string{".sfc", ".smc", ".bin", ".bs"}, Launch: launch(systemdefs.SystemSNES), }, { Id: "LLAPISNES", - SystemId: systemdefs.SystemSNES, + SystemID: systemdefs.SystemSNES, Launch: launchAltCore(systemdefs.SystemSNES, "_LLAPI/SNES_LLAPI"), }, { Id: "SindenSNES", - SystemId: systemdefs.SystemSNES, + SystemID: systemdefs.SystemSNES, Launch: launchSinden(systemdefs.SystemSNES, "SNES"), }, { Id: systemdefs.SystemSNESMusic, - SystemId: systemdefs.SystemSNESMusic, + SystemID: systemdefs.SystemSNESMusic, Folders: []string{"SNES"}, Extensions: []string{".spc"}, Launch: launch(systemdefs.SystemSNESMusic), }, { Id: systemdefs.SystemSuperGrafx, - SystemId: systemdefs.SystemSuperGrafx, + SystemID: systemdefs.SystemSuperGrafx, Folders: []string{"TGFX16"}, Extensions: []string{".sgx"}, Launch: launch(systemdefs.SystemSuperGrafx), }, { Id: systemdefs.SystemTurboGrafx16, - SystemId: systemdefs.SystemTurboGrafx16, + SystemID: systemdefs.SystemTurboGrafx16, Folders: []string{"TGFX16"}, Extensions: []string{".pce", ".bin"}, Launch: launch(systemdefs.SystemTurboGrafx16), }, { Id: "LLAPITurboGrafx16", - SystemId: systemdefs.SystemTurboGrafx16, + SystemID: systemdefs.SystemTurboGrafx16, Launch: launchAltCore(systemdefs.SystemTurboGrafx16, "_LLAPI/TurboGrafx16_LLAPI"), }, { Id: systemdefs.SystemTurboGrafx16CD, - SystemId: systemdefs.SystemTurboGrafx16CD, + SystemID: systemdefs.SystemTurboGrafx16CD, Folders: []string{"TGFX16-CD"}, Extensions: []string{".cue", ".chd"}, Launch: launch(systemdefs.SystemTurboGrafx16CD), }, { Id: systemdefs.SystemVC4000, - SystemId: systemdefs.SystemVC4000, + SystemID: systemdefs.SystemVC4000, Folders: []string{"VC4000"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemVC4000), }, { Id: systemdefs.SystemVectrex, - SystemId: systemdefs.SystemVectrex, + SystemID: systemdefs.SystemVectrex, Folders: []string{"VECTREX"}, Extensions: []string{".vec", ".bin", ".rom"}, // TODO: overlays (.ovr) Launch: launch(systemdefs.SystemVectrex), }, { Id: systemdefs.SystemWonderSwan, - SystemId: systemdefs.SystemWonderSwan, + SystemID: systemdefs.SystemWonderSwan, Folders: []string{"WonderSwan"}, Extensions: []string{".ws"}, Launch: launch(systemdefs.SystemWonderSwan), }, { Id: systemdefs.SystemWonderSwanColor, - SystemId: systemdefs.SystemWonderSwanColor, + SystemID: systemdefs.SystemWonderSwanColor, Folders: []string{"WonderSwan", "WonderSwanColor"}, Extensions: []string{".wsc"}, Launch: launch(systemdefs.SystemWonderSwanColor), @@ -853,357 +853,357 @@ var Launchers = []platforms.Launcher{ // Computers { Id: systemdefs.SystemAcornAtom, - SystemId: systemdefs.SystemAcornAtom, + SystemID: systemdefs.SystemAcornAtom, Folders: []string{"AcornAtom"}, Extensions: []string{".vhd"}, Launch: launch(systemdefs.SystemAcornAtom), }, { Id: systemdefs.SystemAcornElectron, - SystemId: systemdefs.SystemAcornElectron, + SystemID: systemdefs.SystemAcornElectron, Folders: []string{"AcornElectron"}, Extensions: []string{".vhd"}, Launch: launch(systemdefs.SystemAcornElectron), }, { Id: systemdefs.SystemAliceMC10, - SystemId: systemdefs.SystemAliceMC10, + SystemID: systemdefs.SystemAliceMC10, Folders: []string{"AliceMC10"}, Extensions: []string{".c10"}, Launch: launch(systemdefs.SystemAliceMC10), }, { Id: systemdefs.SystemAmstrad, - SystemId: systemdefs.SystemAmstrad, + SystemID: systemdefs.SystemAmstrad, Folders: []string{"Amstrad"}, Extensions: []string{".dsk", ".cdt"}, // TODO: globbing support? for .e?? Launch: launch(systemdefs.SystemAmstrad), }, { Id: systemdefs.SystemAmstradPCW, - SystemId: systemdefs.SystemAmstradPCW, + SystemID: systemdefs.SystemAmstradPCW, Folders: []string{"Amstrad PCW"}, Extensions: []string{".dsk"}, Launch: launch(systemdefs.SystemAmstradPCW), }, { Id: systemdefs.SystemDOS, - SystemId: systemdefs.SystemDOS, + SystemID: systemdefs.SystemDOS, Folders: []string{"AO486"}, Extensions: []string{".img", ".ima", ".vhd", ".vfd", ".iso", ".cue", ".chd"}, Launch: launch(systemdefs.SystemDOS), }, { Id: systemdefs.SystemApogee, - SystemId: systemdefs.SystemApogee, + SystemID: systemdefs.SystemApogee, Folders: []string{"APOGEE"}, Extensions: []string{".rka", ".rkr", ".gam"}, Launch: launch(systemdefs.SystemApogee), }, { Id: systemdefs.SystemAppleI, - SystemId: systemdefs.SystemAppleI, + SystemID: systemdefs.SystemAppleI, Folders: []string{"Apple-I"}, Extensions: []string{".txt"}, Launch: launch(systemdefs.SystemAppleI), }, { Id: systemdefs.SystemAppleII, - SystemId: systemdefs.SystemAppleII, + SystemID: systemdefs.SystemAppleII, Folders: []string{"Apple-II"}, Extensions: []string{".dsk", ".do", ".po", ".nib", ".hdv"}, Launch: launch(systemdefs.SystemAppleII), }, { Id: systemdefs.SystemAquarius, - SystemId: systemdefs.SystemAquarius, + SystemID: systemdefs.SystemAquarius, Folders: []string{"AQUARIUS"}, Extensions: []string{".bin", ".caq"}, Launch: launch(systemdefs.SystemAquarius), }, { Id: systemdefs.SystemAtari800, - SystemId: systemdefs.SystemAtari800, + SystemID: systemdefs.SystemAtari800, Folders: []string{"ATARI800"}, Extensions: []string{".atr", ".xex", ".xfd", ".atx", ".car", ".rom", ".bin"}, Launch: launch(systemdefs.SystemAtari800), }, { Id: systemdefs.SystemBBCMicro, - SystemId: systemdefs.SystemBBCMicro, + SystemID: systemdefs.SystemBBCMicro, Folders: []string{"BBCMicro"}, Extensions: []string{".ssd", ".dsd", ".vhd"}, Launch: launch(systemdefs.SystemBBCMicro), }, { Id: systemdefs.SystemBK0011M, - SystemId: systemdefs.SystemBK0011M, + SystemID: systemdefs.SystemBK0011M, Folders: []string{"BK0011M"}, Extensions: []string{".bin", ".dsk", ".vhd"}, Launch: launch(systemdefs.SystemBK0011M), }, { Id: systemdefs.SystemC16, - SystemId: systemdefs.SystemC16, + SystemID: systemdefs.SystemC16, Folders: []string{"C16"}, Extensions: []string{".d64", ".g64", ".prg", ".tap", ".bin"}, Launch: launch(systemdefs.SystemC16), }, { Id: systemdefs.SystemC64, - SystemId: systemdefs.SystemC64, + SystemID: systemdefs.SystemC64, Folders: []string{"C64"}, Extensions: []string{".d64", ".g64", ".t64", ".d81", ".prg", ".crt", ".reu", ".tap"}, Launch: launch(systemdefs.SystemC64), }, { Id: systemdefs.SystemCasioPV2000, - SystemId: systemdefs.SystemCasioPV2000, + SystemID: systemdefs.SystemCasioPV2000, Folders: []string{"Casio_PV-2000"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemCasioPV2000), }, { Id: systemdefs.SystemCoCo2, - SystemId: systemdefs.SystemCoCo2, + SystemID: systemdefs.SystemCoCo2, Folders: []string{"CoCo2"}, Extensions: []string{".dsk", ".cas", ".ccc", ".rom"}, Launch: launch(systemdefs.SystemCoCo2), }, { Id: systemdefs.SystemEDSAC, - SystemId: systemdefs.SystemEDSAC, + SystemID: systemdefs.SystemEDSAC, Folders: []string{"EDSAC"}, Extensions: []string{".tap"}, Launch: launch(systemdefs.SystemEDSAC), }, { Id: systemdefs.SystemGalaksija, - SystemId: systemdefs.SystemGalaksija, + SystemID: systemdefs.SystemGalaksija, Folders: []string{"Galaksija"}, Extensions: []string{".tap"}, Launch: launch(systemdefs.SystemGalaksija), }, { Id: systemdefs.SystemInteract, - SystemId: systemdefs.SystemInteract, + SystemID: systemdefs.SystemInteract, Folders: []string{"Interact"}, Extensions: []string{".cin", ".k7"}, Launch: launch(systemdefs.SystemInteract), }, { Id: systemdefs.SystemJupiter, - SystemId: systemdefs.SystemJupiter, + SystemID: systemdefs.SystemJupiter, Folders: []string{"Jupiter"}, Extensions: []string{".ace"}, Launch: launch(systemdefs.SystemJupiter), }, { Id: systemdefs.SystemLaser, - SystemId: systemdefs.SystemLaser, + SystemID: systemdefs.SystemLaser, Folders: []string{"Laser"}, Extensions: []string{".vz"}, Launch: launch(systemdefs.SystemLaser), }, { Id: systemdefs.SystemLynx48, - SystemId: systemdefs.SystemLynx48, + SystemID: systemdefs.SystemLynx48, Folders: []string{"Lynx48"}, Extensions: []string{".tap"}, Launch: launch(systemdefs.SystemLynx48), }, { Id: systemdefs.SystemMacPlus, - SystemId: systemdefs.SystemMacPlus, + SystemID: systemdefs.SystemMacPlus, Folders: []string{"MACPLUS"}, Extensions: []string{".dsk", ".img", ".vhd"}, Launch: launch(systemdefs.SystemMacPlus), }, { Id: systemdefs.SystemMSX, - SystemId: systemdefs.SystemMSX, + SystemID: systemdefs.SystemMSX, Folders: []string{"MSX"}, Extensions: []string{".vhd"}, Launch: launch(systemdefs.SystemMSX), }, { Id: "MSX1", - SystemId: systemdefs.SystemMSX, + SystemID: systemdefs.SystemMSX, Folders: []string{"MSX1"}, Extensions: []string{".dsk", ".rom"}, Launch: launchAltCore(systemdefs.SystemMSX, "_Console/MSX1"), }, { Id: systemdefs.SystemMultiComp, - SystemId: systemdefs.SystemMultiComp, + SystemID: systemdefs.SystemMultiComp, Folders: []string{"MultiComp"}, Extensions: []string{".img"}, Launch: launch(systemdefs.SystemMultiComp), }, { Id: systemdefs.SystemOrao, - SystemId: systemdefs.SystemOrao, + SystemID: systemdefs.SystemOrao, Folders: []string{"ORAO"}, Extensions: []string{".tap"}, Launch: launch(systemdefs.SystemOrao), }, { Id: systemdefs.SystemOric, - SystemId: systemdefs.SystemOric, + SystemID: systemdefs.SystemOric, Folders: []string{"Oric"}, Extensions: []string{".dsk"}, Launch: launch(systemdefs.SystemOric), }, { Id: systemdefs.SystemPCXT, - SystemId: systemdefs.SystemPCXT, + SystemID: systemdefs.SystemPCXT, Folders: []string{"PCXT"}, Extensions: []string{".img", ".vhd", ".ima", ".vfd"}, Launch: launch(systemdefs.SystemPCXT), }, { Id: systemdefs.SystemPDP1, - SystemId: systemdefs.SystemPDP1, + SystemID: systemdefs.SystemPDP1, Folders: []string{"PDP1"}, Extensions: []string{".bin", ".rim", ".pdp"}, Launch: launch(systemdefs.SystemPDP1), }, { Id: systemdefs.SystemPET2001, - SystemId: systemdefs.SystemPET2001, + SystemID: systemdefs.SystemPET2001, Folders: []string{"PET2001"}, Extensions: []string{".prg", ".tap"}, Launch: launch(systemdefs.SystemPET2001), }, { Id: systemdefs.SystemPMD85, - SystemId: systemdefs.SystemPMD85, + SystemID: systemdefs.SystemPMD85, Folders: []string{"PMD85"}, Extensions: []string{".rmm"}, Launch: launch(systemdefs.SystemPMD85), }, { Id: systemdefs.SystemQL, - SystemId: systemdefs.SystemQL, + SystemID: systemdefs.SystemQL, Folders: []string{"QL"}, Extensions: []string{".mdv", ".win"}, Launch: launch(systemdefs.SystemQL), }, { Id: systemdefs.SystemRX78, - SystemId: systemdefs.SystemRX78, + SystemID: systemdefs.SystemRX78, Folders: []string{"RX78"}, Extensions: []string{".bin"}, Launch: launch(systemdefs.SystemRX78), }, { Id: systemdefs.SystemSAMCoupe, - SystemId: systemdefs.SystemSAMCoupe, + SystemID: systemdefs.SystemSAMCoupe, Folders: []string{"SAMCOUPE"}, Extensions: []string{".dsk", ".mgt", ".img"}, Launch: launch(systemdefs.SystemSAMCoupe), }, { Id: systemdefs.SystemSordM5, - SystemId: systemdefs.SystemSordM5, + SystemID: systemdefs.SystemSordM5, Folders: []string{"Sord M5"}, Extensions: []string{".bin", ".rom", ".cas"}, Launch: launch(systemdefs.SystemSordM5), }, { Id: systemdefs.SystemSpecialist, - SystemId: systemdefs.SystemSpecialist, + SystemID: systemdefs.SystemSpecialist, Folders: []string{"SPMX"}, Extensions: []string{".rks", ".odi"}, Launch: launch(systemdefs.SystemSpecialist), }, { Id: systemdefs.SystemSVI328, - SystemId: systemdefs.SystemSVI328, + SystemID: systemdefs.SystemSVI328, Folders: []string{"SVI328"}, Extensions: []string{".cas", ".bin", ".rom"}, Launch: launch(systemdefs.SystemSVI328), }, { Id: systemdefs.SystemTatungEinstein, - SystemId: systemdefs.SystemTatungEinstein, + SystemID: systemdefs.SystemTatungEinstein, Folders: []string{"TatungEinstein"}, Extensions: []string{".dsk"}, Launch: launch(systemdefs.SystemTatungEinstein), }, { Id: systemdefs.SystemTI994A, - SystemId: systemdefs.SystemTI994A, + SystemID: systemdefs.SystemTI994A, Folders: []string{"TI-99_4A"}, Extensions: []string{".bin", ".m99"}, Launch: launch(systemdefs.SystemTI994A), }, { Id: systemdefs.SystemTomyTutor, - SystemId: systemdefs.SystemTomyTutor, + SystemID: systemdefs.SystemTomyTutor, Folders: []string{"TomyTutor"}, Extensions: []string{".bin", ".cas"}, Launch: launch(systemdefs.SystemTomyTutor), }, { Id: systemdefs.SystemTRS80, - SystemId: systemdefs.SystemTRS80, + SystemID: systemdefs.SystemTRS80, Folders: []string{"TRS-80"}, Extensions: []string{".jvi", ".dsk", ".cas"}, Launch: launch(systemdefs.SystemTRS80), }, { Id: systemdefs.SystemTSConf, - SystemId: systemdefs.SystemTSConf, + SystemID: systemdefs.SystemTSConf, Folders: []string{"TSConf"}, Extensions: []string{".vhf"}, Launch: launch(systemdefs.SystemTSConf), }, { Id: systemdefs.SystemUK101, - SystemId: systemdefs.SystemUK101, + SystemID: systemdefs.SystemUK101, Folders: []string{"UK101"}, Extensions: []string{".txt", ".bas", ".lod"}, Launch: launch(systemdefs.SystemUK101), }, { Id: systemdefs.SystemVector06C, - SystemId: systemdefs.SystemVector06C, + SystemID: systemdefs.SystemVector06C, Folders: []string{"VECTOR06"}, Extensions: []string{".rom", ".com", ".c00", ".edd", ".fdd"}, Launch: launch(systemdefs.SystemVector06C), }, { Id: systemdefs.SystemVIC20, - SystemId: systemdefs.SystemVIC20, + SystemID: systemdefs.SystemVIC20, Folders: []string{"VIC20"}, Extensions: []string{".d64", ".g64", ".prg", ".tap", ".crt"}, Launch: launch(systemdefs.SystemVIC20), }, { Id: systemdefs.SystemX68000, - SystemId: systemdefs.SystemX68000, + SystemID: systemdefs.SystemX68000, Folders: []string{"X68000"}, Extensions: []string{".d88", ".hdf"}, Launch: launch(systemdefs.SystemX68000), }, { Id: systemdefs.SystemZX81, - SystemId: systemdefs.SystemZX81, + SystemID: systemdefs.SystemZX81, Folders: []string{"ZX81"}, Extensions: []string{".p", ".0"}, Launch: launch(systemdefs.SystemZX81), }, { Id: systemdefs.SystemZXSpectrum, - SystemId: systemdefs.SystemZXSpectrum, + SystemID: systemdefs.SystemZXSpectrum, Folders: []string{"Spectrum"}, Extensions: []string{".tap", ".csw", ".tzx", ".sna", ".z80", ".trd", ".img", ".dsk", ".mgt"}, Launch: launch(systemdefs.SystemZXSpectrum), }, { Id: systemdefs.SystemZXNext, - SystemId: systemdefs.SystemZXNext, + SystemID: systemdefs.SystemZXNext, Folders: []string{"ZXNext"}, Extensions: []string{".vhd"}, Launch: launch(systemdefs.SystemZXNext), @@ -1211,28 +1211,28 @@ var Launchers = []platforms.Launcher{ // Other { Id: systemdefs.SystemArcade, - SystemId: systemdefs.SystemArcade, + SystemID: systemdefs.SystemArcade, Folders: []string{"_Arcade"}, Extensions: []string{".mra"}, Launch: launch(systemdefs.SystemArcade), }, { Id: systemdefs.SystemArduboy, - SystemId: systemdefs.SystemArduboy, + SystemID: systemdefs.SystemArduboy, Folders: []string{"Arduboy"}, Extensions: []string{".hex", ".bin"}, Launch: launch(systemdefs.SystemArduboy), }, { Id: systemdefs.SystemChip8, - SystemId: systemdefs.SystemChip8, + SystemID: systemdefs.SystemChip8, Folders: []string{"Chip8"}, Extensions: []string{".ch8"}, Launch: launch(systemdefs.SystemChip8), }, { Id: systemdefs.SystemGroovy, - SystemId: systemdefs.SystemGroovy, + SystemID: systemdefs.SystemGroovy, Folders: []string{"Groovy"}, Extensions: []string{".gmc"}, Launch: launch(systemdefs.SystemGroovy), diff --git a/pkg/platforms/mister/platform.go b/pkg/platforms/mister/platform.go index f71c019a..b82560b5 100644 --- a/pkg/platforms/mister/platform.go +++ b/pkg/platforms/mister/platform.go @@ -566,7 +566,7 @@ func (p *Platform) Launchers() []platforms.Launcher { aDemosPath := "listings/demos.txt" amiga := platforms.Launcher{ Id: systemdefs.SystemAmiga, - SystemId: systemdefs.SystemAmiga, + SystemID: systemdefs.SystemAmiga, Folders: []string{"Amiga"}, Extensions: []string{".adf"}, Test: func(cfg *config.Instance, path string) bool { @@ -629,7 +629,7 @@ func (p *Platform) Launchers() []platforms.Launcher { neogeo := platforms.Launcher{ Id: systemdefs.SystemNeoGeo, - SystemId: systemdefs.SystemNeoGeo, + SystemID: systemdefs.SystemNeoGeo, Folders: []string{"NEOGEO"}, Extensions: []string{".neo"}, Test: func(cfg *config.Instance, path string) bool { @@ -706,7 +706,7 @@ func (p *Platform) Launchers() []platforms.Launcher { mplayerVideo := platforms.Launcher{ Id: "MPlayerVideo", - SystemId: systemdefs.SystemVideo, + SystemID: systemdefs.SystemVideo, Folders: []string{"Video", "Movies", "TV"}, Extensions: []string{".mp4", ".mkv", ".avi"}, Launch: launchMPlayer(p), diff --git a/pkg/platforms/mister/tracker.go b/pkg/platforms/mister/tracker.go index 245f417a..2642fe07 100644 --- a/pkg/platforms/mister/tracker.go +++ b/pkg/platforms/mister/tracker.go @@ -283,7 +283,7 @@ func (tr *Tracker) loadGame() { return } - system, err := systemdefs.GetSystem(launchers[0].SystemId) + system, err := systemdefs.GetSystem(launchers[0].SystemID) if err != nil { log.Error().Msgf("error getting system %s", err) return diff --git a/pkg/platforms/platforms.go b/pkg/platforms/platforms.go index c7aa3afa..7ff154b5 100644 --- a/pkg/platforms/platforms.go +++ b/pkg/platforms/platforms.go @@ -65,7 +65,7 @@ type Launcher struct { // Unique ID of the launcher, visible to user. Id string // Systems associated with this launcher. - SystemId string + SystemID string // Folders to scan for files, relative to the root folders of the platform. // TODO: Support absolute paths? // TODO: rename RootDirs diff --git a/pkg/platforms/steamos/platform.go b/pkg/platforms/steamos/platform.go index 0433180d..70a0aa22 100644 --- a/pkg/platforms/steamos/platform.go +++ b/pkg/platforms/steamos/platform.go @@ -193,7 +193,7 @@ func (p *Platform) Launchers() []platforms.Launcher { return []platforms.Launcher{ { Id: "Steam", - SystemId: systemdefs.SystemPC, + SystemID: systemdefs.SystemPC, Schemes: []string{"steam"}, Scanner: func( cfg *config.Instance, diff --git a/pkg/platforms/windows/platform.go b/pkg/platforms/windows/platform.go index ab355549..7fdfb542 100644 --- a/pkg/platforms/windows/platform.go +++ b/pkg/platforms/windows/platform.go @@ -402,7 +402,7 @@ func (p *Platform) Launchers() []platforms.Launcher { return []platforms.Launcher{ { Id: "Steam", - SystemId: systemdefs.SystemPC, + SystemID: systemdefs.SystemPC, Schemes: []string{"steam"}, Scanner: func( cfg *config.Instance, @@ -429,7 +429,7 @@ func (p *Platform) Launchers() []platforms.Launcher { }, { Id: "Flashpoint", - SystemId: systemdefs.SystemPC, + SystemID: systemdefs.SystemPC, Schemes: []string{"flashpoint"}, Launch: func(cfg *config.Instance, path string) error { id := strings.TrimPrefix(path, "flashpoint://") diff --git a/pkg/service/readers.go b/pkg/service/readers.go index ff7215d1..21437f2f 100644 --- a/pkg/service/readers.go +++ b/pkg/service/readers.go @@ -204,8 +204,8 @@ func readerManager( var systemIds []string for _, l := range pl.Launchers() { if l.Id == activeLauncher { - systemIds = append(systemIds, l.SystemId) - system, err := systemdefs.LookupSystem(l.SystemId) + systemIds = append(systemIds, l.SystemID) + system, err := systemdefs.LookupSystem(l.SystemID) if err == nil { systemIds = append(systemIds, system.Aliases...) } diff --git a/pkg/utils/paths.go b/pkg/utils/paths.go index 5f568ac9..7b8fed2b 100644 --- a/pkg/utils/paths.go +++ b/pkg/utils/paths.go @@ -76,7 +76,7 @@ func MatchSystemFile( path string, ) bool { for _, l := range pl.Launchers() { - if l.SystemId == systemId { + if l.SystemID == systemId { if PathIsLauncher(cfg, pl, l, path) { return true } diff --git a/pkg/zapscript/launch.go b/pkg/zapscript/launch.go index 65cdfe44..c618da44 100644 --- a/pkg/zapscript/launch.go +++ b/pkg/zapscript/launch.go @@ -222,7 +222,7 @@ func cmdLaunch(pl platforms.Platform, env platforms.CmdEnv) (platforms.CmdResult var launchers []platforms.Launcher for _, l := range pl.Launchers() { - if l.SystemId == system.ID { + if l.SystemID == system.ID { launchers = append(launchers, l) } } @@ -238,6 +238,7 @@ func cmdLaunch(pl platforms.Platform, env platforms.CmdEnv) (platforms.CmdResult for _, f := range folders { systemPath := filepath.Join(f, path) + log.Debug().Msgf("checking system path: %s", systemPath) if fp, err := findFile(pl, env.Cfg, systemPath); err == nil { log.Debug().Msgf("launching found system path: %s", fp) return platforms.CmdResult{ From aee2c07250029a650ac566925a0b94a6509c00ae Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 12:08:44 +0800 Subject: [PATCH 7/9] Change merged separator so it doesn't conflict with ID normalizing --- pkg/readers/optical_drive/optical_drive.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/readers/optical_drive/optical_drive.go b/pkg/readers/optical_drive/optical_drive.go index e8faa6a3..0e6a5c6c 100644 --- a/pkg/readers/optical_drive/optical_drive.go +++ b/pkg/readers/optical_drive/optical_drive.go @@ -19,7 +19,7 @@ const ( IDSourceUUID = "uuid" IDSourceLabel = "label" IDSourceMerged = "merged" - MergedIDSeparator = ":" + MergedIDSeparator = "/" ) type FileReader struct { From 554a93de8d5091a48883a5a79ef28304adeb61fc Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 12:09:04 +0800 Subject: [PATCH 8/9] Fix mapping file ID matchings --- pkg/database/mappings.go | 6 +++--- pkg/service/mappings.go | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/database/mappings.go b/pkg/database/mappings.go index 4f2fe3b9..ab3502e5 100644 --- a/pkg/database/mappings.go +++ b/pkg/database/mappings.go @@ -49,7 +49,7 @@ func mappingKey(id string) []byte { return []byte(fmt.Sprintf("mappings:%s", id)) } -func NormalizeUid(uid string) string { +func NormalizeID(uid string) string { uid = strings.TrimSpace(uid) uid = strings.ToLower(uid) uid = strings.ReplaceAll(uid, ":", "") @@ -66,7 +66,7 @@ func (d *Database) AddMapping(m Mapping) error { } if m.Type == MappingTypeUID { - m.Pattern = NormalizeUid(m.Pattern) + m.Pattern = NormalizeID(m.Pattern) } if m.Pattern == "" { @@ -128,7 +128,7 @@ func (d *Database) UpdateMapping(id string, m Mapping) error { } if m.Type == MappingTypeUID { - m.Pattern = NormalizeUid(m.Pattern) + m.Pattern = NormalizeID(m.Pattern) } if m.Pattern == "" { diff --git a/pkg/service/mappings.go b/pkg/service/mappings.go index 3550dc29..c8ff1a80 100644 --- a/pkg/service/mappings.go +++ b/pkg/service/mappings.go @@ -33,14 +33,19 @@ import ( ) func checkMappingUid(m database.Mapping, t tokens.Token) bool { - uid := database.NormalizeUid(t.UID) + uid := database.NormalizeID(t.UID) + pattern := database.NormalizeID(m.Pattern) switch { case m.Match == database.MatchTypeExact: - return uid == m.Pattern + log.Debug().Msgf("checking exact match: %s == %s", pattern, uid) + return uid == pattern case m.Match == database.MatchTypePartial: - return strings.Contains(uid, m.Pattern) + log.Debug().Msgf("checking partial match: %s contains %s", pattern, uid) + return strings.Contains(uid, pattern) case m.Match == database.MatchTypeRegex: + // don't normalize regex pattern + log.Debug().Msgf("checking regex match: %s matches %s", m.Pattern, uid) re, err := regexp.Compile(m.Pattern) if err != nil { log.Error().Err(err).Msgf("error compiling regex") From f26b51c778955f461ec212a0d1809a05a11a26f0 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sun, 27 Apr 2025 12:23:08 +0800 Subject: [PATCH 9/9] Update pkg/platforms/batocera/platform.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pkg/platforms/batocera/platform.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/platforms/batocera/platform.go b/pkg/platforms/batocera/platform.go index eb181715..1e5e3c55 100644 --- a/pkg/platforms/batocera/platform.go +++ b/pkg/platforms/batocera/platform.go @@ -174,7 +174,7 @@ func (p *Platform) NormalizePath(_ *config.Instance, path string) string { if strings.HasPrefix(lowerPath, rootDir) { gotRoot = true newPath = path[len(rootDir):] - if newPath[0] == '/' { + if len(newPath) > 0 && newPath[0] == '/' { newPath = newPath[1:] } break