Schedules a callback on the Il2Cpp initializer thread.
(block)
| 10650 | } |
| 10651 | /** Schedules a callback on the Il2Cpp initializer thread. */ |
| 10652 | static scheduleOnInitializerThread(block) { |
| 10653 | return new Promise(resolve => { |
| 10654 | const listener = Interceptor.attach(Il2Cpp.Api._threadCurrent, () => { |
| 10655 | const currentThreadId = Il2Cpp.currentThread?.id; |
| 10656 | if (currentThreadId != undefined && currentThreadId == Il2Cpp.attachedThreads[0].id) { |
| 10657 | listener.detach(); |
| 10658 | const result = block(); |
| 10659 | setImmediate(() => resolve(result)); |
| 10660 | } |
| 10661 | }); |
| 10662 | }); |
| 10663 | } |
| 10664 | /** Attaches the caller thread to Il2Cpp domain and executes the given block. */ |
| 10665 | static async perform(block) { |
| 10666 | await this.initialize(); |