Renamed mod manifest to mod.json, added display_name, description, short_description fields

This commit is contained in:
Mr-Wiseguy 2025-01-26 19:10:27 -05:00
parent 36b5d9ae33
commit 9a07e135e5
2 changed files with 59 additions and 38 deletions

View file

@ -563,6 +563,16 @@ namespace N64Recomp {
ModSymbolsError parse_mod_symbols(std::span<const char> data, std::span<const uint8_t> binary, const std::unordered_map<uint32_t, uint16_t>& sections_by_vrom, Context& context_out);
std::vector<uint8_t> symbols_to_bin_v1(const Context& mod_context);
// Locale-independent ASCII-only version of isalpha.
inline bool isalpha_nolocale(char c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
// Locale-independent ASCII-only version of isalnum.
inline bool isalnum_nolocale(char c) {
return isalpha_nolocale(c) || (c >= '0' && c <= '9');
}
inline bool validate_mod_id(std::string_view str) {
// Disallow empty ids.
if (str.size() == 0) {
@ -578,13 +588,13 @@ namespace N64Recomp {
// so this is just to prevent "weird" mod ids.
// Check the first character, which must be alphabetical or an underscore.
if (!isalpha(str[0]) && str[0] != '_') {
if (!isalpha_nolocale(str[0]) && str[0] != '_') {
return false;
}
// Check the remaining characters, which can be alphanumeric or underscore.
for (char c : str.substr(1)) {
if (!isalnum(c) && c != '_') {
if (!isalnum_nolocale(c) && c != '_') {
return false;
}
}