diff --git a/README.md b/README.md index 40a6230d..31741110 100644 --- a/README.md +++ b/README.md @@ -90,27 +90,6 @@ CONFIG_DEFAULT_ADVPNG=-z4 -i5000 CONFIG_DEFAULT_DEFLOPT=true ``` -## Filename Scheme - -Pokemon sprite filenames are in a 1-to-1 correspondence with the Pokemon's name, for ease of processing. Filenames may be directly substituted in shell commands without escaping. This naming scheme means that some of the filenames in `src/` are a little awkward looking to humans, but it means that no additional data beyond what is encoded in the filesystem is required to determine the correct name for any given Pokémon. - -- Filenames must conform to the POSIX portable filename character set plus tilde, `[0-9a-zA-Z-._~]`. To ensure this, we encode filenames according to the following rules. Characters in `[0-9a-zA-Z-.~]` are left as-is. Spaces are converted to an underscore. Other characters are escaped using two underscores and four hex characters, similar to JavaScript Unicode escapes. (example: `Flabébé` -> `Flabe__0301be__0301`) - - The following JS functions may be useful: - ```javascript - function encode(s) { - return s.replace(/[^0-9a-zA-Z-. ]/g, c => '__' + c.charCodeAt(0).toString(16).padStart(4, '0')).replace(" ", "_"); - } - - function decode(s) { - return s.replace(/__(....)/g, (_, m) => String.fromCharCode(parseInt(m, 16))).replace("_", " "); - } - ``` - -- Pokemon filenames are of the form `---`. Each component has `-` escaped as `~`. (example: `0006-001-Charizard-Mega~X`) - -- Cosmetic female formes are `-Female` instead of `-F`, so that you may distinguish it from Unown. - ## Gotchas - Tup, like Git, tracks files, not directories. If you `readdir()` and forget to declare a dependency it won't catch it, like it would for `read()`. You can work around this by having build tools `stat()` any filenames they acquire.