Add Bluetooth Audio Input Unlock (HiBy R1)#18
Conversation
Unlocks the hidden "Bluetooth audio input" (DAC/Sink mode) on the HiBy R1. Two patches to /usr/bin/hiby_player: 1. Bypass the view blocklist (FUN_004f7220) by shifting the addiu immediate +1, so it checks "g_bt_input_hiby" instead of "vg_bt_input_hiby". Original string stays intact, so event handler binding (back button, disconnect dialog) keeps working. 2. Inject the missing menu item by overwriting the volume_sync addition with a jump to a 40-byte code cave in .rodata. The cave re-executes volume_sync, then adds bt_input, then jumps back. Volume Sync stays functional. Includes patch_bt_input.py which locates strings, blocklist, menu builder, and a code cave dynamically — works across community variants without hardcoded offsets. Handles MIPS addiu sign-extension. Tested on sorting-patch hiby_player (fw 1.6): option appears in Bluetooth settings, Sink mode activates, back button and disconnect dialog work, no bootloop, USB working mode unaffected.
|
This looks really cool! Very clever to just offset the read by 1 byte. I don't have an R1, so I can't verify, unfortunately. Hope this gets merged soon though. |
|
@japq7s I tried your python script on a clean 1.6 firmware and I get this: [+] Found vg_bt_input_hiby at 0x75ffbc I get the same issue on the version from https://github.com/bidhata/Hiby-R1-Mod/releases/tag/DAC |
|
@endgame47 Thank you for checking my script! This is a bug on line 73 — the jal opcode check was 0x0c instead of 0x03 (jal is 000011 binary = 0x03 after >> 26). The wrong constant always fails the check. It worked on my test because I tested on the sorting-patch variant where the offsets differ. The bug only shows up on certain builds. Fixed in the latest push, also added 4-byte alignment for the code cave. Tested now on clean 1.6 and latest mod release, now it works. |
ef5f601 to
8d70963
Compare
|
Sorry for this force push mess, I accidentally pushed my new changes for UI For perfect input mode layout we need to scale dark_theme bluetooth icon and change alignment for codec icon |
Thanks for the great mod - small addition if it's useful.
What this does
HiBy R1 natively supports "Bluetooth audio input" (Bluetooth DAC/Sink mode) in the firmware (as seen in R3 Pro II and others), but the option is explicitly hidden from the Bluetooth settings menu, and its view group is soft-blocked by the UI manager. This patch unblocks the view and dynamically injects the missing menu item into the Bluetooth settings list without replacing or breaking any existing options. The UI back button and disconnect dialog work flawlessly.
The change
Two changes are required in
hiby_player:Bypass the View Blocker:
hiby_playerhas a blocklist routine (FUN_004f7220) that checks againstvg_bt_input_hibyand prevents it from opening.We shift the pointer by 1 byte so it checks against
g_bt_input_hibyinstead, ensuring the block is bypassed while keeping the original string intact so event handlers (like the Back button) can still bind to the view.Inject the Menu Item:
The menu builder loop calls
lg_listview_add_itemfor each item. We overwrite thevolume_syncaddition with a jump (j) to a code cave (40 bytes of0x00in.rodata).In the code cave, we execute the original
volume_syncaddition, followed by the newly injectedbt_inputaddition, and then jump back.Contents
Offsets (for sorting variant): Blocklist
0xf723c, Menu jump0xad034, Cave0x36f7f8.patch_bt_input.py— optional helper that locates the blocklist addiu, menu builder signatures, and a suitable code cave dynamically. This ensures it works reliably across different community binary variants (stock, sorting patch, etc.) without hardcoded offsets.Tested
Applied to the Sorting-patch
hiby_player(HiBy R1 fw 1.6) from this mod, repacked and flashed via SD.Verified that the "Bluetooth audio input" option appears natively under Bluetooth settings, activates Sink mode correctly, and the UI back button exits the mode seamlessly without leaving dead screens.