Search in sources :

Example 1 with Platforms

use of com.github.jakz.romlib.data.platforms.Platforms in project rom-manager by Jakz.

the class MainFrame method rebuildEnabledDats.

public void rebuildEnabledDats() {
    GameSet current = cbRomSets.getSelectedIndex() != -1 ? cbRomSets.getItemAt(cbRomSets.getSelectedIndex()) : null;
    cbRomSets.setSelectedIndex(-1);
    cbRomSets.removeAllItems();
    List<Platform> platforms = Platforms.sortedValues();
    List<GameSet> sets = GlobalSettings.settings.getEnabledProviders().stream().map(setManager::byIdent).collect(Collectors.toList());
    platforms.forEach(s -> {
        sets.stream().filter(rs -> rs.platform().equals(s)).forEach(cbRomSets::addItem);
    });
    if (current != null && sets.contains(current))
        cbRomSets.setSelectedItem(current);
    else if (cbRomSets.getItemCount() == 0)
        gameListPanel.clearEverything();
}
Also used : Color(java.awt.Color) Arrays(java.util.Arrays) OperationalPlugin(jack.rm.plugins.OperationalPlugin) MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures) ItemListener(java.awt.event.ItemListener) Platforms(com.github.jakz.romlib.data.platforms.Platforms) Organizer(jack.rm.files.Organizer) FileTransferHandler(com.pixbits.lib.ui.FileTransferHandler) GameSet(com.github.jakz.romlib.data.set.GameSet) GameListPanel(jack.rm.gui.gamelist.GameListPanel) WindowListener(java.awt.event.WindowListener) Map(java.util.Map) Text(jack.rm.i18n.Text) MouseAdapter(java.awt.event.MouseAdapter) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) JFrame(javax.swing.JFrame) GameListData(jack.rm.gui.gamelist.GameListData) Feature(com.github.jakz.romlib.data.set.Feature) JMenuBar(javax.swing.JMenuBar) ItemEvent(java.awt.event.ItemEvent) Predicate(java.util.function.Predicate) InfoPanel(jack.rm.gui.gameinfo.InfoPanel) JMenu(javax.swing.JMenu) SearchPanel(com.github.jakz.romlib.ui.SearchPanel) Collectors(java.util.stream.Collectors) WindowEvent(java.awt.event.WindowEvent) Dimension(java.awt.Dimension) List(java.util.List) Drawable(com.github.jakz.romlib.data.game.Drawable) GameClone(com.github.jakz.romlib.data.game.GameClone) GlobalSettings(jack.rm.GlobalSettings) RomSize(com.github.jakz.romlib.data.game.RomSize) JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout) JSplitPane(javax.swing.JSplitPane) GameAttribute(com.github.jakz.romlib.data.game.attributes.GameAttribute) Game(com.github.jakz.romlib.data.game.Game) GameListModel(jack.rm.gui.gamelist.GameListModel) Attribute(com.github.jakz.romlib.data.game.attributes.Attribute) ArrayList(java.util.ArrayList) GridLayout(java.awt.GridLayout) SwingUtilities(javax.swing.SwingUtilities) JMenuItem(javax.swing.JMenuItem) GameCellRenderer(jack.rm.gui.gamelist.GameCellRenderer) ButtonGroup(javax.swing.ButtonGroup) CountPanel(jack.rm.gui.gamelist.CountPanel) PluginRealType(jack.rm.plugins.PluginRealType) IOException(java.io.IOException) GameStatus(com.github.jakz.romlib.data.game.GameStatus) MouseEvent(java.awt.event.MouseEvent) AssetPacker(jack.rm.files.AssetPacker) ListCellRenderer(javax.swing.ListCellRenderer) Platform(com.github.jakz.romlib.data.platforms.Platform) TreeMap(java.util.TreeMap) Comparator(java.util.Comparator) Collections(java.util.Collections) Main(jack.rm.Main) GameSetManager(jack.rm.data.romset.GameSetManager) Settings(jack.rm.data.romset.Settings) Platform(com.github.jakz.romlib.data.platforms.Platform) GameSet(com.github.jakz.romlib.data.set.GameSet)

Example 2 with Platforms

use of com.github.jakz.romlib.data.platforms.Platforms in project rom-manager by Jakz.

the class OfflineListProviderPlugin method buildRomSets.

@Override
public GameSet[] buildRomSets(List<DatParserPlugin> datParsers) {
    DatParserPlugin parser = this.findDatParser(datParsers, "offline-list");
    List<GameSet> sets = new ArrayList<>();
    try {
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", new GBASaveParserOL());
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.GBA, KnownProviders.OFFLINE_LIST.derive("", "", "Replouf66", new Provider.Source("http://offlinelistgba.free.fr/tool/ReleaseList/gba_OL_0.7.1.zip")), datParser, format, GBA_ATTRIBUTES, new AssetManager(GBA_ASSETS, new URL("http://offlinelistgba.free.fr/imgs/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", new GBASaveParserAS());
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.GBA, KnownProviders.ADVAN_SCENE.derive("pure", "", "AdvanScene", new Provider.Source("http://www.advanscene.com/offline/datas/ADVANsCEne_GBA.zip")), datParser, format, GBA_ATTRIBUTES, new AssetManager(GBA_ASSETS, new URL("http://www.advanscene.com/offline/imgs/ADVANsCEne_GBA/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", (SaveParser) (s -> GameSave.NULL));
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            final Asset[] PSP_ASSETS = { new Asset.Image(Paths.get("title"), new Dimension(208, 181 * 2)), new Asset.Image(Paths.get("gameplay"), new Dimension(320 * 2, 181 * 2)) };
            final Attribute[] attributes = { GameAttribute.TITLE, GameAttribute.NUMBER, GameAttribute.SIZE, GameAttribute.PUBLISHER, GameAttribute.LOCATION, GameAttribute.LANGUAGE, GameAttribute.GROUP, GameAttribute.COMMENT };
            sets.add(new GameSet(Platforms.PSP, KnownProviders.ADVAN_SCENE.derive("", "", "AdvanScene", new Provider.Source("http://www.advanscene.com/offline/datas/ADVANsCEne_PSP.zip")), datParser, format, attributes, new AssetManager(PSP_ASSETS, new URL("http://www.advanscene.com/offline/imgs/ADVANsCEne_PSP/")), s -> new MyGameSetFeatures(s)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", new NDSSaveParser());
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.NDS, KnownProviders.ADVAN_SCENE.derive("collection", "", "AdvanScene", new Provider.Source("http://www.advanscene.com/offline/datas/ADVANsCEne_NDS.zip")), datParser, format, GBA_ATTRIBUTES, new AssetManager(NDS_ASSETS, new URL("http://www.advanscene.com/offline/imgs/ADVANsCEne_NDS/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        /* Nintendo 3DS */
        {
            final Asset[] _3DS_ASSETS = { new Asset.Image(Paths.get("title"), new Dimension(268, 480)), new Asset.Image(Paths.get("gameplay"), new Dimension(400, 480)) };
            final Attribute[] _3DS_ATTRIBUTES = { GameAttribute.TITLE, GameAttribute.NUMBER, GameAttribute.SIZE, GameAttribute.PUBLISHER, GameAttribute.GROUP, GameAttribute.SAVE_TYPE, GameAttribute.LOCATION, GameAttribute.LANGUAGE, GameAttribute.COMMENT };
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", (SaveParser) s -> null);
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms._3DS, KnownProviders.ADVAN_SCENE.derive("", "", "AdvanScene", new Provider.Source("http://www.advanscene.com/offline/datas/ADVANsCEne_3DS.zip")), datParser, format, _3DS_ATTRIBUTES, new AssetManager(_3DS_ASSETS, new URL("http://www.advanscene.com/offline/imgs/ADVANsCEne_3DS/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", (SaveParser) (r -> null));
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.GBC, KnownProviders.NO_INTRO.derive("", "", "Replouf66", new Provider.Source("http://nointro.free.fr/datas/Official%20No-Intro%20Nintendo%20Gameboy%20Color.zip")), datParser, format, GB_ATTRIBUTES, new AssetManager(GB_ASSETS, new URL("http://nointro.free.fr/imgs/Official%20No-Intro%20Nintendo%20Gameboy%20Color/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", (SaveParser) (r -> null));
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.GB, KnownProviders.NO_INTRO.derive("", "", "MadBob", new Provider.Source("http://nointro.free.fr/datas/Official%20No-Intro%20Nintendo%20Gameboy.zip")), datParser, format, GB_ATTRIBUTES, new AssetManager(GB_ASSETS, new URL("http://nointro.free.fr/imgs/Official%20No-Intro%20Nintendo%20Gameboy/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", (SaveParser) (r -> null));
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.NES, KnownProviders.NO_INTRO.derive("", "", "Zepman", new Provider.Source("http://nointro.free.fr/datas/Official%20No-Intro%20Nintendo%20NES%20-%20Famicom.zip")), datParser, format, NES_ATTRIBUTES, new AssetManager(GB_ASSETS, new URL("http://nointro.free.fr/imgs/Official%20No-Intro%20Nintendo%20NES%20-%20Famicom/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
            sets.add(new GameSet(Platforms.NES, KnownProviders.OFFLINE_LIST.derive("", "", "Zepman", new Provider.Source("http://nesofflinelist.free.fr/dat/nes_OL.zip")), datParser, format, NES_ATTRIBUTES, new AssetManager(NES_ASSETS, new URL("http://nesofflinelist.free.fr/imgs/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        {
            Map<String, Object> args = new HashMap<>();
            args.put("save-parser", (SaveParser) (r -> null));
            DataSupplier datParser = parser.buildDatLoader("offline-list", args);
            DatFormat format = datParser.getFormat();
            sets.add(new GameSet(Platforms.LYNX, KnownProviders.NO_INTRO.derive("", "", "Atari Lynx", new Provider.Source("http://nointro.free.fr/datas/Official%20No-Intro%20Atari%20Lynx.zip")), datParser, format, NES_ATTRIBUTES, new AssetManager(LYNX_ASSETS, new URL("http://nointro.free.fr/imgs/Official%20No-Intro%20Atari%20Lynx/")), s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
        }
        return sets.toArray(new GameSet[sets.size()]);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : Arrays(java.util.Arrays) SaveParser(com.github.jakz.romlib.parsers.SaveParser) URL(java.net.URL) GameAttribute(com.github.jakz.romlib.data.game.attributes.GameAttribute) DatFormat(com.github.jakz.romlib.data.set.DatFormat) Asset(com.github.jakz.romlib.data.assets.Asset) Game(com.github.jakz.romlib.data.game.Game) DataSupplier(com.github.jakz.romlib.data.set.DataSupplier) HashMap(java.util.HashMap) MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures) Attribute(com.github.jakz.romlib.data.game.attributes.Attribute) ProviderPlugin(jack.rm.plugins.types.ProviderPlugin) Platforms(com.github.jakz.romlib.data.platforms.Platforms) ArrayList(java.util.ArrayList) GameSet(com.github.jakz.romlib.data.set.GameSet) Map(java.util.Map) DatParserPlugin(jack.rm.plugins.types.DatParserPlugin) Feature(com.github.jakz.romlib.data.set.Feature) NDS(com.github.jakz.romlib.data.platforms.NDS) MalformedURLException(java.net.MalformedURLException) Version(com.github.jakz.romlib.data.game.Version) DecimalFormat(java.text.DecimalFormat) UnknownFormatConversionException(java.util.UnknownFormatConversionException) Dimension(java.awt.Dimension) List(java.util.List) Platform(com.github.jakz.romlib.data.platforms.Platform) Paths(java.nio.file.Paths) GameSave(com.github.jakz.romlib.data.game.GameSave) Provider(com.github.jakz.romlib.data.set.Provider) GBA(com.github.jakz.romlib.data.platforms.GBA) RomSize(com.github.jakz.romlib.data.game.RomSize) MalformedURLException(java.net.MalformedURLException) ArrayList(java.util.ArrayList) Dimension(java.awt.Dimension) URL(java.net.URL) SaveParser(com.github.jakz.romlib.parsers.SaveParser) DataSupplier(com.github.jakz.romlib.data.set.DataSupplier) MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures) DatFormat(com.github.jakz.romlib.data.set.DatFormat) HashMap(java.util.HashMap) Map(java.util.Map) DatParserPlugin(jack.rm.plugins.types.DatParserPlugin) GameSet(com.github.jakz.romlib.data.set.GameSet)

Aggregations

Game (com.github.jakz.romlib.data.game.Game)2 RomSize (com.github.jakz.romlib.data.game.RomSize)2 Attribute (com.github.jakz.romlib.data.game.attributes.Attribute)2 GameAttribute (com.github.jakz.romlib.data.game.attributes.GameAttribute)2 Platform (com.github.jakz.romlib.data.platforms.Platform)2 Platforms (com.github.jakz.romlib.data.platforms.Platforms)2 Feature (com.github.jakz.romlib.data.set.Feature)2 GameSet (com.github.jakz.romlib.data.set.GameSet)2 MyGameSetFeatures (jack.rm.data.romset.MyGameSetFeatures)2 Dimension (java.awt.Dimension)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 List (java.util.List)2 Map (java.util.Map)2 Asset (com.github.jakz.romlib.data.assets.Asset)1 Drawable (com.github.jakz.romlib.data.game.Drawable)1 GameClone (com.github.jakz.romlib.data.game.GameClone)1 GameSave (com.github.jakz.romlib.data.game.GameSave)1 GameStatus (com.github.jakz.romlib.data.game.GameStatus)1 Version (com.github.jakz.romlib.data.game.Version)1