MCPcopy Create free account
hub / github.com/axhlzy/Il2CppHookScripts / choose

Method choose

Il2cppHook/_Ufunc.js:11539–11570  ·  view source on GitHub ↗

Returns the heap allocated objects of the specified class. This variant reads GC descriptors.

(klass)

Source from the content-addressed store, hash-verified

11537 }
11538 /** Returns the heap allocated objects of the specified class. This variant reads GC descriptors. */
11539 static choose(klass) {
11540 const matches = [];
11541 const callback = (objects, size, _) => {
11542 for (let i = 0; i < size; i++) {
11543 matches.push(new Il2Cpp.Object(objects.add(i * Process.pointerSize).readPointer()));
11544 }
11545 };
11546 const chooseCallback = new NativeCallback(callback, "void", ["pointer", "int", "pointer"]);
11547 if (versioning_1.default.gte(Il2Cpp.unityVersion, "2021.2.0")) {
11548 const realloc = (handle, size) => {
11549 if (!handle.isNull() && size.compare(0) == 0) {
11550 Il2Cpp.free(handle);
11551 return NULL;
11552 }
11553 else {
11554 return Il2Cpp.alloc(size);
11555 }
11556 };
11557 const reallocCallback = new NativeCallback(realloc, "pointer", ["pointer", "size_t", "pointer"]);
11558 const state = Il2Cpp.Api._livenessAllocateStruct(klass.handle, 0, chooseCallback, NULL, reallocCallback);
11559 Il2Cpp.Api._livenessCalculationFromStatics(state);
11560 Il2Cpp.Api._livenessFinalize(state);
11561 Il2Cpp.Api._livenessFreeStruct(state);
11562 }
11563 else {
11564 const onWorld = new NativeCallback(() => { }, "void", []);
11565 const state = Il2Cpp.Api._livenessCalculationBegin(klass.handle, 0, chooseCallback, NULL, onWorld, onWorld);
11566 Il2Cpp.Api._livenessCalculationFromStatics(state);
11567 Il2Cpp.Api._livenessCalculationEnd(state);
11568 }
11569 return matches;
11570 }
11571 /** Forces a garbage collection of the specified generation. */
11572 static collect(generation) {
11573 Il2Cpp.Api._gcCollect(generation < 0 ? 0 : generation > 2 ? 2 : generation);

Callers 2

findJavaClassFunction · 0.80
findJavaClassFunction · 0.80

Tested by

no test coverage detected