| 1 | // SPDX-FileCopyrightText: 2009 Ingo Ruhnke <[email protected]> |
| 2 | // SPDX-FileCopyrightText: 2025 Raphael Rosch <[email protected]> |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef HEADER_JSTEST_GTK_JOYSTICK_CONFIG_FILES_HPP |
| 6 | #define HEADER_JSTEST_GTK_JOYSTICK_CONFIG_FILES_HPP |
| 7 | |
| 8 | #include <iostream> |
| 9 | #include <fstream> |
| 10 | #include <sstream> |
| 11 | #include <unordered_map> |
| 12 | |
| 13 | #include <vector> |
| 14 | #include <string> |
| 15 | |
| 16 | #include <dirent.h> |
| 17 | // #include <filesystem> |
| 18 | |
| 19 | // namespace fs = std::filesystem; |
| 20 | |
| 21 | struct JoystickConfig { |
| 22 | std::unordered_map<std::string, std::string> values; |
| 23 | std::vector<std::string> usb_ids; |
| 24 | std::string icon_filename; |
| 25 | std::string js_type; |
| 26 | bool icon_filename_is_good = false; |
| 27 | std::vector<std::string> axes; |
| 28 | std::vector<std::string> buttons; |
| 29 | int button_maxlen = 0; |
| 30 | }; |
| 31 | |
| 32 | |
| 33 | JoystickConfig load_config(const std::string& filename); |
| 34 | JoystickConfig get_config_for_usb_id(const std::string& usb_id); |
| 35 | |
| 36 | std::vector<JoystickConfig> load_all_configs(const std::string& directory); |
| 37 | |
| 38 | extern std::vector<JoystickConfig> joystick_configs; |
| 39 | |
| 40 | |
| 41 | |
| 42 | #endif |
| 43 | |
| 44 | /* EOF */ |