public String getValidRequiredROMName(String config, byte[] trainerClasses,
			byte[] trainerNames, byte[] nicknames)
			throws UnsupportedEncodingException,
			InvalidSupplementFilesException {
		byte[] data = DatatypeConverter.parseBase64Binary(config);

		if (data.length < 44) {
			return null; // too short
		}

		// Check the checksum
		ByteBuffer buf = ByteBuffer.allocate(4).put(data, data.length - 16, 4);
		buf.rewind();
		int crc = buf.getInt();

		CRC32 checksum = new CRC32();
		checksum.update(data, 0, data.length - 16);
		if ((int) checksum.getValue() != crc) {
			return null; // checksum failure
		}

		// Check the trainerclass & trainernames crc
		if (trainerClasses == null
				&& !checkOtherCRC(data, 0, 6, "trainerclasses.txt",
						data.length - 12)) {
			JOptionPane.showMessageDialog(null,
					bundle.getString("RandomizerGUI.presetFailTrainerClasses"));
			throw new InvalidSupplementFilesException();
		}
		if (trainerNames == null
				&& (!checkOtherCRC(data, 0, 5, "trainernames.txt",
						data.length - 8) || !checkOtherCRC(data, 16, 5,
						"trainernames.txt", data.length - 8))) {
			JOptionPane.showMessageDialog(null,
					bundle.getString("RandomizerGUI.presetFailTrainerNames"));
			throw new InvalidSupplementFilesException();
		}
		if (nicknames == null
				&& !checkOtherCRC(data, 16, 4, "nicknames.txt", data.length - 4)) {
			JOptionPane.showMessageDialog(null,
					bundle.getString("RandomizerGUI.presetFailNicknames"));
			throw new InvalidSupplementFilesException();
		}

		int nameLength = data[27] & 0xFF;
		if (data.length != 44 + nameLength) {
			return null; // not valid length
		}
		String name = new String(data, 28, nameLength, "US-ASCII");
		return name;
	}