mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-05-08 09:44:26 +02:00
decode unknown resource id as hex
This commit is contained in:
parent
a7b3a466d0
commit
0e161a4321
@ -479,9 +479,12 @@ public class ResXmlPullParser implements XmlResourceParser {
|
|||||||
if(attribute==null){
|
if(attribute==null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String name = mDecoder.decodeResourceName(attribute.getNameResourceID());
|
String name;
|
||||||
if(name == null){
|
int resourceId = attribute.getNameResourceID();
|
||||||
|
if(resourceId == 0 || mDecoder==null){
|
||||||
name = attribute.getName();
|
name = attribute.getName();
|
||||||
|
}else {
|
||||||
|
name = mDecoder.decodeResourceName(attribute.getNameResourceID(), true);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -39,12 +39,24 @@ public class Decoder {
|
|||||||
this.currentPackageId = currentPackageId;
|
this.currentPackageId = currentPackageId;
|
||||||
}
|
}
|
||||||
public String decodeResourceName(int resourceId){
|
public String decodeResourceName(int resourceId){
|
||||||
|
return decodeResourceName(resourceId, true);
|
||||||
|
}
|
||||||
|
public String decodeResourceName(int resourceId, boolean defaultHex){
|
||||||
|
if(resourceId == 0){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
EntryGroup entryGroup = getEntryStore().getEntryGroup(resourceId);
|
EntryGroup entryGroup = getEntryStore().getEntryGroup(resourceId);
|
||||||
if(entryGroup!=null){
|
if(entryGroup!=null){
|
||||||
return entryGroup.getSpecName();
|
return entryGroup.getSpecName();
|
||||||
}
|
}
|
||||||
|
if(defaultHex){
|
||||||
|
return hexResourceName(resourceId);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
private String hexResourceName(int resourceId){
|
||||||
|
return String.format("@0x%08x", resourceId);
|
||||||
|
}
|
||||||
public String decodeValue(Value value){
|
public String decodeValue(Value value){
|
||||||
if(value==null){
|
if(value==null){
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user