@@ -648,47 +648,72 @@ static int GetRealTextureOffset_MH(const UTexture2D *Obj, int MipIndex)
648
648
#include " ../UnrealPackage/UnPackageUE3Reader.h"
649
649
650
650
static 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;
651
655
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
+ }
662
694
}
663
695
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);
668
698
return false ;
669
699
}
670
- FArchive* free = Ar;
671
700
672
701
FCompressedChunkHeader H;
673
- *Ar << H;
702
+ *MemAr << H;
674
703
TArray<FCompressedChunk> Chunks;
675
704
FCompressedChunk *Chunk = new (Chunks) FCompressedChunk;
676
705
Chunk->UncompressedOffset = 0 ;
677
706
Chunk->UncompressedSize = H.Sum .UncompressedSize ;
678
707
Chunk->CompressedOffset = 0 ;
679
708
Chunk->CompressedSize = H.Sum .CompressedSize ;
680
709
FByteBulkData *Bulk = const_cast <FByteBulkData*>(&Mip.Data );
681
- int flags = 0 ;
710
+ int flags = COMPRESS_LZO ;
682
711
if (Bulk->BulkDataFlags & BULKDATA_CompressedOodle_SMITE) flags = COMPRESS_OODLE;
683
712
else if (Bulk->BulkDataFlags & BULKDATA_CompressedZlib) flags = COMPRESS_ZLIB;
684
- else if (Bulk->BulkDataFlags & BULKDATA_CompressedLzo) flags = COMPRESS_LZO;
685
713
else if (Bulk->BulkDataFlags & BULKDATA_CompressedLzx) flags = COMPRESS_LZX;
686
714
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 ;
692
717
693
718
if (verbose)
694
719
{
@@ -703,7 +728,7 @@ static bool LoadBulkTextureSMITE(const UTexture2D* texture, const TArray<FTextur
703
728
Bulk->SerializeData (*Ar);
704
729
Bulk->BulkDataFlags = backup;
705
730
706
- reinterpret_cast <FMemReader*>(free) ->Free ();
731
+ MemAr ->Free ();
707
732
delete Ar;
708
733
return true ;
709
734
}
0 commit comments