Skip to content

Instantly share code, notes, and snippets.

@Treeki
Created December 21, 2018 03:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Treeki/b171ae073255317cc7c338d140ef852d to your computer and use it in GitHub Desktop.
Save Treeki/b171ae073255317cc7c338d140ef852d to your computer and use it in GitHub Desktop.
Notifications from Mouse:
08 02 x :: sends message with wParam 8, lParam x to GUI
08 01 x :: sends message with wParam 9, lParam x to GUI
08 06 x :: sends message with wParam 0xA, lParam x to GUI
08 09 __ 01 __ 04 :: sends message with wParam 0xB, lParam 0 to GUI
08 09 __ 01 __ 08 :: sends message with wParam 0xB, lParam 1 to GUI
08 09 __ 01 __ 02 :: sends message with wParam 0xB, lParam 2 to GUI
08 09 __ 02 __ 00 :: sends message with wParam 0xB, lParam 3 to GUI
08 09 __ 06 __ __ :: sends message with wParam 0xB, lParam 4 to GUI
08 09 __ 07 __ __ :: sends message with wParam 0xB, lParam 5 to GUI
08 09 __ 01 __ 0A :: sends message with wParam 0xB, lParam 6 to GUI
08 09 __ __ __ __ :: sends message with wParam 0xB, lParam 7 to GUI
__ FF x ::
Depending on x (the third byte), something happens on the system:
0x11 - Ctrl+X
0x12 - Ctrl+C
0x13 - Ctrl+V
0x14 - Ctrl+A
0x15 - Ctrl+F
0x16 - Ctrl+N
0x17 - Ctrl+P
0x18 - Ctrl+S
0x19 - Alt+Tab
0x1A - Alt+S
0x1B - Win+E
0x1C - Win+R
0x1D - Win+D
0x1E - WinExec(“Rundll32.exe user32.dll, LockWorkStation”); (really????)
0x1F - looks up the Internet Explorer homepage and ShellExecutes it
0x20 - browser back
0x21 - browser forward
0x22 - browser stop
0x23 - browser refresh
0x24 - F3
0x25 - browser favourites
0x26 - looks up the command associated to mailto: by the OS and ShellExecutes it
Common Header:
u8 cmdSize [ 2 = 16, 3 = 64, 4 = 1024 ]
u8 cmdType
Commands:
*****
Unknown1 (Set_Feature)
u8 cmdSize = 2
u8 cmdType = 0xF1
u8 param1
u8 param2
{2,F1,02,01} is optionally sent when the group ID is written
{2,F1,02,02} is optionally sent when DPI settings are written
{2,F1,02,04} is optionally sent when LED settings are written
{2,F1,02,08} is optionally sent when the polling rates are written
{2,F1,02,10} is optionally sent when the DPI field is written
this might force the mouse to update certain parts of its state?
*****
Read Stage 1 (Set_Feature)
u8 cmdSize = [2,3,4]
u8 cmdType = 0xF2
u16 address
u8 size
u8 reserved[3]
[zeroes]
Read Stage 2 (Get_Feature)
Sent to Mouse:
u8 cmdSize = same as Stage 1
u8 cmdType = same as Stage 1
[zeroes]
Received from Mouse:
u8 unk[9]
u8 data[…]
[zeroes]
*****
Write (Set_Feature)
u8 cmdSize = [2,3,4]
u8 cmdType = 0xF3
u16 address
u8 size
u8 reserved[3]
u8 data[…]
[zeroes]
*****
Unknown5 (Set_Feature)
u8 cmdSize = 2
u8 cmdType = 0xF5
u8 param
{2,F5,0} is sent when an operation is starting with the mouse (i.e. saving, loading)
{2,F5,1} is sent when that operation is finished
*****
MEMORY LAYOUT
*****
DPIStage Structure:
0 : u8 exists
1 : u8 ? read using some very strange code
2 : u8 ? always 0 or 1
3..5 : u8 reserved[3]
Main Group Structure:
2 : u8 DPI
4 .. 0x21 : DPIStage[5]
0x42 .. 0xA1 : u32 ButtonMappings[24]
Macro Structure:
63 entries, 3 bytes each (189 bytes total)
Addresses:
0x20 : u8 Group0 WheelScrollLines
0x22 : u8 Group1 WheelScrollLines
0x24 : u8 Group2 WheelScrollLines
0x26 : u8 Group3 WheelScrollLines
0x28 : u8 Group4 WheelScrollLines
0x2C : u8 GroupID
0x32 : u8 Group0 PollingRate
0x34 : u8 Group1 PollingRate
0x36 : u8 Group2 PollingRate
0x38 : u8 Group3 PollingRate
0x3A : u8 Group4 PollingRate
0x3D : u8 WheelScrollLines <<for group 0 only?? not sure what’s going on here>>
0x3E .. 0x3F : u16 unk (zeroed out on save by sub_40F7B0)
0x40 .. 0xE1 : MainGroupStruct
0x100 .. 0x1A1 : MainGroupStruct
0x1B0 .. 0x251 : MainGroupStruct
0x260 .. 0x301 : MainGroupStruct
0x310 .. 0x3B1 : MainGroupStruct
0x446 .. 0x447 : u16 unk (zeroed out when uploading LED data)
0x449 .. 0x44F : u8 Group0_LEDData[7] {R, G, B, mode, flashState, ?, ledState}
0x451 .. 0x457 : u8 Group1_LEDData[7]
0x459 .. 0x45F : u8 Group2_LEDData[7]
0x461 .. 0x467 : u8 Group3_LEDData[7]
0x469 .. 0x46F : u8 Group4_LEDData[7]
0x478 .. 0x534 : Macro 0
0x540 .. 0x5FC : Macro 1
0x608 .. 0x6C4 : Macro 2
0x6D0 .. 0x78C : Macro 3
0x798 .. 0x854 : Macro 4
0x860 .. 0x91C : Macro 5
0x928 .. 0x9E4 : Macro 6
0x9F0 .. 0xAAC : Macro 7
0xAB8 .. 0xB74 : Macro 8
0xB80 .. 0xC3C : Macro 9
0xC48 .. 0xD04 : Macro 10
0xD10 .. 0xDCC : Macro 11
0xDD8 .. 0xE94 : Macro 12
0xEA0 .. 0xF5C : Macro 13
0xF68 .. 0x1024 : Macro 14
0x1030 .. 0x10EC : Macro 15
0x10F8 .. 0x11B4 : Macro 16
0x11C0 .. 0x127C : Macro 17
0x1288 .. 0x1344 : Macro 18
0x1350 .. 0x140C : Macro 19
@bgigous
Copy link

bgigous commented Aug 2, 2022

Oooh this is cool. Thanks! Are these values the same for most/all Redragon mice? Like the M901?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment