From 3a06bd5c38df10530372e61aa2f9b02cf4f17d2a Mon Sep 17 00:00:00 2001 From: Krushna Chandra <76234660+developer-krushna@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:23:21 +0530 Subject: [PATCH] Add files via upload --- .../java/mt/modder/hub/axml/AXMLPrinter.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/mt/modder/hub/axml/AXMLPrinter.java b/library/src/main/java/mt/modder/hub/axml/AXMLPrinter.java index 1d1a944..2d230b7 100644 --- a/library/src/main/java/mt/modder/hub/axml/AXMLPrinter.java +++ b/library/src/main/java/mt/modder/hub/axml/AXMLPrinter.java @@ -73,6 +73,7 @@ public final class AXMLPrinter { }; private boolean isId2Name = false; + private boolean isAttrConversion = false; public static String saveManifestPrefix = null; @@ -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 @@ -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 @@ -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) :