Files
reverse-engineering-anything/src/il2cpp/Il2cppBinaryFormat.ts
T
JANG BYUNGKUN 52d1a72af0 feat(il2cpp): link native methods and export Ghidra seeds
Link IL2CPP metadata names to native addresses and types through shared CLI/MCP workflows, with bounded queries and atomic Ghidra seed export.

Preserve the original implementation by 8rulerstar and follow-up correctness, resource, provenance, and CI dependency repairs. Verified against real Windows/Android artifacts, independent references, actual Ghidra, and focused CLI/MCP tests.

Fixes #5112.
2026-10-20 21:56:54 +08:00

50 lines
1.4 KiB
TypeScript

export const IL2CPP_BINARY_FAILURE_REASONS = {
unsupported: [
"unsupported-container",
"slice-selection-required",
"slice-not-found",
"ambiguous-slice-selection",
"unsupported-pointer-encoding",
"unsupported-type-kind",
],
capacity: [
"native-index-capacity",
"type-nesting-capacity",
"native-type-text-capacity",
],
malformed: [
"malformed-container",
"code-gen-modules-not-found",
"ambiguous-code-gen-module",
"code-registration-not-found",
"invalid-method-pointer",
"invalid-method-token",
"metadata-registration-not-found",
"invalid-type",
],
} as const;
export type Il2cppBinaryFailureReason =
(typeof IL2CPP_BINARY_FAILURE_REASONS)[keyof typeof IL2CPP_BINARY_FAILURE_REASONS][number];
/** A native image REA cannot link, either outside coverage or inconsistent with the metadata. */
export class Il2cppBinaryFormatFailure extends Error {
readonly kind: "unsupported" | "malformed" | "capacity";
constructor(
readonly reason: Il2cppBinaryFailureReason,
message: string,
) {
super(`${reason}: ${message}`);
this.name = "Il2cppBinaryFormatFailure";
this.kind = (
IL2CPP_BINARY_FAILURE_REASONS.unsupported as readonly string[]
).includes(reason)
? "unsupported"
: (IL2CPP_BINARY_FAILURE_REASONS.capacity as readonly string[]).includes(
reason,
)
? "capacity"
: "malformed";
}
}