Skip to content

Commit

Permalink
fix: 64-bit/32-bit-only device detection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ThePedroo committed Nov 12, 2024
1 parent dddda78 commit a805f88
Showing 1 changed file with 31 additions and 41 deletions.
72 changes: 31 additions & 41 deletions webroot/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export function setErrorData(errorLog) {
const translations = await getTranslations(sys_lang)

const loading_screen = document.getElementById('loading_screen')
const bottom_nav = document.getElementById('navbar_support_div')

const rootCss = document.querySelector(':root')

Expand All @@ -61,17 +60,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]) {
Expand All @@ -94,45 +111,19 @@ export function setErrorData(errorLog) {

zygote64_status = UNEXPECTED_FAIL
}
}

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(': ')
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
if (has32BitSupport) {
let Daemon32 = null
let Zygote32 = null

zygote32_status = UNEXPECTED_FAIL
}
if (hasOffset) {
Daemon32 = catCmd.stdout.split('\n')[4]
Zygote32 = catCmd.stdout.split('\n')[5]
} else {
/* INFO: This should never happen */

zygote32_div.style.display = 'none'
daemon32_div.style.display = 'none'

zygote32_status = UNEXPECTED_FAIL
Daemon32 = catCmd.stdout.split('\n')[2]
Zygote32 = catCmd.stdout.split('\n')[3]
}
} 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 */
Expand All @@ -143,7 +134,7 @@ export function setErrorData(errorLog) {
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)
}
Expand All @@ -158,13 +149,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
}
}
}
}

if (zygote32_status === EXPECTED && zygote64_status === EXPECTED) {
Expand Down

0 comments on commit a805f88

Please sign in to comment.