Mercurial > repos > blastem
comparison bindings.c @ 2181:0c723b8b637c
Add bindup and binddown debugger commands
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 13 Aug 2022 20:04:02 -0700 |
parents | 1270fe86eb89 |
children | 0d1d5dccdd28 |
comparison
equal
deleted
inserted
replaced
2180:b87658ba3b94 | 2181:0c723b8b637c |
---|---|
584 if (mouse_mode == MOUSE_RELATIVE || (mouse_mode == MOUSE_CAPTURE && mouse_captured)) { | 584 if (mouse_mode == MOUSE_RELATIVE || (mouse_mode == MOUSE_CAPTURE && mouse_captured)) { |
585 render_relative_mouse(1); | 585 render_relative_mouse(1); |
586 } | 586 } |
587 } | 587 } |
588 | 588 |
589 int parse_binding_target(int device_num, char * target, tern_node * padbuttons, tern_node *mousebuttons, uint8_t * subtype_a, uint8_t * subtype_b) | 589 int parse_binding_target(int device_num, const char * target, tern_node * padbuttons, tern_node *mousebuttons, uint8_t * subtype_a, uint8_t * subtype_b) |
590 { | 590 { |
591 const int gpadslen = strlen("gamepads."); | 591 const int gpadslen = strlen("gamepads."); |
592 const int mouselen = strlen("mouse."); | 592 const int mouselen = strlen("mouse."); |
593 if (startswith(target, "gamepads.")) { | 593 if (startswith(target, "gamepads.")) { |
594 int padnum = target[gpadslen] == 'n' ? device_num + 1 : target[gpadslen] - '0'; | 594 int padnum = target[gpadslen] == 'n' ? device_num + 1 : target[gpadslen] - '0'; |
950 mousebuttons = tern_insert_int(mousebuttons, ".start", MOUSE_START); | 950 mousebuttons = tern_insert_int(mousebuttons, ".start", MOUSE_START); |
951 mousebuttons = tern_insert_int(mousebuttons, ".motion", PSEUDO_BUTTON_MOTION); | 951 mousebuttons = tern_insert_int(mousebuttons, ".motion", PSEUDO_BUTTON_MOTION); |
952 } | 952 } |
953 return mousebuttons; | 953 return mousebuttons; |
954 } | 954 } |
955 | |
956 uint8_t bind_up(const char *target) | |
957 { | |
958 keybinding bind; | |
959 bind.bind_type = parse_binding_target(0, target, get_pad_buttons(), get_mouse_buttons(), &bind.subtype_a, &bind.subtype_b); | |
960 if (!bind.bind_type) { | |
961 return 0; | |
962 } | |
963 handle_binding_up(&bind); | |
964 return 1; | |
965 } | |
966 | |
967 uint8_t bind_down(const char *target) | |
968 { | |
969 keybinding bind; | |
970 bind.bind_type = parse_binding_target(0, target, get_pad_buttons(), get_mouse_buttons(), &bind.subtype_a, &bind.subtype_b); | |
971 if (!bind.bind_type) { | |
972 return 0; | |
973 } | |
974 handle_binding_down(&bind); | |
975 return 1; | |
976 } | |
977 | |
955 | 978 |
956 tern_node *get_binding_node_for_pad(int padnum) | 979 tern_node *get_binding_node_for_pad(int padnum) |
957 { | 980 { |
958 if (padnum > MAX_JOYSTICKS) { | 981 if (padnum > MAX_JOYSTICKS) { |
959 return NULL; | 982 return NULL; |