| 330 | } |
| 331 | |
| 332 | bool ExtractQFS(const std::string &qfs_input, const std::string &output_dir) { |
| 333 | LOG(INFO) << "Extracting QFS file: " << qfs_input << " to " << output_dir; |
| 334 | if (boost::filesystem::exists(output_dir)) { |
| 335 | LOG(INFO) << "Textures already exist at " << output_dir << ". Nothing to extract."; |
| 336 | return true; |
| 337 | } |
| 338 | |
| 339 | boost::filesystem::create_directories(output_dir); |
| 340 | |
| 341 | // Fshtool molests the current working directory, save and restore |
| 342 | char cwd[1024]; |
| 343 | getcwd(cwd, sizeof(cwd)); |
| 344 | |
| 345 | char *args[3] = {const_cast<char *>(""), strdup(qfs_input.c_str()), strdup(output_dir.c_str())}; |
| 346 | int returnCode = (fsh_main(3, args) == 1); |
| 347 | |
| 348 | chdir(cwd); |
| 349 | |
| 350 | return returnCode; |
| 351 | } |
| 352 | |
| 353 | uint32_t abgr1555ToARGB8888(uint16_t abgr1555) { |
| 354 | uint8_t red = static_cast<int>(round((abgr1555 & 0x1F) / 31.0F * 255.0F)); |
no test coverage detected