(method: Il2Cpp.Method)
| 350 | } |
| 351 | |
| 352 | function addMethod(method: Il2Cpp.Method): void { |
| 353 | const module = getIl2CppModule(); |
| 354 | if (module === null) { |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | let start: NativePointer; |
| 359 | try { |
| 360 | start = method.virtualAddress; |
| 361 | } catch (_error) { |
| 362 | return; |
| 363 | } |
| 364 | |
| 365 | if (start.isNull() || !contains(module, start)) { |
| 366 | return; |
| 367 | } |
| 368 | |
| 369 | if (lastEnumeratedStart !== null && lastEnumeratedStart.compare(start) > 0) { |
| 370 | monotonic = false; |
| 371 | if (!orderWarningPrinted) { |
| 372 | console.log("\x1b[33m[il2cpp] method address order is not monotonic; resolver will finish indexing before range matches\x1b[0m"); |
| 373 | orderWarningPrinted = true; |
| 374 | } |
| 375 | } |
| 376 | lastEnumeratedStart = start; |
| 377 | |
| 378 | const id = start.toString(); |
| 379 | const existing = entriesByAddress.get(id); |
| 380 | if (existing !== undefined) { |
| 381 | existing.methods.push(method); |
| 382 | return; |
| 383 | } |
| 384 | |
| 385 | const entry: MethodEntry = { start, methods: [method] }; |
| 386 | entries.push(entry); |
| 387 | entriesByAddress.set(id, entry); |
| 388 | entriesSorted = false; |
| 389 | } |
| 390 | |
| 391 | function sortEntries(): void { |
| 392 | if (entriesSorted) { |
no test coverage detected