[ASUS ROG Phone 5 / 5s] stev4e:
Thank you @johnny886!

This guide helped me install latest WW updates on Tencent (CN) phone, unlock bootloader and then root my device!

I ran into some kinks along the way so I'll share my experience here in case it helps anyone else.

I had a Tencent phone that had WW firmware installed when I bought it but running an old Android 11 build and Bootloader unlock not working.

If you don't have the phone's box with the 2 IMEI numbers listed I would copy them from the "about phone" settings screen before following this guide.

To start, I wouldn't recommend using the batch files - if they fail there's no descriptive error message, so it's best to open them in notepad, see what they do and then copy-paste the commands into a fresh terminal (change current working directory of the terminal to the ROG5 folder extracted from OP zip).

Make sure to have ADB drivers installed and check that it's detecting your device (which needs to have developer options and USB debugging turned on) by running "adb devices".

From here you can run "adb reboot bootloader" where you can use the fastboot commands. I was stupid and I was running "adb reboot fastboot" to run the fastboot commands but I realized my mistake when I read one reply from @twistedumbrella pointing this out in another thread (Thanks!). That's probably why I couldn't run "fastboot oem enter-dload" to enter EDL mode but I got around it by running "adb reboot edl" with the device turned on and connected in adb mode.

Then I could see QSHUBS_BULK_xxx appear in the device manager which meant I was missing the Qualcomm EDL drivers so I installed them following this guide: https://fixfirmware.com/qhsusb-bulk-driver/

The drivers weren't signed so they appeared with a yellow exclamation mark in device manager. This meant I had to disable driver signature verification by following the Shift+Restart method from this guide: https://www.droidwin.com/disable-driver-signature-verification-windows-10/

After this, going into ADL mode and running the "0-update_image_EDL.bat" script it ran successfully and I wasn't getting the sahara protocol error anymore. After getting the finished message without an error the phone rebooted into some factory firmware based on an old android version, probably used for testing the device. And on the home screen there was a widget with my ISN and SSN listed so I wrote them down.

I proceeded to backup the 7 files, making sure that "adb shell" followed by "su" didn't throw an error (Looks like bootloader is unlocked in this factory image because it didn't work previously). Then I checked the persist.img, which is an archive so you need to open it with 7-zip, no need for WinHex Pro, then opened the Country file inside and saw it was already WW, not CN. If you need to change it to WW then you will either need to repackage the archive after extracting it and editing the country file or use WinHex Pro.

Then I checked my asuskey4 file and it was missing a lot of data including IMEI so I used HxD hex editor to place the fingerprinting information at the correct addresses as shown in the screenshot attached to johnny's opening post in this thread and finally I used the restore script to push just this file to the phone.

After that I was able to enter bootloader mode and run 'fastboot flash all WW_xxx.raw" from inside the WW folder and it flashed without a hitch. Note that I used another WW raw that had a later version than the one johnny provided but it shouldn't matter in the end.

After booting to a fresh install of the WW ROM I did get the hardwarestub notification but then after I applied the OTA updates it was gone.

For installing the OTA updates you don't need to flash them one by one like someone in one of these threads claimed, I installed the last one for Android 11 first and then the latest one for Android 12 just by downloading them to the sdcard root directory on the phone and tapping the "update package detected" notification. You should be able to go directly to latest update but I haven't tested that.

After all that was done I successfully unlocked the bootloader using the ASUS unlock tool (You will get a warning screen every time you reboot the phone when your bootloader is unlocked, no need to check using dial codes or oem commands, you'll know). So my IMEI wasn't blocked because seller already unlocked it once but it was missing completely from the asuskey4 file I guess.

After unlocking bootloader I just extracted the boot img from the OTA update using python payload dumper (win64 payload dumper should work too), I loaded it onto the phone storage and patched it with Magisk app and finally I flashed it using 'fastboot flash boot ./magisk-patched-boot.img' command and viola! I had root.

And one more hint for those that think their phone is stuck in EDL mode:

Open device manager and hold power and vol down until the ADL device dissappears, hold it for too long and it'll just enter EDL mode again but if you release it at the right moment it'll boot normally.

Hope this writeup helps someone.

Cheers!