| 139 | } |
| 140 | |
| 141 | bool CrossPointSettings::migrateLanguageBinaryFile() { |
| 142 | // V1_LANGUAGES / V1_LANGUAGE_COUNT are emitted by gen_i18n.py with the |
| 143 | // frozen enum order from 2f969a9. |
| 144 | if (!Storage.exists(LANG_FILE_BIN)) return false; |
| 145 | |
| 146 | HalFile f; |
| 147 | if (Storage.openFileForRead("CPS", LANG_FILE_BIN, f)) { |
| 148 | uint8_t version; |
| 149 | serialization::readPod(f, version); |
| 150 | if (version == 1) { |
| 151 | uint8_t oldIndex; |
| 152 | serialization::readPod(f, oldIndex); |
| 153 | if (oldIndex < V1_LANGUAGE_COUNT) { |
| 154 | language = static_cast<uint8_t>(V1_LANGUAGES[oldIndex]); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | Storage.rename(LANG_FILE_BIN, LANG_FILE_BAK); |
| 159 | saveToFile(); |
| 160 | LOG_DBG("CPS", "Migrated language.bin into settings.json"); |
| 161 | return true; |
| 162 | } |
| 163 | |
| 164 | bool CrossPointSettings::loadFromBinaryFile() { |
| 165 | HalFile inputFile; |
nothing calls this directly
no test coverage detected