| 1052 | namespace fs = fs; |
| 1053 | |
| 1054 | static void dumpLofTemps(fs::path basePath, const UString &prefix) |
| 1055 | { |
| 1056 | auto tabFileName = prefix + ".tab"; |
| 1057 | auto datFileName = prefix + ".dat"; |
| 1058 | |
| 1059 | LogWarning("Reading LOFTEMPS \"%s\"", prefix); |
| 1060 | size_t tabSize = 0; |
| 1061 | { |
| 1062 | auto tabFile = fw().data->fs.open(tabFileName); |
| 1063 | if (!tabFile) |
| 1064 | { |
| 1065 | LogError("Failed to open LOFTEMPS tab \"%s\"", tabFileName); |
| 1066 | return; |
| 1067 | } |
| 1068 | tabSize = tabFile.size(); |
| 1069 | } |
| 1070 | auto count = tabSize / 4; |
| 1071 | |
| 1072 | auto outPath = basePath / prefix.str(); |
| 1073 | fs::create_directories(outPath); |
| 1074 | |
| 1075 | for (size_t i = 0; i < count; i++) |
| 1076 | { |
| 1077 | auto imgPath = format("LOFTEMPS:%s:%s:%u", datFileName, tabFileName, (unsigned)i); |
| 1078 | auto img = fw().data->loadImage(imgPath); |
| 1079 | if (!img) |
| 1080 | { |
| 1081 | LogError("Failed to load \"%s\"", imgPath); |
| 1082 | return; |
| 1083 | } |
| 1084 | auto outName = format("%u.png", (unsigned)i); |
| 1085 | auto filePath = outPath / outName.str(); |
| 1086 | fw().data->writeImage(filePath.native(), img); |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | static void dumpRaw(fs::path outDir, const RawImage &i) |
| 1091 | { |