From e55a825f7d4d99996771b87c8f03f9617865d2bb Mon Sep 17 00:00:00 2001 From: ThePedroo Date: Tue, 12 Nov 2024 17:29:33 -0300 Subject: [PATCH] fix: 64-bit/32-bit-only device detection This commit fixes the detection made by ReZygisk WebUI that makes it be aware of whether the device's CPU is capable of 64-bit or 32-bit only, allowing it to properly mark as Fully functioning or just partially. --- webroot/js/main.js | 77 ++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/webroot/js/main.js b/webroot/js/main.js index 0e555d3..de1b56f 100644 --- a/webroot/js/main.js +++ b/webroot/js/main.js @@ -61,17 +61,35 @@ export function setErrorData(errorLog) { let zygote64_status = EXPECTED let zygote32_status = EXPECTED + const lscpuCmd = await exec('/system/bin/getprop ro.product.cpu.abilist') + if (lscpuCmd.errno !== 0) return setError('WebUI', lscpuCmd.stderr) + + const has64BitSupport = lscpuCmd.stdout.includes('arm64-v8a') || lscpuCmd.stdout.includes('x86_64') + const has32BitSupport = lscpuCmd.stdout.includes('armeabi-v7a') || lscpuCmd.stdout.includes('armeabi') || lscpuCmd.stdout.includes('x86') + + if (!has64BitSupport) { + zygote64_div.style.display = 'none' + daemon64_div.style.display = 'none' + } + + if (!has32BitSupport) { + zygote32_div.style.display = 'none' + daemon32_div.style.display = 'none' + } + const catCmd = await exec('/system/bin/cat /data/adb/rezygisk/status') if (catCmd.errno === 0) { const [ Version, Tracing, Daemon64, Zygote64 ] = catCmd.stdout.split('\n') + let hasOffset = false /* TODO: Show the tracing state */ /* TODO: Show if daemon is running */ code_version.innerHTML = Version.split(': ')[1] - if (Daemon64 && Daemon64.startsWith('Daemon64:')) { - /* INFO: Daemon64 is supported */ + if (has64BitSupport && Daemon64 && Daemon64.startsWith('Daemon64:')) { + hasOffset = true + let daemon64_status = Daemon64.split(': ').slice(1).join(': ') let daemon64_info = null if (daemon64_status.split(' ')[1]) { @@ -94,8 +112,20 @@ export function setErrorData(errorLog) { zygote64_status = UNEXPECTED_FAIL } + } + + if (has32BitSupport) { + let Daemon32 = null + let Zygote32 = null + + if (hasOffset) { + Daemon32 = catCmd.stdout.split('\n')[4] + Zygote32 = catCmd.stdout.split('\n')[5] + } else { + Daemon32 = catCmd.stdout.split('\n')[2] + Zygote32 = catCmd.stdout.split('\n')[3] + } - const [ _u1, _u2, _u3, _u4, Daemon32, Zygote32 ] = catCmd.stdout.split('\n') if (Daemon32 && Daemon32.startsWith('Daemon32:')) { /* INFO: Daemon32 is supported */ let daemon32_status = Daemon32.split(': ').slice(1).join(': ') @@ -120,51 +150,12 @@ export function setErrorData(errorLog) { zygote32_status = UNEXPECTED_FAIL } } else { - /* INFO: This should never happen */ - zygote32_div.style.display = 'none' daemon32_div.style.display = 'none' zygote32_status = UNEXPECTED_FAIL } - } else { - /* INFO: Daemon64 is not supported */ - zygote64_div.style.display = 'none' - daemon64_div.style.display = 'none' - - zygote64_status = UNEXPECTED_FAIL - - if (Daemon32 && Daemon32.startsWith('Daemon32:')) { - /* INFO: Daemon32 is supported */ - let daemon32_status = Daemon32.split(': ').slice(1).join(': ') - let daemon32_info = null - if (daemon32_status.split(' ')[1]) { - daemon32_info = daemon32_status.split(' ').slice(1).join(' ') - daemon32_status = daemon32_status.split(' ')[0] - - root_impl.innerHTML = daemon32_info.split('Root: ')[1].split(',')[0] - - const modules = daemon32_info.split('Modules: ')[1].split(')')[0].split(', ') - if (modules[0] !== 'None') modules_32.push(...modules) - } - - const zygote32_injection_status = Zygote32.split(': ')[1] - - if (zygote32_injection_status === 'injected') { - zygote32_status_div.innerHTML = translations.page.home.info.zygote.injected - } else { - zygote32_status_div.innerHTML = translations.page.home.info.zygote.notInjected - - zygote32_status = UNEXPECTED_FAIL - } - } else { - /* INFO: This should never happen */ - zygote32_div.style.display = 'none' - daemon32_div.style.display = 'none' - - zygote32_status = UNEXPECTED_FAIL - } - } + } } if (zygote32_status === EXPECTED && zygote64_status === EXPECTED) {