| 298 | } |
| 299 | |
| 300 | void FileRequestAsync::Start() { |
| 301 | if (file == CACHE_DEFAULT_BITMAP) { |
| 302 | // Embedded asset -> Fire immediately |
| 303 | DownloadDone(true); |
| 304 | return; |
| 305 | } |
| 306 | |
| 307 | if (state == State_Pending) { |
| 308 | return; |
| 309 | } |
| 310 | |
| 311 | if (IsReady()) { |
| 312 | // Fire immediately |
| 313 | DownloadDone(true); |
| 314 | return; |
| 315 | } |
| 316 | |
| 317 | state = State_Pending; |
| 318 | |
| 319 | #ifdef EMSCRIPTEN |
| 320 | std::string request_path; |
| 321 | # ifdef EM_GAME_URL |
| 322 | request_path = EM_GAME_URL; |
| 323 | # else |
| 324 | request_path = "games/"; |
| 325 | # endif |
| 326 | |
| 327 | if (!Player::emscripten_game_name.empty()) { |
| 328 | request_path += Player::emscripten_game_name + "/"; |
| 329 | } else { |
| 330 | request_path += "default/"; |
| 331 | } |
| 332 | |
| 333 | std::string modified_path; |
| 334 | if (index_version >= 2) { |
| 335 | modified_path = lcf::ReaderUtil::Normalize(path); |
| 336 | modified_path = FileFinder::MakeCanonical(modified_path, 1); |
| 337 | } else { |
| 338 | modified_path = Utils::LowerCase(path); |
| 339 | if (directory != ".") { |
| 340 | modified_path = FileFinder::MakeCanonical(modified_path, 1); |
| 341 | } else { |
| 342 | auto it = file_mapping.find(modified_path); |
| 343 | if (it == file_mapping.end()) { |
| 344 | modified_path = FileFinder::MakeCanonical(modified_path, 1); |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | if (graphic && Tr::HasActiveTranslation()) { |
| 350 | std::string modified_path_trans = FileFinder::MakePath(lcf::ReaderUtil::Normalize(Tr::GetCurrentTranslationFilesystem().GetFullPath()), modified_path); |
| 351 | auto it = file_mapping.find(modified_path_trans); |
| 352 | if (it != file_mapping.end()) { |
| 353 | modified_path = modified_path_trans; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | auto it = file_mapping.find(modified_path); |
no test coverage detected