Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a Checksum recalculation option when saving ROM images that hav…

…e a bad Checksum

(re: Diesel ROMs seem to have an invalid fifth Checksum)

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@361 38686702-15cf-42e4-a595-3071df8bf5ea
  • Loading branch information...
commit 1b6bf5f02fb462f275aebd91e0c0a6d7da322459 1 parent 455fa71
@dschultzca dschultzca authored
View
4 release_notes.txt
@@ -82,11 +82,13 @@ This is the first beta release of the upcoming official 0.5.4b release.
- Added a Logger startup Progress Bar as loading plugins sometimes takes time.
- Added colour to "Log to File" button. Red when recording and green when not.
- Added colour to "Un-select ALL" button. Yellow so it stands out.
- * Button colours may not appear complete as this is platform dependent to implement.
+ * Button colours may not appear correctly as this is platform dependent.
- Changed "Log to File" keyboard shortcut from F1 to Spacebar.
--- Editor ---
- Set JInternalFrame.isPalette in TableFarme.java so table titles are visible on
Mac OS.
+- Added a Checksum recalculation option when saving ROM images that have a bad Checksum
+ (re: Diesel ROMs seem to have an invalid fifth Checksum)
0.5.3b RC10 (09/12/2011)
View
36 src/com/romraider/maps/Rom.java
@@ -19,15 +19,13 @@
package com.romraider.maps;
-import com.romraider.editor.ecu.ECUEditor;
-import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler;
-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 static javax.swing.JOptionPane.DEFAULT_OPTION;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.showOptionDialog;
+
import java.io.File;
import java.io.Serializable;
import java.text.SimpleDateFormat;
@@ -36,6 +34,15 @@
import java.util.List;
import java.util.Vector;
+import javax.swing.JOptionPane;
+
+import org.apache.log4j.Logger;
+
+import com.romraider.editor.ecu.ECUEditor;
+import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler;
+import com.romraider.swing.JProgressPane;
+import com.romraider.xml.TableNotFoundException;
+
public class Rom implements Serializable {
private static final long serialVersionUID = 7865405179738828128L;
private static final Logger LOGGER = Logger.getLogger(Rom.class);
@@ -212,6 +219,23 @@ public void setContainer(ECUEditor container) {
if (checksum != null && !checksum.isLocked()) {
calculateRomChecksum(binData, checksum.getStorageAddress(), checksum.getDataSize());
}
+ else if (checksum != null && checksum.isLocked() && !checksum.isButtonSelected()) {
+ Object[] options = {"Yes", "No"};
+ String message = String.format("One or more ROM image Checksums is invalid. " +
+ "Calculate new Checksums?%n" +
+ "(NOTE: this will only fix the Checksums it will NOT repair a corrupt ROM image)");
+ int answer = showOptionDialog(container,
+ message,
+ "Checksum Fix",
+ DEFAULT_OPTION,
+ QUESTION_MESSAGE,
+ null,
+ options,
+ options[0]);
+ if (answer == 0) {
+ calculateRomChecksum(binData, checksum.getStorageAddress(), checksum.getDataSize());
+ }
+ }
if (checksum != null) {
byte count = binData[checksum.getStorageAddress() + 207];
if (count == -1) {
View
2  src/com/romraider/maps/RomChecksum.java
@@ -55,7 +55,7 @@ public static int validateRomChecksum(byte[] input, int storageAddress, int data
}
for (j = 0; j < (dataSize / 12); j++) {
if (results[j] != 0) {
- return result = 1; // 1, a checksum is invalid
+ return j + 1; // position of invalid checksum
}
}
return result; // 0, all checksums are valid
View
2  src/com/romraider/maps/Table.java
@@ -1239,6 +1239,8 @@ public double getLiveValue() {
public abstract boolean isLiveDataSupported();
+ public abstract boolean isButtonSelected();
+
protected void highlightLiveData() {
}
View
4 src/com/romraider/maps/Table1D.java
@@ -181,4 +181,8 @@ public void setLiveValue(String value) {
public boolean isLiveDataSupported() {
return false;
}
+
+ public boolean isButtonSelected() {
+ return true;
+ }
}
View
6 src/com/romraider/maps/Table2D.java
@@ -305,7 +305,11 @@ public boolean isLiveDataSupported() {
return !isNullOrEmpty(axis.getLogParam());
}
- protected void highlightLiveData() {
+ public boolean isButtonSelected() {
+ return true;
+ }
+
+ protected void highlightLiveData() {
if (overlayLog && frame.isVisible()) {
AxisRange range = getLiveDataRangeForAxis(axis);
clearSelection();
View
6 src/com/romraider/maps/Table3D.java
@@ -916,7 +916,11 @@ public boolean isLiveDataSupported() {
return !isNullOrEmpty(xAxis.getLogParam()) && !isNullOrEmpty(yAxis.getLogParam());
}
- protected void highlightLiveData() {
+ public boolean isButtonSelected() {
+ return true;
+ }
+
+ protected void highlightLiveData() {
if (overlayLog && frame.isVisible()) {
AxisRange rangeX = getLiveDataRangeForAxis(xAxis);
AxisRange rangeY = getLiveDataRangeForAxis(yAxis);
View
29 src/com/romraider/maps/TableSwitch.java
@@ -19,7 +19,11 @@
package com.romraider.maps;
+import static com.romraider.maps.RomChecksum.validateRomChecksum;
+import static com.romraider.util.ByteUtil.indexOfBytes;
+import static com.romraider.util.HexUtil.asBytes;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
@@ -40,9 +44,6 @@
import javax.swing.JTextArea;
import com.romraider.Settings;
-import static com.romraider.util.ByteUtil.indexOfBytes;
-import static com.romraider.util.HexUtil.asBytes;
-import static com.romraider.maps.RomChecksum.validateRomChecksum;
public class TableSwitch extends Table {
@@ -79,17 +80,20 @@ public void populateTable(byte[] input) {
add(radioPanel, BorderLayout.CENTER);
// Validate the ROM image checksums.
- // if the result is 1: any checksum failed
+ // if the result is >0: position of failed checksum
// if the result is 0: all the checksums matched
// if the result is -1: all the checksums have been previously disabled
if (super.getName().equalsIgnoreCase("Checksum Fix")) {
int result = validateRomChecksum(input, storageAddress, dataSize);
- String message = String.format("One or more Checksums is invalid.%nThe ROM image may be corrupt.%nUse of this ROM image is not advised!");
- if (result == 1) {
+ String message = String.format(
+ "Checksum No. %d is invalid.%n" +
+ "The ROM image may be corrupt.%n" +
+ "Use of this ROM image is not advised!", result);
+ if (result > 0) {
showMessageDialog(this,
message,
"ERROR - Checksums Failed",
- ERROR_MESSAGE);
+ WARNING_MESSAGE);
setButtonsUnselected(buttonGroup);
}
else if (result == -1){
@@ -97,7 +101,7 @@ else if (result == -1){
showMessageDialog(this,
message,
"Warning - Checksum Status",
- WARNING_MESSAGE);
+ INFORMATION_MESSAGE);
getButtonByText(buttonGroup, "on").setSelected(true); }
else {
getButtonByText(buttonGroup, "off").setSelected(true);
@@ -224,6 +228,15 @@ public boolean isLiveDataSupported() {
return false;
}
+ public boolean isButtonSelected() {
+ if (buttonGroup.getSelection() == null) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
// returns the selected radio button in the specified group
private static JRadioButton getSelectedButton(ButtonGroup group) {
for (Enumeration<AbstractButton> e = group.getElements(); e.hasMoreElements(); ) {
View
2  version.properties
@@ -23,7 +23,7 @@ version.minor=5
version.patch=4
version.buildnumber=${buildnumber}
version.extra=Beta
-version.extra1=pre-RC1
+version.extra1=RC1
# the starting class for the application
class.start=com.romraider.ECUExec
Please sign in to comment.
Something went wrong with that request. Please try again.