Question

So I get suck of thoose "flags" and byte operations so here is the assembly code:

loc_4097F5:
   .text:004097F5     cmp     [esi+1Bh], dl
   .text:004097F8     jnz     short loc_409812
   .text:004097FA     cmp     [esi+6], dl
   .text:004097FD     jnz     short loc_409812
   .text:004097FF     mov     ecx, [ebp+490h]
   .text:00409805     test    cl, 2 ; How to represent this????
   .text:00409808     jz      short loc_40980F
   .text:0040980A     test    ch, 1 ; How to represent this????
   .text:0040980D     jz      short loc_409812
   .text:0040980F loc_40980F:                        
   .text:0040980F     mov     [esi+25h], dl
   .text:00409812 loc_409812:                      
   .text:00409812     mov     ecx, [esp+18h+arg_0]
   .text:00409816     cmp     [ecx+8Ch], eax

And here is the pseudocode produced by the decompiler:

v13 = a3->field_454.TextureCaps;
  if ( !(v13 & 2) || BYTE1(v13) & 1 )
    *(_BYTE *)(v5 + 37) = v3;

Any ideas how to represent this for VC++ 6.0 compiler(with this code is compiled)??

EDIT : Actually a3->field_454 is an D3DCAPS9 structure.

Was it helpful?

Solution

Not sure what else you need, other than what's already there in the decompiled version. You can of course look up the TextureCaps flag bits in the d3d headers, to make some more sense of that. I believe this is correct:

if (!(TextureCaps & D3DPTEXTURECAPS_POW2) || (TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))

As such, it's testing to see whether non-power-of-two textures are unconditionally supported or not (the condition evaluates to true if they are not supported). See also the relevant msdn page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top