Files
rat8plus-rgb/README.md
T

55 lines
3.0 KiB
Markdown
Raw Normal View History

# Mad Catz R.A.T. 8+ lighting without the vendor software
USB ID 12CF:0C05, firmware 18. Protocol decompiled from the vendor app (`Controllers\RAT8P.dll`).
Details are in the docstring at the top of `rat8.py`.
- `MadCatz_RAT8Plus.js`: SignalRGB plugin, installed in `Documents\WhirlwindFX\Plugins`.
Restart SignalRGB after changing it.
- `rat8.py`: command-line tool (`pip install hidapi`).
- Run `python rat8.py backup profile_backup.json` before you change anything, so
`restore` can put the mouse back exactly as it was.
The plugin streams colours live with a firmware command the vendor app never uses
(`[12, C4, 3, 4, 1, zone, R, G, B]`, see "Firmware" below). That command goes straight
to the LED driver with no storage writes, so it doesn't wear anything out. It handles
110+ updates a second. The `static`/`breathe`/`off` commands below change the stored
profile instead (one storage write each), which survives replugging.
Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = DPI button.
```
python rat8.py live ff0000 00ff00 0000ff # RAM only, until release/replug
python rat8.py release # back to the stored lighting
python rat8.py info
python rat8.py static 00aaff # all zones
python rat8.py static ff0000 00ff00 0000ff # scroll palm dpi
python rat8.py breathe ff00ff -p 3
python rat8.py off
python rat8.py restore profile_backup.json
```
Close SignalRGB (or disable the plugin) before you use the script, because both share
one reply buffer on the mouse.
## Firmware
The firmware isn't in this repo, because it's Mad Catz's code. To get it, decompile
`MADCATZ R8+ Firmware Update Tool.exe` with `ilspycmd -p`. The `Firmware` byte array in
`GAMINGAPP.Properties.Resources.resx` is the whole image: 49,152 bytes, version 18
(the version the mouse reports). It's unencrypted ARM Cortex-M0 code, loaded at address 0
(initial SP 0x20002000, so 8 KB RAM; reset handler at 0x86E3), which fits a Sonix
SN32F2-series chip. The addresses below are for that image, disassembled as Thumb with capstone.
The updater sends `[12, 0xC4, 5, 0, 0]` to put the mouse into update mode, then 24 chunks with
`[10, 0x10, chunk, checksum, 2048 bytes]`. **Never send command 5 by hand.** The mouse would sit
in update mode waiting for an image. The protocol has no command to read flash back.
Useful addresses:
- `0x319C`: feature-report handler. It dispatches on the prefix byte: C4 goes to 0x2F94,
and C5, DE and DF go to raw/debug handlers.
- `0x2F94`: C4 command switch (jump table at 0x2FA8). 0 reload, 1 reset, 3 live LED, 5 update
mode, 6 calibrate, 7 select profile, 8 version, 12 read profile, 15 raw byte access, 22 active profile.
- `0x2E74`: command 3. The first call pauses the effect engine (0x4ED2) and blanks the LEDs.
Sub 4 sets colours: mode 1 is one zone via 0x6C3C, mode 2 is all zones via 0x6C8C, or off.
Sub 3/3 releases (0x4F1E).
- `0x6B90`: writes to the 9-channel LED driver over bus 0. Register 1 holds the 9 PWM bytes
(3 zones × RGB), and writing register 0x16 latches them.