@@ -678,62 +678,22 @@ function __construct($preloadData, $readSwitch) {
678
678
throw new Exception ('no support ' );
679
679
}
680
680
681
- $ this ->name = $ stream ->readAlignedString ($ stream ->long );
682
- if ($ sourceFile ->version [0 ] > 2017 || ($ sourceFile ->version [0 ] == 2017 && $ sourceFile ->version [1 ] >= 3 )) {
683
- $ stream ->ulong ;
684
- $ stream ->byte ;
685
- $ stream ->alignStream (4 );
686
- }
687
- $ this ->width = $ stream ->long ;
688
- $ this ->height = $ stream ->long ;
689
- $ this ->completeImageSize = $ stream ->long ;
690
- $ this ->textureFormat = $ stream ->long ;
691
-
692
- if ($ sourceFile ->version [0 ] <5 || ($ sourceFile ->version [0 ] == 5 && $ sourceFile ->version [1 ] < 2 )) {
693
- $ this ->mipMap = $ stream ->bool ;
694
- } else {
695
- $ this ->dwFlags += 0x20000 ;
696
- $ this ->dwMipMapCount = $ stream ->long ;
697
- $ this ->dwCaps += 0x400008 ;
698
- }
699
- $ this ->isReadable = $ stream ->bool ;
700
- $ this ->readAllowed = $ stream ->bool ;
701
- $ stream ->alignStream (4 );
702
- if ($ sourceFile ->version [0 ] > 2018 || ($ sourceFile ->version [0 ] == 2018 && $ sourceFile ->version [1 ] >= 2 )) {
703
- $ this ->streamingMipmapsPriority = $ stream ->long ;
704
- }
705
- $ this ->imageCount = $ stream ->long ;
706
- $ this ->textureDimension = $ stream ->long ;
707
- $ this ->filterMode = $ stream ->long ;
708
- $ this ->aniso = $ stream ->long ;
709
- $ this ->MipBias = $ stream ->float ;
710
- $ this ->wrapMode = $ stream ->long ;
711
-
712
- if ($ sourceFile ->version [0 ] >= 2017 ) {
713
- $ stream ->ulong ;
714
- $ stream ->ulong ;
715
- }
716
- if ($ sourceFile ->version [0 ] >= 3 ) {
717
- $ this ->lightmapFormat = $ stream ->long ;
718
- if ($ sourceFile ->version [0 ] >=4 || $ sourceFile ->version [1 ] >= 5 ) {
719
- $ this ->colorSpace = $ stream ->long ;
720
- }
721
- }
722
- $ this ->imageDataSize = $ stream ->long ;
723
- if ($ this ->mipMap ) {
724
- $ this ->dwFlags += 0x20000 ;
725
- //$this->dwMipMapCount = Convert.ToInt32(Math.Log((double)Math.Max(this.m_Width, this.m_Height)) / Math.Log(2.0));
726
- $ this ->dwMipMapCount = log (max ($ this ->width , $ this ->height )) / log (2.0 );
727
- $ this ->dwCaps += 0x400008 ;
728
- }
729
-
730
- if ($ this ->imageDataSize == 0 && (($ sourceFile ->version [0 ] == 5 && $ sourceFile ->version [1 ] >= 3 ) || $ sourceFile ->version [0 ] > 5 )) {
731
- $ this ->offset = $ stream ->ulong ;
732
- $ this ->size = $ stream ->ulong ;
681
+ $ struct = ClassStructHelper::OrganizeStruct (ClassStructHelper::DeserializeStruct ($ stream , $ preloadData ->sourceFile ->ClassStructures [28 ]['members ' ]));
682
+ $ this ->name = $ struct ['m_Name ' ];
683
+ $ this ->width = $ struct ['m_Width ' ];
684
+ $ this ->height = $ struct ['m_Height ' ];
685
+ $ this ->completeImageSize = $ struct ['m_CompleteImageSize ' ];
686
+ $ this ->textureFormat = $ struct ['m_TextureFormat ' ];
687
+ $ this ->imageCount = $ struct ['m_ImageCount ' ];
688
+ $ this ->textureDimension = $ struct ['m_TextureDimension ' ];
689
+ $ this ->imageData = $ struct ['image data ' ];
690
+ $ this ->imageDataSize = strlen ($ this ->imageData );
691
+ if (isset ($ struct ['m_StreamData ' ])) {
692
+ $ this ->offset = $ struct ['m_StreamData ' ]['offset ' ];
693
+ $ this ->size = $ struct ['m_StreamData ' ]['size ' ];
733
694
$ this ->imageDataSize = $ this ->size ;
734
- $ this ->path = $ stream -> readAlignedString ( $ stream -> long ) ;
695
+ $ this ->path = $ struct [ ' m_StreamData ' ][ ' path ' ] ;
735
696
}
736
-
737
697
$ this ->textureFormatStr = TextureFormat::map[$ this ->textureFormat ];
738
698
739
699
if ($ readSwitch ) {
0 commit comments