Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Invalid compressed integer format #833

Open
dvcan05 opened this issue Nov 30, 2024 · 1 comment
Open

ERROR: Invalid compressed integer format #833

dvcan05 opened this issue Nov 30, 2024 · 1 comment

Comments

@dvcan05
Copy link

dvcan05 commented Nov 30, 2024

  • Il2CppDumper version: Il2CppDumper-net6-win-v6.7.46

  • Target Unity version (optional) not sure

  • Describe the issue: The problem happens when generating dummy dll:

System.Exception: Invalid compressed integer format
at Il2CppDumper.BinaryReaderExtensions.ReadCompressedUInt32(BinaryReader reader) in C:\projects\il2cppdumper\Il2CppDumper\Extensions\BinaryReaderExtensions.cs:line 80
at Il2CppDumper.BinaryReaderExtensions.ReadCompressedInt32(BinaryReader reader) in C:\projects\il2cppdumper\Il2CppDumper\Extensions\BinaryReaderExtensions.cs:line 98
at Il2CppDumper.Il2CppExecutor.GetConstantValueFromBlob(Il2CppTypeEnum type, BinaryReader reader, BlobValue& value) in C:\projects\il2cppdumper\Il2CppDumper\Utils\Il2CppExecutor.cs:line 382
at Il2CppDumper.Il2CppExecutor.TryGetDefaultValue(Int32 typeIndex, Int32 dataIndex, Object& value) in C:\projects\il2cppdumper\Il2CppDumper\Utils\Il2CppExecutor.cs:line 328
at Il2CppDumper.DummyAssemblyGenerator..ctor(Il2CppExecutor il2CppExecutor, Boolean addToken) in C:\projects\il2cppdumper\Il2CppDumper\Utils\DummyAssemblyGenerator.cs:line 191
at Il2CppDumper.DummyAssemblyExporter.Export(Il2CppExecutor il2CppExecutor, String outputDir, Boolean addToken) in C:\projects\il2cppdumper\Il2CppDumper\Outputs\DummyAssemblyExporter.cs:line 14
at Il2CppDumper.Program.Dump(Metadata metadata, Il2Cpp il2Cpp, String outputDir) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 271
at Il2CppDumper.Program.Main(String[] args) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 99

image

@c01ns
Copy link

c01ns commented Dec 17, 2024

Il2CppDumper\Extensions\BinaryReaderExtensions.cs

        public static uint ReadCompressedUInt32(this BinaryReader reader)
        {
            uint val;
            var read = reader.ReadByte();

            if ((read & 0x80) == 0)
            {
                // 1 byte written
                val = read;
            }
            else if ((read & 0xC0) == 0x80)
            {
                // 2 bytes written
                val = (read & ~0x80u) << 8;
                val |= reader.ReadByte();
            }
            else if ((read & 0xE0) == 0xC0)
            {
                // 4 bytes written
                val = (read & ~0xC0u) << 24;
                val |= ((uint)reader.ReadByte() << 16);
                val |= ((uint)reader.ReadByte() << 8);
                val |= reader.ReadByte();
            }
            else if (read == 0xF0)
            {
                // 5 bytes written, we had a really large int32!
                val = reader.ReadUInt32();
            }
            else if (read == 0xFE)
            {
                // Special encoding for Int32.MaxValue
                val = uint.MaxValue - 1;
            }
            else if (read == 0xFF)
            {
                // Yes we treat UInt32.MaxValue (and Int32.MinValue, see ReadCompressedInt32) specially
                val = uint.MaxValue;
            }
            // Add code
            else if (read == 0xE8)
            { 
                val = 0;
            }
            else
            {
                throw new Exception("Invalid compressed integer format");
            }

            return val;
        }

修改这个方法添加0xE8的判断即可

Il2CppDumper-Debug.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants