mirror of
https://github.com/revanced/smali.git
synced 2025-05-22 19:08:52 +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;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getBaseOffset() {
|
public int getBaseOffset() {
|
||||||
return baseOffset;
|
return baseOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ public class DexAnnotator extends AnnotatedBytes {
|
|||||||
annotator.annotateSection(this);
|
annotator.annotateSection(this);
|
||||||
}
|
}
|
||||||
} finally {
|
} 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
|
* @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 rightWidth = getAnnotationWidth();
|
||||||
int leftWidth = outputWidth - rightWidth - 1;
|
int leftWidth = outputWidth - rightWidth - 1;
|
||||||
|
|
||||||
@ -315,14 +315,14 @@ public class AnnotatedBytes {
|
|||||||
right = "";
|
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);
|
twoc.write(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastKey = keys[keys.length-1];
|
int lastKey = keys[keys.length-1];
|
||||||
if (lastKey < data.length) {
|
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, "");
|
twoc.write(left, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user