use of com.github.jakz.romlib.data.game.Rom in project rom-manager by Jakz.
the class DigestVerifier method setup.
@Override
public void setup(GameSet romset) {
HashCache<Rom> cache = romset.hashCache();
VerifierOptions options = new VerifierOptions(true, false, false, true);
DigestOptions doptions = new DigestOptions(options, true);
Digester digester = new Digester(doptions);
verifier = new Verifier<>(options, digester, cache);
}
use of com.github.jakz.romlib.data.game.Rom in project rom-manager by Jakz.
the class ClonesDialog method autoChoose.
public void autoChoose(ClonePolicy policy, ClonePriority priority) {
if (policy == ClonePolicy.AUTO_SELECT_ALL)
this.keep = this.clones.stream().collect(Collectors.toMap(c -> c, c -> false));
List<List<ScanResult>> results = new ArrayList<>();
LinkedList<ScanResult> current = null;
/* create a list for each rom with clones */
boolean alreadySet = false;
for (ScanResult result : this.clones) {
if (current == null || !current.peekLast().rom.equals(result.rom)) {
if (current != null && !alreadySet)
results.add(current);
alreadySet = false;
current = new LinkedList<>();
}
current.add(result);
alreadySet |= keep.get(result);
}
if (current != null && !alreadySet)
results.add(current);
for (List<ScanResult> list : results) {
ScanResult result = chooseBestClone(list, policy, priority);
keep.put(result, true);
}
model.fireChanges();
updateStatus();
}
use of com.github.jakz.romlib.data.game.Rom 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);
}
use of com.github.jakz.romlib.data.game.Rom in project rom-manager by Jakz.
the class Scanner method foundRom.
private void foundRom(ScanResult result) {
if (result == null)
return;
Rom rom = result.rom;
Game game = rom.game();
logger.i(LogTarget.rom(result.rom), "Found a match for " + result.handle);
if (rom.isPresent() && !rom.handle().equals(result.handle)) {
clones.add(result);
logger.w(LogTarget.file(result.handle.path().getFileName()), "File contains a rom already present in romset: " + rom.handle());
return;
}
result.assign();
game.updateStatus();
}
use of com.github.jakz.romlib.data.game.Rom in project rom-manager by Jakz.
the class RomTable method prepareRenderer.
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component component = super.prepareRenderer(renderer, row, column);
Rom rom = game.rom(row);
// TODO: GameStatus.UNORGANZIED management for rom?
component.setForeground(rom.isPresent() ? GameStatus.FOUND.color : GameStatus.MISSING.color);
return component;
}
Aggregations