Ring-Con: Difference between revisions

No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This page documents how the Ring Fit Adventure game uses [[HID_services#hidbus|hidbus]] for using the Ring-Con ExternalDevice, which attaches to Joy-Cons.
This page documents how the Ring Fit Adventure game uses [[HID_services#hidbus|hidbus]] for using the Ring-Con [[HID_services#ExternalDevices|ExternalDevice]], which attaches to Joy-Cons.


The [[HID_services#BusType|BusType]] used with GetBusHandle is value 0 or 1.
After EnableExternalDevice is used successfully during initialization, EnableJoyPollingReceiveMode(flag=true) is used with command [[#0x00020101]]. For cleanup, DisableJoyPollingReceiveMode is used then on success EnableExternalDevice(flag=false) is used.
 
The ExternalDeviceId is 0x20. After EnableExternalDevice is used successfully during initialization, EnableJoyPollingReceiveMode(flag=true) is used with command [[#0x00020101]]. For cleanup, DisableJoyPollingReceiveMode is used then on success EnableExternalDevice(flag=false) is used.


Commands (input data for EnableJoyPollingReceiveMode / SendAndReceive) start with the u32 cmd. Data in the replies are at least 0x4-bytes, with fields being 4-byte aligned. Reply+0 is the u8 status. When the output size doesn't match the expected size, or status is non-zero, error 0xEDA is returned. When status is non-zero, a func is called with the status value which updates global state.
Commands (input data for EnableJoyPollingReceiveMode / SendAndReceive) start with the u32 cmd. Data in the replies are at least 0x4-bytes, with fields being 4-byte aligned. Reply+0 is the u8 status. When the output size doesn't match the expected size, or status is non-zero, error 0xEDA is returned. When status is non-zero, a func is called with the status value which updates global state.
Line 17: Line 15:


= Commands =
= Commands =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 158: Line 155:
Then, if any of the 16bit output fields in output_struct are set to 0xCAFE, a flag is set to 0x2 (same field used for invalid-CRC, which uses value 0x1 for that). Then this returns 0. This field is "user_state".
Then, if any of the 16bit output fields in output_struct are set to 0xCAFE, a flag is set to 0x2 (same field used for invalid-CRC, which uses value 0x1 for that). Then this returns 0. This field is "user_state".


This reads the user calibration.
This reads the user calibration. This is normally (?) not calibrated (fields are set to 0xCAFE).


Reply:
Reply:
Line 187: Line 184:
== 0x00023104 ==
== 0x00023104 ==
The code which calls the func implementing this clamps the output value to range 0-500, then copies it elsewhere.
The code which calls the func implementing this clamps the output value to range 0-500, then copies it elsewhere.
This gets the rep-count for Multitask-Mode.


Reply:
Reply:
Line 196: Line 195:
| 0x4 || 0x3 || Data, copied to an output struct as a s32.
| 0x4 || 0x3 || Data, copied to an output struct as a s32.
|-
|-
| 0x7 || 0x1 || [[#CRC]] over the previous 0x3-bytes.
| 0x7 || 0x1 || [[#CRC]] over the previous 0x3-bytes, followed a value-0 byte.
|}
|}


== 0x00023204 ==
== 0x00023204 ==
The func implementing this in the app is identical to [[#0x00023104]] except for the cmd u32. The output field is "total_push_count".
The func implementing this in the app is identical to [[#0x00023104]] except for the cmd u32. The output field is "total_push_count". This is only updated in Multitask Mode.


The code calling this func copies the output into a global field, when it's valid.
The code calling this func copies the output into a global field, when it's valid.
Line 208: Line 207:


Unlike the other cmds, this checks for output_size==0x4, instead of {output buffer size} (it's unknown whether this is intended).
Unlike the other cmds, this checks for output_size==0x4, instead of {output buffer size} (it's unknown whether this is intended).
This resets the value returned by [[#0x00023104]] to 0.


== 0x04011104 ==
== 0x04011104 ==
Line 234: Line 235:


Cmd:
Cmd:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-