@@ -116,7 +116,7 @@ static int handle_short_poll(const uint8_t *command, si_complete_cb_t callback,
116116 uint8_t analog_mode = command [1 ] & 0x07 ;
117117 uint8_t motor_state = command [2 ] & 0x03 ;
118118
119- if (!(device -> info [ 0 ] & SI_GC_WIRELESS )) {
119+ if (!si_device_gc_is_wireless (device )) {
120120 // Update the origin flags
121121 device -> input .buttons .need_origin = (device -> info [2 ] & SI_NEED_ORIGIN ) != 0 ;
122122 device -> input .buttons .use_origin = true;
@@ -155,7 +155,7 @@ static int handle_read_origin(const uint8_t *command, si_complete_cb_t callback,
155155 struct si_device_gc_controller * device = (struct si_device_gc_controller * )context ;
156156
157157 // Tell the host it no longer needs to fetch the origin
158- if (!(device -> info [ 0 ] & SI_GC_WIRELESS )) {
158+ if (!si_device_gc_is_wireless (device )) {
159159 device -> info [2 ] &= ~SI_NEED_ORIGIN ;
160160 }
161161
@@ -187,7 +187,7 @@ static int handle_calibrate(const uint8_t *command, si_complete_cb_t callback, v
187187 device -> origin .trigger_right = device -> input .trigger_right ;
188188
189189 // Tell the host it no longer needs to fetch the origin
190- if (!(device -> info [ 0 ] & SI_GC_WIRELESS )) {
190+ if (!si_device_gc_is_wireless (device )) {
191191 device -> info [2 ] &= ~SI_NEED_ORIGIN ;
192192 }
193193
@@ -218,7 +218,7 @@ static int handle_long_poll(const uint8_t *command, si_complete_cb_t callback, v
218218 device -> input .buttons .use_origin = true;
219219
220220 // Save the analog mode and motor state
221- if (!(device -> info [ 0 ] & SI_GC_WIRELESS )) {
221+ if (!si_device_gc_is_wireless (device )) {
222222 device -> info [2 ] &= ~(SI_MOTOR_STATE_MASK | SI_ANALOG_MODE_MASK );
223223 device -> info [2 ] |= motor_state << 3 | analog_mode ;
224224 }
@@ -297,7 +297,7 @@ void si_device_gc_init(struct si_device_gc_controller *device, uint8_t type)
297297 device -> input_valid = true;
298298
299299 // Request the origin on non-wireless controllers
300- if (!( type & SI_GC_WIRELESS ))
300+ if (!si_device_gc_is_wireless ( device ))
301301 device -> info [2 ] = SI_NEED_ORIGIN ;
302302
303303 // Register the SI commands handled by GameCube controllers
@@ -309,7 +309,7 @@ void si_device_gc_init(struct si_device_gc_controller *device, uint8_t type)
309309 si_command_register (SI_CMD_GC_LONG_POLL , SI_CMD_GC_LONG_POLL_LEN , handle_long_poll , device );
310310
311311 // Register additional commands handled by WaveBird receivers
312- if (type & SI_GC_WIRELESS ) {
312+ if (si_device_gc_is_wireless ( device ) ) {
313313 si_command_register (SI_CMD_GC_PROBE_DEVICE , SI_CMD_GC_PROBE_DEVICE_LEN , handle_probe_device , device );
314314 si_command_register (SI_CMD_GC_FIX_DEVICE , SI_CMD_GC_FIX_DEVICE_LEN , handle_fix_device , device );
315315 }
@@ -340,5 +340,6 @@ void si_device_gc_set_wireless_origin(struct si_device_gc_controller *device, ui
340340 }
341341
342342 // Set the "has wireless origin" flag in the device info
343- device -> info [1 ] |= SI_WIRELESS_ORIGIN ;
343+ if (si_device_gc_is_wireless (device ))
344+ device -> info [1 ] |= SI_WIRELESS_ORIGIN ;
344345}
0 commit comments