diff --git a/resource/CMakeResources.cmake b/resource/CMakeResources.cmake index 249fb93ac..920886b6f 100644 --- a/resource/CMakeResources.cmake +++ b/resource/CMakeResources.cmake @@ -7,7 +7,7 @@ function(add_resources out_var id) "\n" "namespace ${id}\n" "{\n" - " extern const std::map> data\;\n" + " extern const std::map> data\;\n" "}\n" ) @@ -20,7 +20,7 @@ function(add_resources out_var id) "namespace ${id}\n" "{\n" "\n" - " const std::map> data = {\n" + " const std::map> data = {\n" ) set(options ${ARGN}) @@ -46,13 +46,13 @@ function(add_resources out_var id) "extern int ${symbol}_len\;\n" "\n") string(APPEND content_cpp_public - " {${resource_id}, {${symbol}, ${symbol}_len}},\n") + " {${resource_id}, {${symbol}, ${symbol}_len}},\n") list(APPEND result ${out_f_cpp}) endwhile() string(APPEND content_cpp_public - " }\;\n" + " }\;\n" "\n" "}\n" ) diff --git a/source/frontends/.clang-format b/source/frontends/.clang-format new file mode 120000 index 000000000..f95032f4f --- /dev/null +++ b/source/frontends/.clang-format @@ -0,0 +1 @@ +../linux/.clang-format \ No newline at end of file diff --git a/source/frontends/common2/argparser.cpp b/source/frontends/common2/argparser.cpp index 5794fac18..1ada91816 100644 --- a/source/frontends/common2/argparser.cpp +++ b/source/frontends/common2/argparser.cpp @@ -14,462 +14,444 @@ namespace { - constexpr int PAUSED = 1001; - constexpr int FIXED_SPEED = 1002; - constexpr int HEADLESS = 1003; - constexpr int NO_SQUARING = 1004; - constexpr int SLIRP_NAT = 1005; + constexpr int PAUSED = 1001; + constexpr int FIXED_SPEED = 1002; + constexpr int HEADLESS = 1003; + constexpr int NO_SQUARING = 1004; + constexpr int SLIRP_NAT = 1005; - constexpr int DISK_H1 = 1006; - constexpr int DISK_H2 = 1007; + constexpr int DISK_H1 = 1006; + constexpr int DISK_H2 = 1007; - constexpr int MEM_CLEAR = 1008; - constexpr int ROM = 1009; - constexpr int F8ROM = 1010; + constexpr int MEM_CLEAR = 1008; + constexpr int ROM = 1009; + constexpr int F8ROM = 1010; - constexpr int NO_AUDIO = 1011; - constexpr int AUDIO_BUFFER = 1012; - constexpr int WAV_SPEAKER = 1013; - constexpr int WAV_MOCKINGBOARD = 1014; + constexpr int NO_AUDIO = 1011; + constexpr int AUDIO_BUFFER = 1012; + constexpr int WAV_SPEAKER = 1013; + constexpr int WAV_MOCKINGBOARD = 1014; - constexpr int SDL_DRIVER = 1015; - constexpr int GL_SWAP = 1016; - constexpr int TIMER = 1017; - constexpr int NO_IMGUI = 1018; - constexpr int GEOMETRY = 1019; - constexpr int ASPECT_RATIO = 1020; - constexpr int GAME_CONTROLLER = 1021; - constexpr int MAPPING_FILE = 1022; - constexpr int AUDIO_DEVICE = 1023; + constexpr int SDL_DRIVER = 1015; + constexpr int GL_SWAP = 1016; + constexpr int TIMER = 1017; + constexpr int NO_IMGUI = 1018; + constexpr int GEOMETRY = 1019; + constexpr int ASPECT_RATIO = 1020; + constexpr int GAME_CONTROLLER = 1021; + constexpr int MAPPING_FILE = 1022; + constexpr int AUDIO_DEVICE = 1023; - constexpr int NO_VIDEO_UPDATE = 1024; - constexpr int EV_DEVICE_NAME = 1025; + constexpr int NO_VIDEO_UPDATE = 1024; + constexpr int EV_DEVICE_NAME = 1025; - struct OptionData_t - { - const char * name; - int has_arg; - int val; - const char * description; - const char * defaultValue; // optional - }; + struct OptionData_t + { + const char *name; + int has_arg; + int val; + const char *description; + const char *defaultValue; // optional + }; - bool isShort(const int val) - { - return val >= 0 && val <= 0xFF; - } + bool isShort(const int val) + { + return val >= 0 && val <= 0xFF; + } - void printHelp(const std::vector>> & data) - { - for (const auto & categories : data) + void printHelp(const std::vector>> &data) { - std::cerr << categories.first << ":" << std::endl; - for (const auto & option : categories.second) - { - std::cerr << " "; - std::ostringstream value; - if (isShort(option.val)) - { - value << "[ -" << char(option.val) << " ] "; - } - else - { - value << " "; - } - value << "--" << option.name; - if (option.has_arg == required_argument) - { - value << " arg"; - } - std::cerr << std::left << std::setw(30) << value.str() << "\t" << option.description << std::endl; - if (option.defaultValue) - { - std::cerr << "\t\t\t\t\t( " << option.defaultValue << " )" << std::endl; + for (const auto &categories : data) + { + std::cerr << categories.first << ":" << std::endl; + for (const auto &option : categories.second) + { + std::cerr << " "; + std::ostringstream value; + if (isShort(option.val)) + { + value << "[ -" << char(option.val) << " ] "; + } + else + { + value << " "; + } + value << "--" << option.name; + if (option.has_arg == required_argument) + { + value << " arg"; + } + std::cerr << std::left << std::setw(30) << value.str() << "\t" << option.description << std::endl; + if (option.defaultValue) + { + std::cerr << "\t\t\t\t\t( " << option.defaultValue << " )" << std::endl; + } + } + std::cerr << std::endl; } - } - std::cerr << std::endl; } - } - void parseGeometry(const std::string & s, std::optional & geometry) - { - std::smatch m; - if (std::regex_match(s, m, std::regex("^(\\d+)x(\\d+)(\\+(\\d+)\\+(\\d+))?$"))) + void parseGeometry(const std::string &s, std::optional &geometry) { - const size_t groups = m.size(); - if (groups == 6) - { - geometry = common2::Geometry(); - geometry->width = std::stoi(m.str(1)); - geometry->height = std::stoi(m.str(2)); - if (!m.str(3).empty()) - { - geometry->x = std::stoi(m.str(4)); - geometry->y = std::stoi(m.str(5)); - } - return; - } + std::smatch m; + if (std::regex_match(s, m, std::regex("^(\\d+)x(\\d+)(\\+(\\d+)\\+(\\d+))?$"))) + { + const size_t groups = m.size(); + if (groups == 6) + { + geometry = common2::Geometry(); + geometry->width = std::stoi(m.str(1)); + geometry->height = std::stoi(m.str(2)); + if (!m.str(3).empty()) + { + geometry->x = std::stoi(m.str(4)); + geometry->y = std::stoi(m.str(5)); + } + return; + } + } + throw std::runtime_error("Invalid sizes: " + s); } - throw std::runtime_error("Invalid sizes: " + s); - } - void extractOptions( - const std::vector>> & data, - std::vector