Renamed mod manifest to mod.json, added display_name, description, short_description fields (#125)

This commit is contained in:
Wiseguy 2025-01-26 21:57:00 -05:00 committed by GitHub
parent 38df8e3ddc
commit b2d07ecd5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 59 additions and 38 deletions

View file

@ -589,6 +589,16 @@ namespace N64Recomp {
return vram >= 0x8F000000 && vram < 0x90000000;
}
// 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) {
@ -604,13 +614,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;
}
}