mirror of
https://github.com/revanced/smali.git
synced 2025-05-23 18:16:23 +02:00
Annotate the map section
This commit is contained in:
parent
90f8ea9f1e
commit
6fb7190811
@ -32,6 +32,7 @@
|
||||
package org.jf.dexlib2.dexbacked.raw;
|
||||
|
||||
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||
import org.jf.dexlib2.util.AnnotatedBytes;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -66,4 +67,35 @@ public class MapItem {
|
||||
public int getOffset() {
|
||||
return dexFile.readSmallUint(offset + OFFSET_OFFSET);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static SectionAnnotator getAnnotator() {
|
||||
return new SectionAnnotator() {
|
||||
@Nonnull @Override public String getItemName() {
|
||||
return "map_item";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void annotateItem(@Nonnull AnnotatedBytes out, @Nonnull DexBackedDexFile dexFile, int itemIndex) {
|
||||
int itemType = dexFile.readUshort(out.getCursor());
|
||||
out.annotate(2, "type = 0x%x: %s", itemType, ItemType.getItemTypeName(itemType));
|
||||
|
||||
out.annotate(2, "unused");
|
||||
|
||||
int size = dexFile.readSmallUint(out.getCursor());
|
||||
out.annotate(4, "size = %d", size);
|
||||
|
||||
int offset = dexFile.readSmallUint(out.getCursor());
|
||||
out.annotate(4, "offset = 0x%x", offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void annotateSection(@Nonnull AnnotatedBytes out, @Nonnull DexBackedDexFile dexFile, int itemCount) {
|
||||
int mapItemCount = dexFile.readSmallUint(out.getCursor());
|
||||
out.annotate(4, "size = %d", mapItemCount);
|
||||
|
||||
super.annotateSection(out, dexFile, mapItemCount);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,8 @@ public class RawDexFile {
|
||||
static {
|
||||
annotators = ImmutableMap.of(
|
||||
ItemType.TYPE_LIST, TypeListItem.getAnnotator(),
|
||||
ItemType.ANNOTATION_SET_REF_LIST, AnnotationSetRefList.getAnnotator());
|
||||
ItemType.ANNOTATION_SET_REF_LIST, AnnotationSetRefList.getAnnotator(),
|
||||
ItemType.MAP_LIST, MapItem.getAnnotator());
|
||||
}
|
||||
|
||||
public void dumpTo(Writer out, int width) throws IOException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user