| 472 | } |
| 473 | |
| 474 | void InputBind_Load(const struct InputDevice* device) { |
| 475 | cc_string name; char nameBuffer[STRING_SIZE + 1]; |
| 476 | const BindMapping* defaults = device->defaultBinds; |
| 477 | BindMapping* keybinds = device->currentBinds; |
| 478 | BindMapping mapping; |
| 479 | cc_string str, part1, part2; |
| 480 | int i; |
| 481 | |
| 482 | String_InitArray_NT(name, nameBuffer); |
| 483 | for (i = 0; i < BIND_COUNT; i++) |
| 484 | { |
| 485 | name.length = 0; |
| 486 | String_Format1(&name, device->bindPrefix, bindNames[i]); |
| 487 | name.buffer[name.length] = '\0'; |
| 488 | |
| 489 | if (!Options_UNSAFE_Get(name.buffer, &str)) { |
| 490 | keybinds[i] = defaults[i]; |
| 491 | continue; |
| 492 | } |
| 493 | |
| 494 | String_UNSAFE_Separate(&str, ',', &part1, &part2); |
| 495 | mapping.button1 = Utils_ParseEnum(&part1, defaults[i].button1, Input_StorageNames, INPUT_COUNT); |
| 496 | mapping.button2 = Utils_ParseEnum(&part2, defaults[i].button2, Input_StorageNames, INPUT_COUNT); |
| 497 | |
| 498 | if (mapping.button1 == CCKEY_ESCAPE) keybinds[i] = defaults[i]; |
| 499 | keybinds[i] = mapping; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | void InputBind_Set(InputBind binding, int btn, const struct InputDevice* device) { |
| 504 | cc_string name; char nameBuffer[STRING_SIZE]; |
no test coverage detected