Search in sources :

Example 1 with GameSet

use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.

the class ViewMenu method rebuild.

void rebuild(GameSet set, GameListData.Mode mode) {
    if (set != null) {
        // TODO: mind that there's no check for overlap
        final int firstStroke = KeyEvent.VK_F1;
        final GameStatus[] statuses = GameStatus.values();
        for (int i = 0; i < filterByStatus.length; ++i) {
            filterByStatus[i] = new JCheckBoxMenuItem("Show " + statuses[i].name.toLowerCase(), true);
            filterByStatus[i].setAccelerator(KeyStroke.getKeyStroke(firstStroke + i, 0));
            filterByStatus[i].addActionListener(listener);
            add(filterByStatus[i]);
        }
        if (set.hasFeature(Feature.CLONES)) {
            JMenu modeMenu = new JMenu("Mode");
            viewModes = new JRadioButtonMenuItem[2];
            viewModes[0] = new JRadioButtonMenuItem("Games");
            viewModes[1] = new JRadioButtonMenuItem("Clones");
            viewModesRadioGroup = new ButtonGroup();
            viewModesRadioGroup.add(viewModes[0]);
            viewModesRadioGroup.add(viewModes[1]);
            (mode == GameListData.Mode.CLONES ? viewModes[1] : viewModes[0]).setSelected(true);
            modeMenu.add(viewModes[0]);
            modeMenu.add(viewModes[1]);
            ActionListener switchModeListener = e -> {
                GameListData.Mode m = e.getSource() == viewModes[0] ? GameListData.Mode.GAMES : GameListData.Mode.CLONES;
                mediator.switchGameListMode(m);
            };
            viewModes[0].addActionListener(switchModeListener);
            viewModes[1].addActionListener(switchModeListener);
            add(modeMenu);
        }
        addSeparator();
        sortCriteriaRadioGroup = new ButtonGroup();
        sortCriteria = new JRadioButtonMenuItem[sortAttributes.length + 1];
        JMenu sortMenu = new JMenu(Text.MENU_VIEW_SORT_BY.text());
        sortCriteria[0] = new JRadioButtonMenuItem("None");
        for (int i = 0; i < sortAttributes.length; ++i) sortCriteria[i + 1] = new JRadioButtonMenuItem(sortAttributes[i].getCaption());
        for (JRadioButtonMenuItem menuItem : sortCriteria) {
            menuItem.addActionListener(listener);
            sortCriteriaRadioGroup.add(menuItem);
            sortMenu.add(menuItem);
        }
        sortCriteria[0].setSelected(true);
        sortCriteria[3].setEnabled(set.doesSupportAttribute(GameAttribute.NUMBER));
        reverseSortOrder = new JCheckBoxMenuItem(Text.MENU_VIEW_REVERSE_ORDER.text());
        reverseSortOrder.addActionListener(listener);
        add(sortMenu);
        add(reverseSortOrder);
    }
}
Also used : GameStatus(com.github.jakz.romlib.data.game.GameStatus) Arrays(java.util.Arrays) ActionListener(java.awt.event.ActionListener) BiFunction(java.util.function.BiFunction) GameAttribute(com.github.jakz.romlib.data.game.attributes.GameAttribute) Game(com.github.jakz.romlib.data.game.Game) Attribute(com.github.jakz.romlib.data.game.attributes.Attribute) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) GameSet(com.github.jakz.romlib.data.set.GameSet) StreamUtil(com.pixbits.lib.functional.StreamUtil) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Text(jack.rm.i18n.Text) ButtonModel(javax.swing.ButtonModel) GameListData(jack.rm.gui.gamelist.GameListData) Feature(com.github.jakz.romlib.data.set.Feature) KeyStroke(javax.swing.KeyStroke) ButtonGroup(javax.swing.ButtonGroup) Predicate(java.util.function.Predicate) JMenu(javax.swing.JMenu) GameStatus(com.github.jakz.romlib.data.game.GameStatus) KeyEvent(java.awt.event.KeyEvent) List(java.util.List) Drawable(com.github.jakz.romlib.data.game.Drawable) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Comparator(java.util.Comparator) Pair(com.pixbits.lib.lang.Pair) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JMenu(javax.swing.JMenu)

Example 2 with GameSet

use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.

the class ClonesDialog method activate.

public void activate(GameSet set, Set<ScanResult> clones) {
    this.set = set;
    this.keep.clear();
    this.clones.clear();
    // TODO: probably requires to be rewritten almost totally to manage multiple roms per game
    Set<Rom> romClones = clones.stream().map(c -> c.rom).collect(Collectors.toSet());
    this.clones = new ArrayList<>(clones);
    this.clones.addAll(set.stream().flatMap(g -> g.stream()).filter(r -> romClones.contains(r)).map(r -> new ScanResult(r, r.handle())).collect(Collectors.toList()));
    Collections.sort(this.clones);
    this.keep = this.clones.stream().collect(Collectors.toMap(c -> c, c -> false));
    this.colors = romClones.stream().collect(Collectors.toMap(c -> c, c -> colorGenerator.getColor()));
    updateStatus();
    model.fireChanges();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    Dialogs.showWarning("Clones Found", colors.size() + " clones have been found,\nplease specify which entries you want to keep", this);
}
Also used : Color(java.awt.Color) NimbusBooleanCellRenderer(com.pixbits.lib.ui.table.renderers.NimbusBooleanCellRenderer) Arrays(java.util.Arrays) JDialog(javax.swing.JDialog) HashMap(java.util.HashMap) TableCellRenderer(javax.swing.table.TableCellRenderer) SwingConstants(javax.swing.SwingConstants) Handle(com.pixbits.lib.io.archive.handles.Handle) ArrayList(java.util.ArrayList) GameSet(com.github.jakz.romlib.data.set.GameSet) PastelColorGenerator(com.pixbits.lib.ui.color.PastelColorGenerator) ArchiveHandle(com.pixbits.lib.io.archive.handles.ArchiveHandle) Map(java.util.Map) AbstractTableModel(javax.swing.table.AbstractTableModel) BorderLayout(java.awt.BorderLayout) LinkedList(java.util.LinkedList) JComboBox(javax.swing.JComboBox) Rom(com.github.jakz.romlib.data.game.Rom) BinaryHandle(com.pixbits.lib.io.archive.handles.BinaryHandle) ScanResult(jack.rm.files.ScanResult) BoxLayout(javax.swing.BoxLayout) JComponent(javax.swing.JComponent) NestedArchiveHandle(com.pixbits.lib.io.archive.handles.NestedArchiveHandle) Frame(java.awt.Frame) JButton(javax.swing.JButton) Predicate(java.util.function.Predicate) Set(java.util.Set) BorderFactory(javax.swing.BorderFactory) Component(java.awt.Component) Collectors(java.util.stream.Collectors) JScrollPane(javax.swing.JScrollPane) List(java.util.List) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) JLabel(javax.swing.JLabel) ColorGenerator(com.pixbits.lib.ui.color.ColorGenerator) JCheckBox(javax.swing.JCheckBox) Optional(java.util.Optional) JTable(javax.swing.JTable) Collections(java.util.Collections) Main(jack.rm.Main) JPanel(javax.swing.JPanel) GameSetManager(jack.rm.data.romset.GameSetManager) Rom(com.github.jakz.romlib.data.game.Rom) ScanResult(jack.rm.files.ScanResult)

Example 3 with GameSet

use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.

the class ViewMenu method rebuild.

void rebuild(GameSet set, GameListData.Mode mode, boolean isTreeMode) {
    if (set != null) {
        // TODO: mind that there's no check for overlap
        final int firstStroke = KeyEvent.VK_F1;
        final GameStatus[] statuses = GameStatus.values();
        for (int i = 0; i < filterByStatus.length; ++i) {
            filterByStatus[i] = new JCheckBoxMenuItem("Show " + statuses[i].name.toLowerCase(), true);
            filterByStatus[i].setAccelerator(KeyStroke.getKeyStroke(firstStroke + i, 0));
            filterByStatus[i].addActionListener(listener);
            add(filterByStatus[i]);
        }
        if (set.hasFeature(Feature.CLONES)) {
            JMenu modeMenu = new JMenu("Mode");
            viewModes = new JRadioButtonMenuItem[3];
            viewModes[0] = new JRadioButtonMenuItem("Games");
            viewModes[1] = new JRadioButtonMenuItem("Clones");
            viewModes[2] = new JRadioButtonMenuItem("Clones Tree");
            viewModesRadioGroup = new ButtonGroup();
            viewModesRadioGroup.add(viewModes[0]);
            viewModesRadioGroup.add(viewModes[1]);
            viewModesRadioGroup.add(viewModes[2]);
            if (isTreeMode)
                viewModes[2].setSelected(true);
            else if (mode == GameListData.Mode.CLONES)
                viewModes[1].setSelected(true);
            else
                viewModes[0].setSelected(true);
            ;
            modeMenu.add(viewModes[0]);
            modeMenu.add(viewModes[1]);
            modeMenu.add(viewModes[2]);
            ActionListener switchModeListener = e -> {
                GameListData.Mode m = e.getSource() == viewModes[0] ? GameListData.Mode.GAMES : GameListData.Mode.CLONES;
                boolean treeMode = e.getSource() == viewModes[2];
                mediator.switchGameListMode(m, treeMode);
            };
            viewModes[0].addActionListener(switchModeListener);
            viewModes[1].addActionListener(switchModeListener);
            viewModes[2].addActionListener(switchModeListener);
            add(modeMenu);
        }
        addSeparator();
        sortCriteriaRadioGroup = new ButtonGroup();
        sortCriteria = new JRadioButtonMenuItem[sortAttributes.length + 1];
        JMenu sortMenu = new JMenu(Text.MENU_VIEW_SORT_BY.text());
        sortCriteria[0] = new JRadioButtonMenuItem("None");
        for (int i = 0; i < sortAttributes.length; ++i) sortCriteria[i + 1] = new JRadioButtonMenuItem(sortAttributes[i].getCaption());
        for (JRadioButtonMenuItem menuItem : sortCriteria) {
            menuItem.addActionListener(listener);
            sortCriteriaRadioGroup.add(menuItem);
            sortMenu.add(menuItem);
        }
        sortCriteria[0].setSelected(true);
        sortCriteria[3].setEnabled(set.doesSupportAttribute(GameAttribute.NUMBER));
        reverseSortOrder = new JCheckBoxMenuItem(Text.MENU_VIEW_REVERSE_ORDER.text());
        reverseSortOrder.addActionListener(listener);
        add(sortMenu);
        add(reverseSortOrder);
    }
}
Also used : GameStatus(com.github.jakz.romlib.data.game.GameStatus) Arrays(java.util.Arrays) ActionListener(java.awt.event.ActionListener) BiFunction(java.util.function.BiFunction) GameAttribute(com.github.jakz.romlib.data.game.attributes.GameAttribute) Game(com.github.jakz.romlib.data.game.Game) Attribute(com.github.jakz.romlib.data.game.attributes.Attribute) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) GameSet(com.github.jakz.romlib.data.set.GameSet) StreamUtil(com.pixbits.lib.functional.StreamUtil) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Text(jack.rm.i18n.Text) ButtonModel(javax.swing.ButtonModel) GameListData(jack.rm.gui.gamelist.GameListData) Feature(com.github.jakz.romlib.data.set.Feature) KeyStroke(javax.swing.KeyStroke) ButtonGroup(javax.swing.ButtonGroup) Predicate(java.util.function.Predicate) JMenu(javax.swing.JMenu) GameStatus(com.github.jakz.romlib.data.game.GameStatus) KeyEvent(java.awt.event.KeyEvent) List(java.util.List) Drawable(com.github.jakz.romlib.data.game.Drawable) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Comparator(java.util.Comparator) Pair(com.pixbits.lib.lang.Pair) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JMenu(javax.swing.JMenu)

Example 4 with GameSet

use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.

the class DatUpdater method updateDat.

public static void updateDat(GameSet set, Consumer<Boolean> callback) throws IOException {
    Path destDat = set.datPath();
    AtomicReference<Path> tmpDownloadPath = new AtomicReference<Path>(Files.createTempFile(null, null));
    AtomicReference<Path> tmpZippedPath = new AtomicReference<Path>();
    AtomicLong crc = new AtomicLong(-1);
    AtomicLong size = new AtomicLong(-1);
    /* if dat file exists we first compute the CRC and size of the current file to compare with the one that is going to be downloaded */
    if (set.canBeLoaded()) {
        crc.set(FileUtils.calculateCRCFast(destDat));
        size.set(Files.size(destDat));
    }
    final Consumer<Boolean> consolidationStep = r -> {
        try {
            Path src = tmpDownloadPath.get();
            if (crc.get() != -1) {
                long ncrc = FileUtils.calculateCRCFast(src);
                long nsize = Files.size(src);
                if (ncrc == crc.get() && nsize == size.get()) {
                    Dialogs.showWarning("Dat already up-to-date", "Your DAT version is already up to date!", Main.gsettingsView);
                    return;
                }
            }
            Files.createDirectories(destDat.getParent());
            Files.move(src, destDat, StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            e.printStackTrace();
        }
    };
    final Consumer<Boolean> cleanupStep = r -> {
        try {
            if (tmpDownloadPath.get() != null)
                Files.deleteIfExists(tmpDownloadPath.get());
            if (tmpZippedPath.get() != null)
                Files.deleteIfExists(tmpZippedPath.get());
        } catch (IOException e) {
            e.printStackTrace();
            callback.accept(false);
        }
    };
    Consumer<Boolean> extractionStep = r -> {
        boolean isZipped = false;
        try {
            ZipFile zfile = new ZipFile(tmpDownloadPath.get().toFile());
            isZipped = true;
            zfile.close();
        } catch (IOException e) {
        }
        try {
            if (isZipped) {
                tmpZippedPath.set(tmpDownloadPath.get());
                tmpDownloadPath.set(Files.createTempFile(null, null));
                logger.i(LogTarget.romset(set), "Extracting DAT for " + set.ident() + " to " + tmpDownloadPath);
                ZipExtractWorker<?> worker = new ZipExtractWorker<OperationDetails>(tmpZippedPath.get(), tmpDownloadPath.get(), new OperationDetails() {

                    public String getTitle() {
                        return "Uncompressing";
                    }

                    public String getProgressText() {
                        return "Progress..";
                    }
                }, consolidationStep.andThen(cleanupStep).andThen(callback), Main.gsettingsView);
                worker.execute();
            } else
                consolidationStep.andThen(cleanupStep).andThen(callback).accept(true);
        } catch (IOException e) {
            e.printStackTrace();
            callback.accept(false);
        }
    };
    logger.i(LogTarget.romset(set), "Downloading DAT for " + set.ident() + " to " + tmpDownloadPath);
    final Provider.Source source = set.info().getProvider().getSource();
    DownloadWorker<?> worker = new DownloadWorker<OperationDetails>(source.getURL(), tmpDownloadPath.get(), OperationDetails.of("Downloading", "Progress.."), extractionStep, Main.progress, Main.gsettingsView, source.getPostArguments());
    worker.execute();
}
Also used : Path(java.nio.file.Path) Files(java.nio.file.Files) LogSource(jack.rm.log.LogSource) LogTarget(jack.rm.log.LogTarget) Dialogs(jack.rm.gui.Dialogs) IOException(java.io.IOException) DownloadWorker(jack.rm.files.DownloadWorker) AtomicReference(java.util.concurrent.atomic.AtomicReference) StandardCopyOption(java.nio.file.StandardCopyOption) OperationDetails(com.pixbits.lib.concurrent.OperationDetails) Consumer(java.util.function.Consumer) GameSet(com.github.jakz.romlib.data.set.GameSet) AtomicLong(java.util.concurrent.atomic.AtomicLong) FileUtils(com.pixbits.lib.io.FileUtils) ZipExtractWorker(jack.rm.files.ZipExtractWorker) Logger(com.pixbits.lib.log.Logger) Provider(com.github.jakz.romlib.data.set.Provider) Log(com.pixbits.lib.log.Log) ZipFile(java.util.zip.ZipFile) Path(java.nio.file.Path) Main(jack.rm.Main) DownloadWorker(jack.rm.files.DownloadWorker) ZipExtractWorker(jack.rm.files.ZipExtractWorker) AtomicReference(java.util.concurrent.atomic.AtomicReference) IOException(java.io.IOException) Provider(com.github.jakz.romlib.data.set.Provider) OperationDetails(com.pixbits.lib.concurrent.OperationDetails) AtomicLong(java.util.concurrent.atomic.AtomicLong) ZipFile(java.util.zip.ZipFile)

Example 5 with GameSet

use of com.github.jakz.romlib.data.set.GameSet 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) 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

GameSet (com.github.jakz.romlib.data.set.GameSet)12 Arrays (java.util.Arrays)8 List (java.util.List)7 Feature (com.github.jakz.romlib.data.set.Feature)6 ArrayList (java.util.ArrayList)6 Game (com.github.jakz.romlib.data.game.Game)5 MyGameSetFeatures (jack.rm.data.romset.MyGameSetFeatures)5 IOException (java.io.IOException)5 Map (java.util.Map)5 Collectors (java.util.stream.Collectors)5 Drawable (com.github.jakz.romlib.data.game.Drawable)4 Platforms (com.github.jakz.romlib.data.platforms.Platforms)4 Main (jack.rm.Main)4 Predicate (java.util.function.Predicate)4 Attribute (com.github.jakz.romlib.data.game.attributes.Attribute)3 GameAttribute (com.github.jakz.romlib.data.game.attributes.GameAttribute)3 GameSetManager (jack.rm.data.romset.GameSetManager)3 Settings (jack.rm.data.romset.Settings)3 GameListData (jack.rm.gui.gamelist.GameListData)3 Text (jack.rm.i18n.Text)3