sets the configuration of a function (type must be of an array == CTLBINDS_PER_FUNC)
| 440 | |
| 441 | // sets the configuration of a function (type must be of an array == CTLBINDS_PER_FUNC) |
| 442 | void lnxgameController::set_controller_function(int id, const ct_type *type, ct_config_data value, const uint8_t *flags) { |
| 443 | ct_element elem; |
| 444 | |
| 445 | if (id >= CT_MAX_ELEMENTS) |
| 446 | return; |
| 447 | |
| 448 | // auto assign keyboard controller if type is key. |
| 449 | if (type[0] == ctKey) |
| 450 | elem.ctl[0] = CONTROLLER_CTL1_INFO(0); |
| 451 | else |
| 452 | elem.ctl[0] = CONTROLLER_CTL1_INFO(CONTROLLER_INFO(value)); |
| 453 | |
| 454 | if (type[1] == ctKey) |
| 455 | elem.ctl[1] = CONTROLLER_CTL2_INFO(0); |
| 456 | else |
| 457 | elem.ctl[1] = CONTROLLER_CTL2_INFO(CONTROLLER_INFO(value)); |
| 458 | |
| 459 | elem.ctype[0] = type[0]; |
| 460 | elem.ctype[1] = type[1]; |
| 461 | elem.format = m_ElementList[id].format; |
| 462 | elem.value[0] = CONTROLLER_CTL1_VALUE(CONTROLLER_VALUE(value)); |
| 463 | elem.value[1] = CONTROLLER_CTL2_VALUE(CONTROLLER_VALUE(value)); |
| 464 | elem.flags[0] = flags[0]; |
| 465 | elem.flags[1] = flags[1]; |
| 466 | elem.enabled = m_ElementList[id].enabled; |
| 467 | |
| 468 | // if controller doesn't exist, set it to invalid. |
| 469 | if (elem.ctl[0] > CT_MAX_CONTROLLERS) |
| 470 | elem.ctl[0] = NULL_LNXCONTROLLER; |
| 471 | if (elem.ctl[1] >= CT_MAX_CONTROLLERS) |
| 472 | elem.ctl[1] = NULL_LNXCONTROLLER; |
| 473 | |
| 474 | assign_element(id, &elem); |
| 475 | } |
| 476 | |
| 477 | // returns information about a requested function (type must be of an array == CTLBINDS_PER_FUNC) |
| 478 | void lnxgameController::get_controller_function(int id, ct_type *type, ct_config_data *value, uint8_t *flags) { |
no outgoing calls
no test coverage detected