| 1229 | } |
| 1230 | |
| 1231 | void CFileManager::UopReadIndexFile( |
| 1232 | size_t indexMaxCount, |
| 1233 | const std::function<CIndexObject *(int)> &getIdxObj, |
| 1234 | const char *uopFileName, |
| 1235 | int padding, |
| 1236 | const char *extesion, |
| 1237 | CUopMappedFile &uopFile, |
| 1238 | int startIndex) |
| 1239 | { |
| 1240 | astr_t p = uopFileName; |
| 1241 | std::transform(p.begin(), p.end(), p.begin(), ::tolower); |
| 1242 | |
| 1243 | bool isGump = (astr_t("gumpartlegacymul") == p); |
| 1244 | char basePath[100]; |
| 1245 | snprintf(basePath, sizeof(basePath), "build/%s/%%0%ii%s", p.c_str(), padding, extesion); |
| 1246 | |
| 1247 | for (int i = startIndex; i < (int)indexMaxCount; i++) |
| 1248 | { |
| 1249 | char filename[200]; |
| 1250 | snprintf(filename, sizeof(filename), basePath, (int)i); |
| 1251 | |
| 1252 | auto block = uopFile.GetAsset(filename); |
| 1253 | if (block != nullptr) |
| 1254 | { |
| 1255 | CIndexObject *obj = getIdxObj((int)i); |
| 1256 | obj->Address = uintptr_t(uopFile.Start + block->Offset + block->MetadataSize); |
| 1257 | obj->DataSize = block->DecompressedSize; |
| 1258 | obj->UopBlock = block; |
| 1259 | //obj->ID = -1; |
| 1260 | |
| 1261 | if (isGump) |
| 1262 | { |
| 1263 | obj->Address += 8; |
| 1264 | obj->DataSize -= 8; |
| 1265 | |
| 1266 | uopFile.ResetPtr(); |
| 1267 | uopFile.Move(checked_cast<intptr_t>(block->Offset + block->MetadataSize)); |
| 1268 | |
| 1269 | obj->Width = uopFile.ReadUInt32LE(); |
| 1270 | obj->Height = uopFile.ReadUInt32LE(); |
| 1271 | } |
| 1272 | } |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | UopAnimationHeader CFileManager::UopReadAnimationHeader() |
| 1277 | { |