Render96 / Render96ex

Fork of https://github.com/sm64-port/sm64-port with additional features.
253 stars 44 forks source link

text-loader refactoring, needed to make DynOS 0.7 compatible #12

Closed PeachyPeachSM64 closed 3 years ago

PeachyPeachSM64 commented 3 years ago

Works the same as before, but now can load a language from multiple files (CHEATER can now have its separate JSON files, instead of modifying the original language files). Fixed some memory leaks and added the "NONE" string (when a string id has no value) as a member or the LanguageEntry struct.

void load_language_file(const char *filename) Load a JSON file from anywhere in the code. The filename must be the absolute or relative path (from the exe) to the JSON file. Note that every JSON file present in the "build/us_pc/res/texts" folder is automatically loaded when launching the game.

void add_key_value_string(struct LanguageEntry *lang, const char *key, const char *value) Add a key/value string from anywhere in the code, for a specified language.

int get_num_languages() Return the number of loaded languages. This value can change if a new language is loaded during runtime.