mirror of https://github.com/rusefi/RomRaider.git
More Editor/Logger refinements
git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@329 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
parent
aee5b352c2
commit
b7e2a4d25c
|
@ -191,6 +191,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private static final String FILE_NAME_EXTENTION = "Text to add to the saved logfile name";
|
||||
private static final String ECU_TEXT = "Engine Control Unit Polling";
|
||||
private static final String TCU_TEXT = "Transmission Control Unit Polling";
|
||||
private static final String[] logFileText = {"1st PT","2nd PT","3rd PT", // PT = Part Throttle
|
||||
"4th PT","5th PT","6th PT",
|
||||
"1st WOT","2nd WOT","3rd WOT",
|
||||
"4th WOT","5th WOT","6th WOT",
|
||||
"cruising"};
|
||||
private static final byte ECU_ID = (byte) 0x10;
|
||||
private static final byte TCU_ID = (byte) 0x18;
|
||||
private static String target = "ECU";
|
||||
|
@ -922,78 +927,32 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
});
|
||||
|
||||
JPopupMenu fileNamePopup = new JPopupMenu();
|
||||
JMenuItem ecuIdItem1 = new JMenuItem("Use Current " + target + " ID");
|
||||
ecuIdItem1.addActionListener(new ActionListener() {
|
||||
JMenuItem ecuIdItem = new JMenuItem("Use Current " + target + " ID");
|
||||
ecuIdItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText(ecuInit.getEcuId());
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem2 = new JMenuItem("1st WOT");
|
||||
ecuIdItem2.addActionListener(new ActionListener() {
|
||||
fileNamePopup.add(ecuIdItem);
|
||||
for (final String item : logFileText) {
|
||||
ecuIdItem = new JMenuItem(item);
|
||||
ecuIdItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("1st_WOT");
|
||||
fileNameExtention.setText(item.replaceAll(" ", "_"));
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem3 = new JMenuItem("2nd WOT");
|
||||
ecuIdItem3.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("2nd_WOT");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
fileNamePopup.add(ecuIdItem);
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem4 = new JMenuItem("3rd WOT");
|
||||
ecuIdItem4.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("3rd_WOT");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem5 = new JMenuItem("4th WOT");
|
||||
ecuIdItem5.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("4th_WOT");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem6 = new JMenuItem("5th WOT");
|
||||
ecuIdItem6.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("5th_WOT");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem7 = new JMenuItem("6th WOT");
|
||||
ecuIdItem7.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("6th_WOT");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem8 = new JMenuItem("cruising");
|
||||
ecuIdItem8.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("cruising");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
JMenuItem ecuIdItem9 = new JMenuItem("Clear Logfile Text");
|
||||
ecuIdItem9.addActionListener(new ActionListener() {
|
||||
ecuIdItem = new JMenuItem("Clear Logfile Text");
|
||||
ecuIdItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
fileNamePopup.add(ecuIdItem1);
|
||||
fileNamePopup.add(ecuIdItem2);
|
||||
fileNamePopup.add(ecuIdItem3);
|
||||
fileNamePopup.add(ecuIdItem4);
|
||||
fileNamePopup.add(ecuIdItem5);
|
||||
fileNamePopup.add(ecuIdItem6);
|
||||
fileNamePopup.add(ecuIdItem7);
|
||||
fileNamePopup.add(ecuIdItem8);
|
||||
fileNamePopup.add(ecuIdItem9);
|
||||
fileNamePopup.add(ecuIdItem);
|
||||
fileNameExtention.addMouseListener(new LogFileNameFieldAction(fileNamePopup));
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.romraider.swing.JProgressPane;
|
|||
import com.romraider.xml.TableNotFoundException;
|
||||
import static com.romraider.maps.RomChecksum.calculateRomChecksum;
|
||||
import static com.romraider.util.HexUtil.asBytes;
|
||||
import static com.romraider.util.HexUtil.asHex;
|
||||
import org.apache.log4j.Logger;
|
||||
import javax.swing.JOptionPane;
|
||||
import java.io.File;
|
||||
|
@ -106,6 +107,7 @@ public class Rom implements Serializable {
|
|||
try {
|
||||
table.populateTable(binData);
|
||||
TableUpdateHandler.getInstance().registerTable(table);
|
||||
if (table.getName().equalsIgnoreCase("Checksum Fix")) setEditStamp(binData, table.getStorageAddress());
|
||||
} catch (ArrayIndexOutOfBoundsException ex) {
|
||||
|
||||
LOGGER.error(table.getName() +
|
||||
|
@ -133,6 +135,23 @@ public class Rom implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private void setEditStamp(byte[] binData, int address) {
|
||||
byte[] stampData = new byte[4];
|
||||
System.arraycopy(binData, address+204, stampData, 0, stampData.length);
|
||||
String stamp = asHex(stampData);
|
||||
if (stamp.equalsIgnoreCase("FFFFFFFF")) {
|
||||
romID.setEditStamp("");
|
||||
}
|
||||
else {
|
||||
StringBuilder niceStamp = new StringBuilder(stamp);
|
||||
niceStamp.insert(6, " v");
|
||||
niceStamp.insert(4, "-");
|
||||
niceStamp.insert(2, "-");
|
||||
niceStamp.insert(0, "20");
|
||||
romID.setEditStamp(niceStamp.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRomID(RomID romID) {
|
||||
this.romID = romID;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public class RomID implements Serializable {
|
|||
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 int fileSize = 0;
|
||||
private int ramOffset = 0;
|
||||
private boolean obsolete = false; // whether a more recent revision exists
|
||||
|
@ -190,4 +191,13 @@ public class RomID implements Serializable {
|
|||
public void setObsolete(boolean obsolete) {
|
||||
this.obsolete = obsolete;
|
||||
}
|
||||
|
||||
public String getEditStamp() {
|
||||
return editStamp;
|
||||
}
|
||||
|
||||
public void setEditStamp(String editStamp) {
|
||||
this.editStamp = editStamp;
|
||||
}
|
||||
|
||||
}
|
|
@ -43,6 +43,7 @@ public class RomPropertyPanel extends javax.swing.JPanel {
|
|||
model.setText(rom.getRomID().getModel());
|
||||
submodel.setText(rom.getRomID().getSubModel());
|
||||
transmission.setText(rom.getRomID().getTransmission());
|
||||
editStamp.setText(rom.getRomID().getEditStamp());
|
||||
|
||||
tableList.setListData(rom.getTables());
|
||||
}
|
||||
|
@ -80,6 +81,12 @@ public class RomPropertyPanel extends javax.swing.JPanel {
|
|||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
tableList = new javax.swing.JList();
|
||||
lblTables = new javax.swing.JLabel();
|
||||
lblEditStamp = new javax.swing.JLabel();
|
||||
editStamp = new javax.swing.JLabel();
|
||||
|
||||
lblEditStamp.setText("Edit Stamp:");
|
||||
|
||||
editStamp.setText("stamp");
|
||||
|
||||
lblFilename.setText("Filename:");
|
||||
|
||||
|
@ -195,11 +202,13 @@ public class RomPropertyPanel extends javax.swing.JPanel {
|
|||
.add(layout.createSequentialGroup()
|
||||
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(lblInternalId)
|
||||
.add(lblStorageAddress))
|
||||
.add(lblStorageAddress)
|
||||
.add(lblEditStamp))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 53, Short.MAX_VALUE)
|
||||
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(internalID)
|
||||
.add(storageAddress))
|
||||
.add(storageAddress)
|
||||
.add(editStamp))
|
||||
.add(36, 36, 36))
|
||||
.add(lblTables)
|
||||
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 226, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
|
||||
|
@ -229,7 +238,9 @@ public class RomPropertyPanel extends javax.swing.JPanel {
|
|||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lblFilesize)
|
||||
.add(fileSize))))
|
||||
.add(fileSize)
|
||||
.add(lblEditStamp)
|
||||
.add(editStamp))))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(lblTables)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
|
@ -291,6 +302,8 @@ public class RomPropertyPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JLabel transmission;
|
||||
private javax.swing.JLabel xmlID;
|
||||
private javax.swing.JLabel year;
|
||||
private javax.swing.JLabel lblEditStamp;
|
||||
private javax.swing.JLabel editStamp;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
Loading…
Reference in New Issue