Add optional version and author to ecu def

This commit is contained in:
Robin K 2022-04-14 20:30:43 +02:00
parent 574aed6b77
commit d7bdc145f7
7 changed files with 110 additions and 81 deletions

View File

@ -417,11 +417,12 @@ public class ECUEditor extends AbstractFrame {
}
}
if(frame == null) {
TableView v;
Table t = node.getTable();
if (t!=null) {
if(frame == null) {
TableView v;
Table t = node.getTable();
try {
if (t != null) {
if(t instanceof TableSwitch)
v = new TableSwitchView((TableSwitch)t);
else if(t instanceof TableBitwiseSwitch)
@ -438,7 +439,12 @@ public class ECUEditor extends AbstractFrame {
Rom rom = RomTree.getRomNode(node);
frame = new TableFrame(node.getTable().getName() + " | " + rom.getFileName(), v);
}
}
}
catch(Exception e) {
System.err.println("Failed to visually populate table " + t.getName());
e.printStackTrace();
}
}
} catch (IllegalArgumentException ex) {
;// Do nothing.
}
@ -446,9 +452,8 @@ public class ECUEditor extends AbstractFrame {
// frame not added. Draw table and add the frame.
TableView v = frame.getTableView();
if(v!=null) {
if(v != null)
v.drawTable();
}
rightPanel.add(frame);
rightPanel.repaint();

View File

@ -31,26 +31,29 @@ import org.apache.log4j.Logger;
public class RomID implements Serializable {
private static final Logger LOGGER = Logger.getLogger(RomID.class);
private static final long serialVersionUID = 7272741253665400643L;
private String xmlid; //ID stored in XML
private int internalIdAddress; //address of ECU version in image
private String internalIdString; //ID stored in image
private String caseId; //ECU hardware version
private String ecuId;
private String make; //manufacturer
private String version; //Version e.g. V0.45
private String author; //Author name
private String xmlid; //ID stored in XML
private int internalIdAddress; //address of ECU version in image
private String internalIdString = ""; //ID stored in image
private String caseId; //ECU hardware version
private String ecuId = "";
private String make; //manufacturer
private String market;
private String model;
private String subModel; //trim, ie WRX
private String subModel; //trim, ie WRX
private String transmission;
private String year = "Unknown";
private String flashMethod; //flash method string used for ecuflash
private String memModel; //model used for reflashing with ecuflash
private String editStamp; //YYYY-MM-DD and v, the save count for this ROM
private String year;
private String flashMethod; //flash method string used for ecuflash
private String memModel; //model used for reflashing with ecuflash
private String editStamp; //YYYY-MM-DD and v, the save count for this ROM
private int fileSize;
private int ramOffset;
private boolean noRamOffset;
private boolean obsolete; // whether a more recent revision exists
private String checksum; // checksum method used to validate ROM contents
private boolean obsolete; // whether a more recent revision exists
private String checksum; // checksum method used to validate ROM contents
public boolean checkMatch(byte[] file) {
try {
@ -95,6 +98,7 @@ public class RomID implements Serializable {
public String toString() {
return String.format(
"%n ---- RomID %s ----" +
"%n Version: %s" +
"%n Internal ID Address: %s" +
"%n Internal ID String: %s" +
"%n Case ID: %s" +
@ -109,6 +113,7 @@ public class RomID implements Serializable {
"%n Memory Model: %s" +
"%n ---- End RomID %s ----",
xmlid,
version,
internalIdAddress,
internalIdString,
caseId,
@ -124,11 +129,6 @@ public class RomID implements Serializable {
xmlid);
}
public RomID() {
this.internalIdString = "";
this.caseId = "";
}
public String getXmlid() {
return xmlid;
}
@ -284,4 +284,20 @@ public class RomID implements Serializable {
public String getChecksum() {
return checksum;
}
public void setVersion(String version) {
this.version = version;
}
public String getVersion() {
return version;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}

View File

@ -1,6 +1,6 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2020 RomRaider.com
* Copyright (C) 2006-2022 RomRaider.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,6 +35,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import com.romraider.maps.Rom;
import com.romraider.maps.RomID;
import com.romraider.maps.Table;
public class RomCellRenderer implements TreeCellRenderer {
@ -87,13 +88,49 @@ public class RomCellRenderer implements TreeCellRenderer {
fileName.setText("+ " + rom.getFileName());
}
String carInfoText = "<html>";
RomID id = rom.getRomID();
if(id.getVersion() != null)
carInfoText+= "<B><font color=blue>" + id.getVersion() + " </font></B>";
if(rom.getRomIDString() != null)
carInfoText+=rom.getRomIDString() + ", ";
if(id.getCaseId() != null)
carInfoText+=id.getCaseId() + "; ";
if(id.getYear() != null)
carInfoText+=id.getYear() + " ";
if(id.getMake() != null)
carInfoText+=id.getMake() + " ";
if(id.getModel() != null)
carInfoText+=id.getModel() + " ";
if(id.getSubModel() != null)
carInfoText+=id.getSubModel();
if(id.getTransmission() != null)
carInfoText+=", " + id.getTransmission();
if(carInfoText.endsWith(", ") || carInfoText.endsWith("; "))
carInfoText = carInfoText.substring(0, carInfoText.length() - 2);
if(id.getAuthor() != null)
carInfoText+=" by " + id.getAuthor();
carInfoText+= "</html>";
/*
String carInfoText = rom.getRomIDString() + ", " +
rom.getRomID().getCaseId() + "; " +
rom.getRomID().getYear() + " " +
rom.getRomID().getMake() + " " +
rom.getRomID().getModel() + " " +
rom.getRomID().getSubModel() + ", " +
rom.getRomID().getTransmission();
rom.getRomID().getTransmission();*/
//TODO: Bit of a hack to not show the string when most fields arent set
carInfoText = carInfoText.replace("null, ; Unknown null null null, null", "");

View File

@ -1,6 +1,6 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2020 RomRaider.com
* Copyright (C) 2006-2022 RomRaider.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -53,7 +53,7 @@ public class RomPropertyPanel extends javax.swing.JPanel {
make.setText(rom.getRomID().getMake());
market.setText(rom.getRomID().getMarket());
year.setText(rom.getRomID().getYear() + "");
year.setText(rom.getRomID().getYear());
model.setText(rom.getRomID().getModel());
submodel.setText(rom.getRomID().getSubModel());
transmission.setText(rom.getRomID().getTransmission());
@ -98,61 +98,20 @@ public class RomPropertyPanel extends javax.swing.JPanel {
checksum = new javax.swing.JLabel();
lblChecksum.setText(rb.getString("LBLCHKSUM"));
checksum.setText("subaru");
lblEditStamp.setText(rb.getString("LBLEDIT"));
editStamp.setText("stamp");
lblEditStamp.setText(rb.getString("LBLEDIT"));
lblFilename.setText(rb.getString("LBLFN"));
fileName.setText("Filename");
lblECURevision.setText(rb.getString("LBLECU"));
xmlID.setText("XMLID");
lblFilesize.setText(rb.getString("LBLFS"));
fileSize.setText("999kb");
lblEcuVersion.setText(rb.getString("LBLVER"));
ecuVersion.setText("ECUVER");
lblInternalId.setText(rb.getString("LBLID"));
internalID.setText("INTERNAL");
lblStorageAddress.setText(rb.getString("LBLADDR"));
storageAddress.setText("0x00");
lblMake.setText(rb.getString("LBLMAKE"));
lblMarket.setText(rb.getString("LBLMRKT"));
lblTransmission.setText(rb.getString("LBLTRANS"));
lblModel.setText(rb.getString("LBLMDL"));
lblSubmodel.setText(rb.getString("LBLSMDL"));
lblYear.setText(rb.getString("LBLYR"));
make.setText("Make");
market.setText("Market");
year.setText("Year");
model.setText("Model");
submodel.setText("Submodel");
transmission.setText("Transmission");
tableList.setModel(new javax.swing.AbstractListModel() {
/**
*

View File

@ -51,7 +51,6 @@ import com.romraider.editor.ecu.OpenImageWorker;
import com.romraider.util.ByteUtil;
import com.romraider.util.ResourceUtil;
import com.romraider.util.SettingsManager;
import com.romraider.xml.ConversionLayer.ConversionLayer;;
public class BMWCodingConversionLayer extends ConversionLayer {
protected static final ResourceBundle rb = new ResourceUtil().getBundle(BMWCodingConversionLayer.class.getName());

View File

@ -426,9 +426,21 @@ public class XDFConversionLayer extends ConversionLayer {
n.getAttributes().getNamedItem("name").getNodeValue());
} else if (n.getNodeName().equalsIgnoreCase("flags")) {
// TODO
}
else if (n.getNodeName().equalsIgnoreCase("author")) {
String author = n.getTextContent();
Node ecuID = doc.createElement("author");
ecuID.setTextContent(author);
romIDNode.appendChild(ecuID);
}
else if (n.getNodeName().equalsIgnoreCase("fileversion")) {
String version = n.getTextContent();
Node ecuID = doc.createElement("version");
ecuID.setTextContent(version);
romIDNode.appendChild(ecuID);
} else if (n.getNodeName().equalsIgnoreCase("deftitle")) {
String title = n.getTextContent();
Node ecuID = doc.createElement("ecuid");
Node ecuID = doc.createElement("xmlid");
ecuID.setTextContent(title);
romIDNode.appendChild(ecuID);
} else if (n.getNodeName().equalsIgnoreCase("description")) {

View File

@ -1,6 +1,6 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2021 RomRaider.com
* Copyright (C) 2006-2022 RomRaider.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -223,10 +223,12 @@ public final class DOMRomUnmarshaller {
} else if (nodeName.equalsIgnoreCase("internalidstring")) {
romID.setInternalIdString(unmarshallText(n));
if (romID.getInternalIdString() == null) {
romID.setInternalIdString("");
}
} else if (nodeName.equalsIgnoreCase("author")) {
romID.setAuthor(unmarshallText(n));
} else if (nodeName.equalsIgnoreCase("version")) {
romID.setVersion(unmarshallText(n));
} else if (nodeName.equalsIgnoreCase("caseid")) {
romID.setCaseId(unmarshallText(n));
@ -265,8 +267,7 @@ public final class DOMRomUnmarshaller {
romID.setMemModel(unmarshallText(n));
tableScaleHandler.setMemModelEndian(unmarshallAttribute(n, "endian", null));
} else if (nodeName.equalsIgnoreCase("filesize")) {
} else if (nodeName.equalsIgnoreCase("filesize")) {
romID.setFileSize(RomAttributeParser
.parseFileSize(unmarshallText(n)));