Refactor IL2CPP section detection logic

Improve IL2CPP detection by introducing an isIl2cpp flag and a regex check for .rtc sections (PE.isSectionNamePresentExp(/^\.rtc\$[IT](?:AA|ZZ)$/)). Collapse and reorder the section-name checks into a smaller array and defer setting the compiler/lang result until after detection completes. This makes the detection flow clearer and handles .rtc variants more reliably.
This commit is contained in:
DosX 2026-05-26 00:47:24 +03:00
commit 25cd07ea3a

View file

@ -5927,28 +5927,34 @@ function scanForLanguagesAndCompilers_NET_and_Native() {
// Detect IL2CPP by sections (thanks to AyukiDev)
if (!isCompilerDetected()) {
const il2cppSections = [
".text$mn",
".rdata$zzzdbg",
".rtc$IAA",
".rtc$IZZ",
".rtc$TAA",
".rtc$TZZ",
"il2cpp"
];
var isIl2cpp = false;
for (var i = 0; i < il2cppSections.length; i++) {
if (PE.isSectionNamePresent(il2cppSections[i])) {
_setResult("~compiler", "IL2CPP Technology", String(), String());
_setLangByHeur("Native MSIL/C#");
break;
if (PE.isSectionNamePresentExp(/^\.rtc\$[IT](?:AA|ZZ)$/)) {
isIl2cpp = true;
} else {
const il2cppSections = [
"il2cpp",
".text$mn",
".rdata$zzzdbg"
];
for (var i = 0; i < il2cppSections.length && !isIl2cpp; i++) {
if (PE.isSectionNamePresent(il2cppSections[i])) {
isIl2cpp = true;
}
}
}
if (isIl2cpp) {
_setResult("~compiler", "IL2CPP Technology", String(), String());
_setLangByHeur("Native MSIL/C#");
}
}
var isCLikeLibsNotFound = !isCLibraryPresent && !isPpLibraryPresent;
var majorLinkerVersion = PE.getMajorLinkerVersion(),