Show addesses in binary data view

This commit is contained in:
Honfika
2013-12-28 15:34:17 +01:00
parent 45e6e9a096
commit ddf5f2eb6a
2 changed files with 10 additions and 4 deletions
+9 -3
View File
@@ -570,10 +570,10 @@ public class Helper {
public static GraphTextWriter byteArrayToHexWithHeader(GraphTextWriter writer, byte[] data) {
writer.appendNoHilight("#hexdata").newLine().newLine();
return byteArrayToHex(writer, data, 8, 8, false);
return byteArrayToHex(writer, data, 8, 8, false, false);
}
public static GraphTextWriter byteArrayToHex(GraphTextWriter writer, byte[] data, int bytesPerRow, int groupSize, boolean addChars) {
public static GraphTextWriter byteArrayToHex(GraphTextWriter writer, byte[] data, int bytesPerRow, int groupSize, boolean addChars, boolean showAddress) {
/* // hex data from decompiled actions
Scanner scanner = new Scanner(srcWithHex);
@@ -591,11 +591,16 @@ public class Helper {
rowCount++;
}
long address = 0;
for (int row = 0; row < rowCount; row++) {
if (row > 0) {
writer.newLine();
}
if (showAddress) {
writer.appendNoHilight("0x" + String.format("%08x ", address));
}
for (int i = 0; i < bytesPerRow; i++) {
int idx = row * bytesPerRow + i;
if (data.length > idx) {
@@ -611,6 +616,7 @@ public class Helper {
writer.appendNoHilight(" ");
}
}
address += bytesPerRow;
}
if (addChars) {
@@ -638,7 +644,7 @@ public class Helper {
public static String byteArrayToHex(byte[] data, int bytesPerRow) {
HilightedTextWriter writer = new HilightedTextWriter(false);
byteArrayToHex(writer, data, bytesPerRow, 8, true);
byteArrayToHex(writer, data, bytesPerRow, 8, true, true);
return writer.toString();
}