From 4f4ff767e8da2a62578cfbe7ea16e44f8d05e8fd Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 4 Dec 2026 02:49:33 +0800 Subject: [PATCH] refactor(il2cpp): pair member table widths with their sections (#16432) --- src/il2cpp/Il2cppMetadataMembers.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/il2cpp/Il2cppMetadataMembers.ts b/src/il2cpp/Il2cppMetadataMembers.ts index ba5ccb7e271..6453ef89a1a 100644 --- a/src/il2cpp/Il2cppMetadataMembers.ts +++ b/src/il2cpp/Il2cppMetadataMembers.ts @@ -38,24 +38,17 @@ export const readIl2cppMemberTables = ({ parameters: 8 + typeIndexWidth, stringLiterals: indexing === "counted" ? 4 : 8, }; - const literalRecords = checkedSectionCount( - section("stringLiterals"), - recordBytes.stringLiterals, - ); + const recordCount = (name: keyof typeof recordBytes) => + checkedSectionCount(section(name), recordBytes[name]); + const literalRecords = recordCount("stringLiterals"); return { recordBytes, literalRecords, counts: { - fields: checkedSectionCount(section("fields"), recordBytes.fields), - properties: checkedSectionCount( - section("properties"), - recordBytes.properties, - ), - events: checkedSectionCount(section("events"), recordBytes.events), - parameters: checkedSectionCount( - section("parameters"), - recordBytes.parameters, - ), + fields: recordCount("fields"), + properties: recordCount("properties"), + events: recordCount("events"), + parameters: recordCount("parameters"), string_literals: indexing === "counted" ? Math.max(literalRecords - 1, 0)