mirror of
https://github.com/revanced/smali.git
synced 2025-05-22 08:37:05 +02:00
Add support for dumping dex files that begin at some offset within a file
This commit is contained in:
parent
783943ebff
commit
52087a0c7c
@ -150,7 +150,7 @@ public class DexBuffer {
|
||||
return buf;
|
||||
}
|
||||
|
||||
protected int getBaseOffset() {
|
||||
public int getBaseOffset() {
|
||||
return baseOffset;
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class DexAnnotator extends AnnotatedBytes {
|
||||
annotator.annotateSection(this);
|
||||
}
|
||||
} finally {
|
||||
writeAnnotations(out, dexFile.getBuffer().getBuf());
|
||||
writeAnnotations(out, dexFile.getBuffer().getBuf(), dexFile.getBuffer().getBaseOffset());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ public class AnnotatedBytes {
|
||||
*
|
||||
* @param out non-null; where to write to
|
||||
*/
|
||||
public void writeAnnotations(Writer out, byte[] data) throws IOException {
|
||||
public void writeAnnotations(Writer out, byte[] data, int offset) throws IOException {
|
||||
int rightWidth = getAnnotationWidth();
|
||||
int leftWidth = outputWidth - rightWidth - 1;
|
||||
|
||||
@ -315,14 +315,14 @@ public class AnnotatedBytes {
|
||||
right = "";
|
||||
}
|
||||
|
||||
String left = Hex.dump(data, rangeStart, rangeEnd - rangeStart, rangeStart, hexCols, 6);
|
||||
String left = Hex.dump(data, rangeStart + offset, rangeEnd - rangeStart, rangeStart + offset, hexCols, 6);
|
||||
|
||||
twoc.write(left, right);
|
||||
}
|
||||
|
||||
int lastKey = keys[keys.length-1];
|
||||
if (lastKey < data.length) {
|
||||
String left = Hex.dump(data, lastKey, data.length - lastKey, lastKey, hexCols, 6);
|
||||
String left = Hex.dump(data, lastKey + offset, (data.length - offset) - lastKey, lastKey + offset, hexCols, 6);
|
||||
twoc.write(left, "");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user