Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-krushna authored Oct 16, 2024
1 parent ac586d3 commit 3a06bd5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions library/src/main/java/mt/modder/hub/axml/AXMLPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public final class AXMLPrinter {
};

private boolean isId2Name = false;
private boolean isAttrConversion = false;
public static String saveManifestPrefix = null;


Expand All @@ -85,8 +86,10 @@ public float complexToFloat(int complex) {
// Set check attribute and convert int to its string value
public void setEnableID2Name(boolean isId2name){
isId2Name = isId2name;


}

public void setAttributeIntConversion(boolean isAttrConvert){
isAttrConversion = isAttrConvert;
}

// Main method to decompile an XML byte array
Expand Down Expand Up @@ -218,12 +221,16 @@ private String getAttributeValue(AXmlResourceParser xmlParser, int index) {

case TypedValue.TYPE_INT_HEX /* 17 */:
// Hex integer value or flag values
if (isAttrConversion) {
String decodedValue = AttributesExtractor.getInstance().decode(attributeName, attributeValueData);
if (decodedValue != null && !decodedValue.isEmpty() ) {
return decodedValue; // Return the decoded value if found
} else {
return String.format("0x%08x", attributeValueData);
}
} else{
return String.format("0x%08x", attributeValueData);
}

case TypedValue.TYPE_INT_BOOLEAN /* 18 */:
// Boolean value
Expand All @@ -239,10 +246,12 @@ private String getAttributeValue(AXmlResourceParser xmlParser, int index) {

default:
// Handle enum or flag values and other cases
String decodedValue2 = AttributesExtractor.getInstance().decode(attributeName, attributeValueData);
if (decodedValue2 != null) {
return decodedValue2; // Return the decoded value if found
if (isAttrConversion) {
String decodedValue = AttributesExtractor.getInstance().decode(attributeName, attributeValueData);
if (decodedValue != null) {
return decodedValue; // Return the decoded value if found
}
}
// For unhandled types or cases
return (attributeValueType >= 28 && attributeValueType <= 31) ?
String.format("#%08x", attributeValueData) :
Expand Down

0 comments on commit 3a06bd5

Please sign in to comment.