March 29, 2024, 03:27
bigger smaller reset     1020px Wide width Full width Reset   * *

Gildor's Forums

  Homepage Facebook Read news on Twitter Youtube channel Github page
Welcome, Guest. Please login or register.
Did you miss your activation email?

« previous next »
Print
Author Topic: Extracting xbox textures from mass effect 2 startup.xxx  (Read 9384 times)
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #15 on: February 04, 2016, 21:39 »

I did an attempt to integrate your fix for 32-bit textures. Please try newer UModel. If that will work, I'll submit these changes to GitHub.
Logged
Dybuk
Newbie
*
Posts: 13


View Profile
« Reply #16 on: February 04, 2016, 23:57 »

I did an attempt to integrate your fix for 32-bit textures. Please try newer UModel. If that will work, I'll submit these changes to GitHub.

Yeah that seems to work. I don't think you've pushed to github yet so can't see the actual change. I still need to figure out why the 256x1 textures aren't working though. All appear blank.

A windows update has screwed my vm... waiting on installs.... bloody windows.

Dybuk

Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #17 on: February 05, 2016, 00:25 »

Just pushed my commit as you confirmed that it works.
Logged
Dybuk
Newbie
*
Posts: 13


View Profile
« Reply #18 on: February 05, 2016, 00:57 »

Excellent thanks.

Did you have any thoughts on the 256x1 textures?

There are a lot of things in UnTexture.cpp that look like they are expecting certain sizes for textures to convert them. Again any pointers would be great. If I had to guess at my brief look something not quite working right in UntileCompressedXbox360Texture.

The params that come in are with the height changed to 32 which seems like an odd number for a 256x1 texture. I know you are doing some rearranging of the bytes. I think I'll probably have to read these functions a good few times before I understand what they are actually doing.

UntileCompressedXbox360Texture [ tiledWidth - 256, originalWidth - 256, height - 32, blockSizeX - 1, bytesPerBlock -1 ]

No worries if you don't know.

Dybuk
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #19 on: February 05, 2016, 01:08 »

1. Sorry, I don't have enough time (for months!) to perform research by myself. Just have time to respond emails and do quick fixes - even right now I'm working ... My day is - working, family, working, family, working, sleeping, repeat ... Sometimes sleeping a few times a day - 4+2+1 hours Smiley

2. XBox360 textures has some size alignments. It is AMD hardware-related (as well as "texture tiling" called by some people as "swizzling"). My Untile code was based on GetTiledOffset() function borrowed from XDK, however everything else was written by me just by experimenting. I have no idea how small textures works there, perhaps this is some "special case". Sorry for that. (as far as I know, nobody else has reversed XBox360 texture formats, so there's no other references to look at).

P.S. Thank you for understanding and working on this. You are helping me to make UModel better Smiley
Logged
Dybuk
Newbie
*
Posts: 13


View Profile
« Reply #20 on: February 05, 2016, 13:16 »

Yeah tell me about it Sad... I'm grabbing 30 mins here and there to try to work on this. Hopefully I can get some time over the weekend.

I think the key word I was missing was "swizzling". Googling around I can see several chunks of code and explanations people have given. This should help me compare your code to theirs to see why it isn't working on the small textures.

Moonshine (the guy that started the mod) must have written something to do this previously as I have a few 256x1 textures he imported. Shame he wasn't a sharer Sad

I'll let you know when I make some progress. Thanks for your continued support/time.

Dybuk
« Last Edit: February 05, 2016, 13:27 by Dybuk » Logged
Dybuk
Newbie
*
Posts: 13


View Profile
« Reply #21 on: February 06, 2016, 21:13 »

So .... for reasons I don't understand yet. The textures get passed into the UntileCompressedXbox360Texture as a 256x32 (Rather than a 256x1).

The unswizzling works to a degree. Its just that all the pixels end up on row 16.

Doing something horrible like this afterwards :

   if (USize1 == 256 && myVSize == 32) {
      // 0x4000 is the address of the start of the 16th row.
      memcpy(buf, buf+0x4000, 256*4);
   }

fixes it and I can get the textures I'm interested in.

I'll dig further.

Dybuk
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7978



View Profile WWW
« Reply #22 on: February 06, 2016, 22:37 »

Perhaps vertical alignment should be done in a different direction. I.e. currently, if texture has height H which is smaller than 32 pixels, I'm returning [0..H-1] pixels, but should return [32-H..31] instead. I didn't have a chance to look at small textures.
Logged
Print 
« previous next »
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS