use of org.javatari.atari.cartridge.CartridgeFormat in project javatari by ppeccin.
the class JComboBoxNim method refreshCartridge.
private void refreshCartridge() {
if (refreshInProgress)
return;
refreshInProgress = true;
if (room.currentConsole().cartridgeSocket().inserted() == null) {
romNameTf.setText("<NO CARTRIDGE INSERTED>");
romFormatLb.setListData(new Object[0]);
romFormatLb.setEnabled(false);
defaultsB.setVisible(false);
} else {
Cartridge cart = room.currentConsole().cartridgeSocket().inserted();
romNameTf.setText(cart.rom().info.name);
romNameTf.setCaretPosition(0);
ArrayList<CartridgeFormat> formats = new ArrayList<CartridgeFormat>();
try {
ArrayList<CartridgeFormatOption> formatOptions;
formatOptions = CartridgeDatabase.getFormatOptions(cart.rom());
for (CartridgeFormatOption option : formatOptions) formats.add(option.format);
} catch (ROMFormatUnsupportedException e) {
// Leave formats empty
}
if (!formats.contains(cart.format()))
formats.add(0, cart.format());
romFormatLb.setListData(formats.toArray());
romFormatLb.setSelectedValue(cart.format(), true);
romFormatLb.setEnabled(!formats.isEmpty() && !room.isClientMode());
defaultsB.setText("Auto Detect");
defaultsB.setVisible(!room.isClientMode());
}
refreshInProgress = false;
}
use of org.javatari.atari.cartridge.CartridgeFormat in project javatari by ppeccin.
the class JComboBoxNim method romFormatLbAction.
private void romFormatLbAction() {
Object sel = romFormatLb.getSelectedValue();
if (sel == null || !(sel instanceof CartridgeFormat))
return;
CartridgeFormat format = (CartridgeFormat) sel;
Console console = room.currentConsole();
Cartridge cart = console.cartridgeSocket().inserted();
if (cart == null || cart.format().equals(format))
return;
Cartridge newCart = format.createCartridge(cart.rom());
console.cartridgeSocket().insert(newCart, true);
}
Aggregations