diff Texture.cpp @ 2081:70c45d12d9ca

Merge
author Ritor1
date Wed, 04 Dec 2013 00:45:18 +0600
parents 259df09dfb50
children 400f3db2e4e5
line wrap: on
line diff
--- a/Texture.cpp	Wed Dec 04 00:45:10 2013 +0600
+++ b/Texture.cpp	Wed Dec 04 00:45:18 2013 +0600
@@ -684,6 +684,12 @@
   case 12:  field_1E = 4095; break;
 	  }
 
+  unsigned int r_mask = 0xF800;
+  unsigned int num_r_bits = 5;
+  unsigned int g_mask = 0x07E0;
+  unsigned int num_g_bits = 6;
+  unsigned int b_mask = 0x001F;
+  unsigned int num_b_bits = 5;
  
  read_offset = 128;
  if (psx_head2.planes != 3)
@@ -717,10 +723,7 @@
          ++row_position;
           //*temp_dec_position =0xFF000000;
 		  //*temp_dec_position|=(unsigned long)value<<16;
-         *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits)
-                                                                                    + LOBYTE(pRenderer->uTargetRBits)
-                                                                                    + LOBYTE(pRenderer->uTargetBBits)
-                                                                                    - 8));
+         *temp_dec_position |= r_mask & ((unsigned __int8)value << (num_g_bits + num_r_bits + num_b_bits - 8));
 
 		   temp_dec_position++;
        if (row_position == psx_head2.pitch)
@@ -735,10 +738,7 @@
 	   //*temp_dec_position =0xFF000000; 
 	  //*temp_dec_position|= (unsigned long)test_byte<<16;
        
-       *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits)
-                                                                                    + LOBYTE(pRenderer->uTargetRBits)
-                                                                                    + LOBYTE(pRenderer->uTargetBBits)
-                                                                                    - 8));
+       *temp_dec_position |= r_mask & ((unsigned __int8)test_byte << (num_g_bits + num_r_bits + num_b_bits - 8));
 
        temp_dec_position++;
       }
@@ -766,9 +766,7 @@
         //*temp_dec_position|= (unsigned int)value<<8;
 		//temp_dec_position++;
          
-         *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits)
-                                                                                             + LOBYTE(pRenderer->uTargetBBits)
-                                                                                             - 8));
+         *temp_dec_position|= g_mask & (unsigned __int16)((unsigned __int8)value << (num_g_bits + num_b_bits - 8));
          
        temp_dec_position++;
         ++row_position;
@@ -784,9 +782,7 @@
       //*temp_dec_position |=(unsigned int) test_byte<<8;
 	  //temp_dec_position++;
        
-         *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits)
-                                                                                             + LOBYTE(pRenderer->uTargetBBits)
-                                                                                             - 8));
+         *temp_dec_position|= g_mask & (unsigned __int16)((unsigned __int8)test_byte << (num_g_bits + num_b_bits - 8));
        temp_dec_position++;
       ++row_position;
      }
@@ -811,7 +807,7 @@
         //*temp_dec_position|= value;
 		 //temp_dec_position++;
 
-         *temp_dec_position |= value >> (8 - LOBYTE(pRenderer->uTargetBBits));
+         *temp_dec_position |= value >> (8 - num_b_bits);
        temp_dec_position++;
 
         ++row_position;
@@ -825,7 +821,7 @@
      {
       //*temp_dec_position|= test_byte;
 	   //temp_dec_position++;
-         *temp_dec_position |= test_byte >> (8 - LOBYTE(pRenderer->uTargetBBits));
+         *temp_dec_position |= test_byte >> (8 - num_b_bits);
        temp_dec_position++;
 
       ++row_position;