use of com.github.jakz.romlib.data.set.GameSet 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();
}
use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.
the class MoveUnknownFilesPlugin method execute.
@Override
public void execute(GameSet set) {
try {
counter = 0;
if (!Files.exists(path) || !Files.isDirectory(path))
Files.createDirectory(path);
Set<Path> existing = set.romStream().filter(r -> r.isPresent()).map(r -> r.handle().path()).collect(Collectors.toSet());
Settings settings = getGameSetSettings();
Set<Path> total = new FolderScanner(FileSystems.getDefault().getPathMatcher("glob:*.*"), settings.getIgnoredPaths(), true).scan(settings.romsPath);
total.removeAll(existing);
total.stream().filter(f -> !f.getParent().equals(path)).forEach(f -> {
Path dest = path.resolve(f.getFileName());
int i = 1;
while (Files.exists(dest)) dest = path.resolve(f.getFileName().toString() + (i++));
try {
Files.move(f, dest);
++counter;
} catch (IOException e) {
e.printStackTrace();
/* TODO: log */
}
});
message("Moved " + counter + " unknown files");
} catch (IOException e) {
e.printStackTrace();
// TODO: log
}
}
use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.
the class ClrMamePlugin method buildRomSets.
@Override
public GameSet[] buildRomSets(List<DatParserPlugin> datParsers) {
DatParserPlugin datParser = this.findDatParser(datParsers, "clr-mame-pro-nointro");
List<GameSet> sets = new ArrayList<>();
{
DataSupplier parser = datParser.buildDatLoader("clr-mame-pro-nointro");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.GG, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
}
{
DataSupplier parser = datParser.buildDatLoader("clr-mame-pro-nointro");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.LYNX, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.MD, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
// TODO: this should be added only if XMDB is not present
parser = parser.apply(new NormalizedTitleCloneSetCreator());
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.NDS, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s, Feature.FINITE_SIZE_SET)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.PSP, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.PSP, KnownProviders.NO_INTRO.derive("With Clones", "with-clones", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms.N64, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
DatFormat format = parser.getFormat();
sets.add(new GameSet(Platforms._3DS, KnownProviders.NO_INTRO.derive("", "", "", null), parser, format, GG_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
parser = parser.apply(new RedumpAggregatorByDisks());
parser = parser.apply(new NormalizedTitleCloneSetCreator());
DatFormat format = parser.getFormat();
final Attribute[] PC_ATTRIBUTES = { GameAttribute.TITLE, GameAttribute.SIZE, GameAttribute.LOCATION, GameAttribute.LANGUAGE, GameAttribute.VERSION, GameAttribute.VERSION_NUMBER };
sets.add(new GameSet(Platforms.IBM_PC, KnownProviders.REDUMP.derive("", "", "", new Provider.Source("http://redump.org/datfile/pc/")), parser, format, PC_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
parser = parser.apply(new RedumpAggregatorByDisks());
parser = parser.apply(new NormalizedTitleCloneSetCreator());
DatFormat format = parser.getFormat();
final Attribute[] PC_ATTRIBUTES = { GameAttribute.TITLE, GameAttribute.SIZE, GameAttribute.LOCATION, GameAttribute.LANGUAGE, GameAttribute.VERSION, GameAttribute.VERSION_NUMBER };
sets.add(new GameSet(Platforms.PS2, KnownProviders.REDUMP.derive("", "", "", null), parser, format, PC_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
sets.add(new GameSet(Platforms.GC, KnownProviders.REDUMP.derive("", "", "", new Provider.Source("http://redump.org/datfile/gc/")), parser, format, PC_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s)));
}
{
DataSupplier parser = findDatParser(datParsers, "logiqx-xml").buildDatLoader("logiqx-xml");
parser = parser.apply(new GoodOldDaysFixer());
parser = parser.apply(new GoodOldDaysFixer.CloneCreator());
DatFormat format = parser.getFormat();
final Attribute[] PC_ATTRIBUTES = { GameAttribute.TITLE, GameAttribute.SIZE, GameAttribute.LOCATION, GameAttribute.LANGUAGE, GameAttribute.RELEASE_DATE, GameAttribute.DESCRIPTION, GameAttribute.COMMENT };
sets.add(new GameSet(Platforms.IBM_PC, KnownProviders.GOOD_OLD_DAYS, parser, format, PC_ATTRIBUTES, AssetManager.DUMMY, s -> new MyGameSetFeatures(s, GameID.Generator.BY_RELEASE_NUMBER, Feature.FINITE_SIZE_SET)));
}
return sets.toArray(new GameSet[sets.size()]);
}
use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.
the class Main method loadRomSet.
public static void loadRomSet(GameSet romSet) throws FileNotFoundException, IOException {
if (current != null)
setManager.saveSetStatus(current);
GameSet set = setManager.loadSet(romSet);
current = set;
boolean wasInit = setManager.loadSetStatus(set);
MyGameSetFeatures helper = set.helper();
helper.pluginStateChanged();
mainFrame.romSetLoaded(set);
MyGameSetFeatures features = set.helper();
features.organizer().computeStatus();
helper.scanner().scanForRoms(!wasInit && GlobalSettings.settings.shouldScanWhenLoadingRomset());
downloader = new MyAssetDownloader(set);
/*List<Game> favourites = set.filter("is:fav");
Fetcher<GameEntry> source = new MultipleGameSource(favourites);
Mutuator<GameEntry> sorter = new OrganizeByAttribute(GameAttribute.TAG, false);
Mutuator<GameEntry> renamer = new RenameByExportTitle();
Dumper<GameEntry> dumper = new GameConsolidator(Paths.get("/Users/jack/Desktop/everdrive"));
Workflow<GameEntry> workflow = new Workflow<>(source,dumper);
workflow.addStep(new LogOperation());
workflow.addStep(sorter);
workflow.addStep(renamer);
workflow.addStep(e -> {
Game g = e.getGame();
if (g.hasAnyCustomAttribute() && !g.isFavourite())
System.out.println("Missing favorite on "+g.getTitle());
return e;
});
workflow.execute();
java.lang.System.exit(0);*/
/*List<Rom> favourites = set.filter("is:fav");*/
/*List<Rom> favs = set.filter("is:fav");
final Optional<Integer> c = Optional.of(0);
Fetcher<RomHandle> source = new MultipleRomSource(favs);
Dumper<RomHandle> dumper = new RomConsolidator(Paths.get("/Volumes/Vicky/nds"));
Workflow<RomHandle> workflow = new Workflow<>(source, dumper);
workflow.addStep(rh -> { java.lang.System.out.println(c.get()+" of "+favs.size()); return rh; });
workflow.execute();*/
// IPSPatchOperation ipsOperation = new IPSPatchOperation();
// ipsOperation.toggleAutomaticPatching(true);
// workflow.addBenchmarkedStep(new LogOperation());
// workflow.addBenchmarkedStep(ipsOperation);
// workflow.addBenchmarkedStep(new GBASleepHackOperation());
// workflow.addBenchmarkedStep(new TrimOperation(new byte[] {0x00, (byte)0xff}));
// workflow.addStep(new SortByAttributeOperation(RomAttribute.TAG, false));
// workflow.execute();
// java.lang.System.exit(0);
/*
try
{
BinaryBuffer buffer = new BinaryBuffer("/Users/jack/Documents/Dev/gba/sma-m.gba", BinaryBuffer.Mode.WRITE, ByteOrder.LITTLE_ENDIAN);
java.lang.System.out.println(buffer.length());
new GBASleepHack().patch(buffer);
buffer.close();
}
catch (Exception e)
{
e.printStackTrace();
}
java.lang.System.exit(0);*/
}
use of com.github.jakz.romlib.data.set.GameSet in project rom-manager by Jakz.
the class GameSetManager method buildRomsetList.
@SuppressWarnings("unchecked")
public void buildRomsetList() {
Set<ActualPluginBuilder> parsers = manager.getBuildersByType(PluginRealType.DAT_PARSER);
List<DatParserPlugin> datParsers = parsers.stream().map(b -> (DatParserPlugin) manager.build((Class<DatParserPlugin>) b.getID().getType())).collect(Collectors.toList());
Set<ActualPluginBuilder> builders = manager.getBuildersByType(PluginRealType.PROVIDER);
logger.d("Building available rom sets");
logger.ld("Found %d dat parsers: %s", () -> datParsers.size(), () -> datParsers.stream().map(p -> Arrays.toString(p.getSupportedFormats())).collect(Collectors.joining(", ")));
for (ActualPluginBuilder builder : builders) {
ProviderPlugin plugin = (ProviderPlugin) manager.build((Class<ProviderPlugin>) builder.getID().getType());
logger.d("Found ProviderPlugin: %s", plugin.getClass().getName());
GameSet[] rsets = plugin.buildRomSets(datParsers);
for (GameSet set : rsets) {
helpers.put(set, new MyGameSetFeatures(set));
List<GameSet> setsForPlatform = sets.computeIfAbsent(set.platform(), s -> new ArrayList<>());
setsForPlatform.add(set);
}
}
for (Platform platform : Platforms.values()) sets.computeIfAbsent(platform, s -> new ArrayList<>());
}
Aggregations