@@ -648,47 +648,72 @@ static int GetRealTextureOffset_MH(const UTexture2D *Obj, int MipIndex)
648648#include " ../UnrealPackage/UnPackageUE3Reader.h"
649649
650650static bool LoadBulkTextureSMITE (const UTexture2D* texture, const TArray<FTexture2DMipMap> &MipsArray, int MipIndex, bool verbose) {
651+ FMemReader* MemAr = nullptr ;
652+ const FTexture2DMipMap &Mip = MipsArray[MipIndex];
653+
654+ int i;
651655 static char buf[2048 ];
652- texture->GetFullName (ARRAY_ARG (buf), true , true , true );
653- char *s = buf;
654- int len = 0 ;
655- if (verbose) {
656- appPrintf (" Smite: Finding %s (Mip %d) in MergedFileIndexCache\n " , buf, MipIndex);
657- }
658- while (*s) {
659- *s = toupper ((unsigned char ) *s);
660- len++;
661- s++;
656+ for (i = 0 ; i < 4 ; ++i) {
657+ static char tmp[2048 ];
658+ texture->GetFullName (ARRAY_ARG (tmp), true , true , false );
659+ switch (i) {
660+ case 0 :
661+ appSprintf (ARRAY_ARG (buf), " %s" , tmp);
662+ break ;
663+ case 1 :
664+ if (texture->Package == nullptr ) {
665+ continue ;
666+ }
667+ appSprintf (ARRAY_ARG (buf), " %s.%s" , texture->Package ->Name , tmp);
668+ break ;
669+ case 2 :
670+ appSprintf (ARRAY_ARG (buf), " Textures.%s" , tmp);
671+ break ;
672+ case 3 :
673+ if (texture->Package == nullptr ) {
674+ continue ;
675+ }
676+ appSprintf (ARRAY_ARG (buf), " %s.Textures.%s" , texture->Package ->Name , tmp);
677+ break ;
678+ }
679+ char *s = buf;
680+ int len = 0 ;
681+ if (verbose) {
682+ appPrintf (" Smite: Finding %s (Mip %d) in MergedFileIndexCache\n " , buf, MipIndex);
683+ }
684+ while (*s) {
685+ *s = toupper ((unsigned char ) *s);
686+ len++;
687+ s++;
688+ }
689+
690+ MemAr = GetSmiteBlob (buf, len, MipIndex, " tfc" );
691+ if (MemAr != NULL ) {
692+ break ;
693+ }
662694 }
663695
664- const FTexture2DMipMap &Mip = MipsArray[MipIndex];
665- FArchive* Ar = GetSmiteBlob (buf, len, MipIndex, " tfc" );
666- if (Ar == NULL ) {
667- appPrintf (" Smite: unable to find %s (Mip %d) in MergedFileIndexCache\n " , buf, MipIndex);
696+ if (MemAr == NULL ) {
697+ appPrintf (" Smite: unable to find %s (Mip %d) in MergedFileIndexCache\n " , texture->Name , MipIndex);
668698 return false ;
669699 }
670- FArchive* free = Ar;
671700
672701 FCompressedChunkHeader H;
673- *Ar << H;
702+ *MemAr << H;
674703 TArray<FCompressedChunk> Chunks;
675704 FCompressedChunk *Chunk = new (Chunks) FCompressedChunk;
676705 Chunk->UncompressedOffset = 0 ;
677706 Chunk->UncompressedSize = H.Sum .UncompressedSize ;
678707 Chunk->CompressedOffset = 0 ;
679708 Chunk->CompressedSize = H.Sum .CompressedSize ;
680709 FByteBulkData *Bulk = const_cast <FByteBulkData*>(&Mip.Data );
681- int flags = 0 ;
710+ int flags = COMPRESS_LZO ;
682711 if (Bulk->BulkDataFlags & BULKDATA_CompressedOodle_SMITE) flags = COMPRESS_OODLE;
683712 else if (Bulk->BulkDataFlags & BULKDATA_CompressedZlib) flags = COMPRESS_ZLIB;
684- else if (Bulk->BulkDataFlags & BULKDATA_CompressedLzo) flags = COMPRESS_LZO;
685713 else if (Bulk->BulkDataFlags & BULKDATA_CompressedLzx) flags = COMPRESS_LZX;
686714
687- if (flags > 0 ) {
688- FUE3ArchiveReader* UE3Loader = new FUE3ArchiveReader (Ar, flags, Chunks);
689- UE3Loader->IsFullyCompressed = true ;
690- Ar = UE3Loader;
691- }
715+ FUE3ArchiveReader* Ar = new FUE3ArchiveReader (Ar, flags, Chunks);
716+ Ar->IsFullyCompressed = true ;
692717
693718 if (verbose)
694719 {
@@ -703,7 +728,7 @@ static bool LoadBulkTextureSMITE(const UTexture2D* texture, const TArray<FTextur
703728 Bulk->SerializeData (*Ar);
704729 Bulk->BulkDataFlags = backup;
705730
706- reinterpret_cast <FMemReader*>(free) ->Free ();
731+ MemAr ->Free ();
707732 delete Ar;
708733 return true ;
709734}
0 commit comments