comparison Render.cpp @ 2132:49de109bbab5

SavePCXScreenshot() continue
author Ritor1
date Sun, 29 Dec 2013 01:26:15 +0600
parents 651b24553ae9
children e378232bfd36
comparison
equal deleted inserted replaced
2131:651b24553ae9 2132:49de109bbab5
2191 } 2191 }
2192 2192
2193 //----- (0049EDB6) -------------------------------------------------------- 2193 //----- (0049EDB6) --------------------------------------------------------
2194 void Render::SavePCXScreenshot() 2194 void Render::SavePCXScreenshot()
2195 { 2195 {
2196 Render *v1; // esi@1
2197 __int16 v2; // di@1
2198 int v3; // eax@4
2199 int v4; // ecx@4
2200 int v5; // eax@8 2196 int v5; // eax@8
2201 FILE *v6; // edi@10 2197 FILE *pOutFile; // edi@10
2202 int v7; // ecx@11 2198 unsigned short * v8; // eax@11
2203 int v8; // eax@11
2204 int v9; // eax@13 2199 int v9; // eax@13
2205 int v10; // ecx@15 2200 int v10; // ecx@15
2206 unsigned __int8 v11; // dl@15
2207 signed int v12; // eax@18 2201 signed int v12; // eax@18
2208 char v13; // zf@27
2209 HRESULT v14; // eax@29 2202 HRESULT v14; // eax@29
2210 char v15[56]; // [sp+Ch] [bp-158h]@10 2203 char v15[56]; // [sp+Ch] [bp-158h]@10
2211 __int16 v16; // [sp+44h] [bp-120h]@10
2212 DDSURFACEDESC2 Dst; // [sp+48h] [bp-11Ch]@7 2204 DDSURFACEDESC2 Dst; // [sp+48h] [bp-11Ch]@7
2213 char color_map[48]; // [sp+C4h] [bp-A0h]@10 2205 char color_map[48]; // [sp+C4h] [bp-A0h]@10
2214 char Filename[40]; // [sp+F4h] [bp-70h]@3 2206 char Filename[40]; // [sp+F4h] [bp-70h]@3
2215 char *v20; // [sp+11Ch] [bp-48h]@14 2207 char *lineB; // [sp+11Ch] [bp-48h]@14
2216 char *v21; // [sp+120h] [bp-44h]@14 2208 char *lineG; // [sp+120h] [bp-44h]@14
2217 int v24; // [sp+124h] [bp-40h]@11 2209 //int v24; // [sp+124h] [bp-40h]@11
2218 FILE *File; // [sp+128h] [bp-3Ch]@3 2210 FILE *File; // [sp+128h] [bp-3Ch]@3
2219 int var38; // [sp+12Ch] [bp-38h]@4
2220 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10 2211 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10
2221 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10 2212 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10
2222 void *ptr; // [sp+148h] [bp-1Ch]@10 2213 char *lineRGB; // [sp+148h] [bp-1Ch]@10
2223 void *v28; // [sp+14Ch] [bp-18h]@8 2214 void *surface; // [sp+14Ch] [bp-18h]@8
2224 int v29; // [sp+150h] [bp-14h]@4 2215 int image_width; // [sp+150h] [bp-14h]@4
2225 int v30; // [sp+154h] [bp-10h]@4 2216 int pitch; // [sp+154h] [bp-10h]@4
2226 char v31; // [sp+15Ah] [bp-Ah]@25 2217 char v31; // [sp+15Ah] [bp-Ah]@25
2227 unsigned __int8 v32; // [sp+15Bh] [bp-9h]@17 2218 unsigned char pict_byte; // [sp+15Bh] [bp-9h]@17
2228 int i; // [sp+15Ch] [bp-8h]@10 2219 unsigned short *line_picture_data; // [sp+15Ch] [bp-8h]@10
2229 unsigned __int8 v34; // [sp+163h] [bp-1h]@17 2220 byte test_byte; // [sp+163h] [bp-1h]@17
2230 2221
2231 v1 = this; 2222 int num_r_bits = 5;
2232 v2 = 0; 2223 int num_g_bits = 6;
2224 int num_b_bits = 5;
2225
2226 int r_mask = 0xF800;
2227 int g_mask = 0x7E0;
2228 int b_mask = 0x1F;
2229
2233 if ( !this->pRenderD3D || this->using_software_screen_buffer ) 2230 if ( !this->pRenderD3D || this->using_software_screen_buffer )
2234 { 2231 {
2235 sprintf(Filename, "screen%0.2i.pcx", dword_4EFA80++ % 100); 2232 sprintf(Filename, "screen%0.2i.pcx", ScreenshotFileNumber++ % 100);
2236 File = fopen(Filename, "wb"); 2233 File = fopen(Filename, "wb");
2237 if ( File ) 2234 if ( File )
2238 { 2235 {
2239 v3 = v1->field_10; 2236 pitch = this->field_10;
2240 v4 = v1->field_14; 2237 if ( this->field_10 & 1 )
2241 var38 = v3; 2238 pitch = this->field_10 + 1;
2242 v29 = v4; 2239 if ( this->pRenderD3D )
2243 v30 = v3; 2240 {
2244 if ( v3 & 1 ) 2241 memset(&Dst, 0, 0x7C);
2245 v30 = v3 + 1;
2246 if ( v1->pRenderD3D )
2247 {
2248 memset(&Dst, 0, 0x7Cu);
2249 Dst.dwSize = 124; 2242 Dst.dwSize = 124;
2250 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) 2243 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
2251 return; 2244 return;
2252 v28 = Dst.lpSurface; 2245 surface = Dst.lpSurface;
2253 v5 = Dst.lPitch >> 1; 2246 v5 = Dst.lPitch / 2;
2254 v2 = 0;
2255 } 2247 }
2256 else 2248 else
2257 { 2249 {
2258 pRenderer->BeginScene(); 2250 pRenderer->BeginScene();
2259 v28 = pRenderer->pTargetSurface; 2251 surface = pRenderer->pTargetSurface;
2260 v5 = pRenderer->uTargetSurfacePitch; 2252 v5 = pRenderer->uTargetSurfacePitch;
2261 } 2253 }
2262 i = v5; 2254 header1.right = this->field_10 - 1;
2263 header1.right = var38 - 1; 2255 header1.left = 0;
2264 header1.left = v2; 2256 header1.bottom = this->field_14 - 1;
2265 header1.bottom = v29 - 1; 2257 header1.up = 0;
2266 header1.up = v2; 2258 header2.pitch = pitch;
2267 header2.pitch = v30;
2268 memset(color_map, 0, sizeof(color_map)); 2259 memset(color_map, 0, sizeof(color_map));
2269 memset(v15, 0, sizeof(v15)); 2260 memset(v15, 0, sizeof(v15));
2270 header2.reserved = 0; 2261 header2.reserved = 0;
2271 header1.manufacturer = 10; 2262 header1.manufacturer = 10;
2272 v16 = 0; 2263 pOutFile = File;
2273 v6 = File;
2274 header1.version = 5; 2264 header1.version = 5;
2275 header1.encoding = 1; 2265 header1.encoding = 1;
2276 header1.bpp = 8; 2266 header1.bpp = 8;
2277 header1.hdpi = 75; 2267 header1.hdpi = 75;
2278 header1.vdpi = 75; 2268 header1.vdpi = 75;
2279 header2.planes = 3; 2269 header2.planes = 3;
2280 header2.palette_info = 1; 2270 header2.palette_info = 1;
2281 fwrite(&header1, 1u, 1u, File); 2271 fwrite(&header1, 1, 1, File);
2282 fwrite(&header1.version, 1u, 1u, v6); 2272 fwrite(&header1.version, 1, 1, pOutFile);
2283 fwrite(&header1.encoding, 1u, 1u, v6); 2273 fwrite(&header1.encoding, 1, 1, pOutFile);
2284 fwrite(&header1.bpp, 1u, 1u, v6); 2274 fwrite(&header1.bpp, 1, 1, pOutFile);
2285 fwrite(&header1.left, 2u, 1u, v6); 2275 fwrite(&header1.left, 2, 1, pOutFile);
2286 fwrite(&header1.up, 2u, 1u, v6); 2276 fwrite(&header1.up, 2, 1, pOutFile);
2287 fwrite(&header1.right, 2u, 1u, v6); 2277 fwrite(&header1.right, 2, 1, pOutFile);
2288 fwrite(&header1.bottom, 2u, 1u, v6); 2278 fwrite(&header1.bottom, 2, 1, pOutFile);
2289 fwrite(&header1.hdpi, 2u, 1u, v6); 2279 fwrite(&header1.hdpi, 2, 1, pOutFile);
2290 fwrite(&header1.vdpi, 2u, 1u, v6); 2280 fwrite(&header1.vdpi, 2, 1, pOutFile);
2291 fwrite(color_map, 0x30u, 1u, v6); 2281 fwrite(color_map, 0x30u, 1, pOutFile);
2292 fwrite(&header2, 1u, 1u, v6); 2282 fwrite(&header2, 1, 1, pOutFile);
2293 fwrite(&header2.planes, 1u, 1u, v6); 2283 fwrite(&header2.planes, 1, 1, pOutFile);
2294 fwrite(&header2.pitch, 2u, 1u, v6); 2284 fwrite(&header2.pitch, 2, 1, pOutFile);
2295 fwrite(&header2.palette_info, 2u, 1u, v6); 2285 fwrite(&header2.palette_info, 2, 1, pOutFile);
2296 fwrite(v15, 0x3Au, 1u, v6); 2286 fwrite(v15, 0x3Au, 1, pOutFile);
2297 ptr = malloc(3 * var38 + 6); 2287 lineRGB = (char *)malloc(3 * this->field_10 + 6);
2298 if ( v29 > 0 ) 2288 if ( this->field_14 > 0 )
2299 { 2289 {
2300 v7 = v30; 2290 image_width = 3 * pitch;
2301 File = (FILE *)v29; 2291 //v24 = 2 * v5;
2302 v29 = 3 * v30; 2292 v8 = (unsigned short *)surface;
2303 v24 = 2 * i; 2293 for ( int y = 0; y < this->field_14; y++ )
2304 v8 = (int)v28;
2305 while ( 1 )
2306 { 2294 {
2307 i = v8; 2295 line_picture_data = v8;
2308 v9 = 0; 2296 if ( this->field_10 > 0 )
2309 if ( var38 > 0 )
2310 { 2297 {
2311 v21 = (char *)ptr + v7; 2298 lineG = (char *)lineRGB + pitch;
2312 v20 = (char *)ptr + 2 * v30; 2299 lineB = (char *)lineRGB + 2 * pitch;
2313 do 2300 for ( uint x = 0; x < this->field_10; x++ )
2314 { 2301 {
2315 *((char *)ptr + v9) = (signed int)(v1->uTargetRMask & *(short *)i) >> (LOBYTE(v1->uTargetGBits) 2302 lineRGB[x] = (signed int)(r_mask & *line_picture_data) >> (num_g_bits + num_b_bits + num_r_bits - 8);
2316 + LOBYTE(v1->uTargetBBits) 2303 lineG[x] = (signed int)(g_mask & *line_picture_data) >> (num_b_bits + num_g_bits - 8);
2317 + v1->uTargetRBits 2304 lineB[x] = (b_mask & *line_picture_data) << (8 - num_b_bits);
2318 - 8); 2305 line_picture_data += 2;
2319 v21[v9] = (signed int)(v1->uTargetGMask & *(short *)i) >> (LOBYTE(v1->uTargetBBits)
2320 + LOBYTE(v1->uTargetGBits)
2321 - 8);
2322 v10 = i;
2323 v11 = LOBYTE(v1->uTargetBMask);
2324 i += 2;
2325 v20[v9++] = (*(char *)v10 & v11) << (8 - LOBYTE(v1->uTargetBBits));
2326 } 2306 }
2327 while ( v9 < var38 );
2328 } 2307 }
2329 for ( i = 0; i < v29; i += v34 ) 2308 for ( uint i = 0; i < image_width; i += test_byte )
2330 { 2309 {
2331 v34 = 1; 2310 pict_byte = lineRGB[i];
2332 v32 = *((char *)ptr + i); 2311 for ( test_byte = 1; test_byte < 0x3F; ++test_byte )
2333 do
2334 { 2312 {
2335 v12 = i + v34; 2313 v12 = i + test_byte;
2336 if ( *((char *)ptr + v12) != v32 ) 2314 if ( lineRGB[v12] != pict_byte )
2337 break; 2315 break;
2338 if ( !(v12 % v30) ) 2316 if ( !(v12 % pitch) )
2339 break; 2317 break;
2340 ++v34;
2341 } 2318 }
2342 while ( v34 < 0x3Fu ); 2319 if ( i + test_byte > image_width )
2343 if ( i + v34 > v29 ) 2320 test_byte = 3 * pitch - i;
2344 v34 = 3 * v30 - i; 2321 if ( test_byte > 1 || pict_byte >= 0xC0 )
2345 if ( v34 > 1u || v32 >= 0xC0u )
2346 { 2322 {
2347 v31 = v34 | 0xC0; 2323 v31 = test_byte | 0xC0;
2348 fwrite(&v31, 1u, 1u, v6); 2324 fwrite(&v31, 1, 1, pOutFile);
2349 } 2325 }
2350 fwrite(&v32, 1u, 1u, v6); 2326 fwrite(&pict_byte, 1, 1, pOutFile);
2351 } 2327 }
2352 v8 = (int)((char *)v28 + v24); 2328 v8 += v5;
2353 v13 = File == (FILE *)1;
2354 File = (FILE *)((char *)File - 1);
2355 v28 = (char *)v28 + v24;
2356 if ( v13 )
2357 break;
2358 v7 = v30;
2359 } 2329 }
2360 } 2330 }
2361 if ( v1->pRenderD3D ) 2331 if ( this->pRenderD3D )
2362 {
2363 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); 2332 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
2364 }
2365 else 2333 else
2366 {
2367 pRenderer->EndScene(); 2334 pRenderer->EndScene();
2368 } 2335
2369 2336 free(lineRGB);
2370 free(ptr); 2337 fclose(pOutFile);
2371 fclose(v6);
2372 } 2338 }
2373 } 2339 }
2374 } 2340 }
2375 // 4EFA80: using guessed type int dword_4EFA80; 2341 // 4EFA80: using guessed type int dword_4EFA80;
2376 2342
2593 PCXHeader_2 v27; // [sp+A0h] [bp-18h]@3 2559 PCXHeader_2 v27; // [sp+A0h] [bp-18h]@3
2594 char *lineRGB; // [sp+A8h] [bp-10h]@3 2560 char *lineRGB; // [sp+A8h] [bp-10h]@3
2595 int pitch; // [sp+ACh] [bp-Ch]@1 2561 int pitch; // [sp+ACh] [bp-Ch]@1
2596 char v43; // [sp+B3h] [bp-5h]@18 2562 char v43; // [sp+B3h] [bp-5h]@18
2597 int i; // [sp+B4h] [bp-4h]@6 2563 int i; // [sp+B4h] [bp-4h]@6
2598 unsigned short* line_pictute_data; 2564 unsigned short* line_picture_data;
2599 byte test_byte; 2565 byte test_byte;
2600 unsigned char pict_byte; 2566 unsigned char pict_byte;
2601 2567
2602 int num_r_bits = 5; 2568 int num_r_bits = 5;
2603 int num_g_bits = 6; 2569 int num_g_bits = 6;
2668 v23 = 2 * wight; 2634 v23 = 2 * wight;
2669 v11 = picture_data; 2635 v11 = picture_data;
2670 v24 = (int)picture_data; 2636 v24 = (int)picture_data;
2671 for ( v25 = heidth; v25; v25-- ) 2637 for ( v25 = heidth; v25; v25-- )
2672 { 2638 {
2673 line_pictute_data = v11; 2639 line_picture_data = v11;
2674 if ( wight > 0 ) 2640 if ( wight > 0 )
2675 { 2641 {
2676 lineG = (char *)lineRGB + pitch; 2642 lineG = (char *)lineRGB + pitch;
2677 lineB = (char *)lineRGB + 2 * pitch; 2643 lineB = (char *)lineRGB + 2 * pitch;
2678 for ( uint i = 0; i < wight; i++ ) 2644 for ( uint i = 0; i < wight; i++ )
2679 { 2645 {
2680 lineRGB[i] = (signed int)(r_mask & *line_pictute_data) >> (num_g_bits + num_b_bits + num_r_bits - 8); 2646 lineRGB[i] = (signed int)(r_mask & *line_picture_data) >> (num_g_bits + num_b_bits + num_r_bits - 8);
2681 lineG[i] = (signed int)(g_mask & *line_pictute_data) >> ( num_b_bits + num_g_bits- 8); 2647 lineG[i] = (signed int)(g_mask & *line_picture_data) >> ( num_b_bits + num_g_bits- 8);
2682 lineB[i] = (b_mask & *line_pictute_data) << (8 - num_b_bits); 2648 lineB[i] = (b_mask & *line_picture_data) << (8 - num_b_bits);
2683 line_pictute_data += 1; 2649 line_picture_data += 1;
2684 } 2650 }
2685 } 2651 }
2686 for ( i = 0; i < v26; v9 = (char *)v9 + 1 ) 2652 for ( i = 0; i < v26; v9 = (char *)v9 + 1 )
2687 { 2653 {
2688 pict_byte = lineRGB[i]; 2654 pict_byte = lineRGB[i];
3775 } 3741 }
3776 3742
3777 //----- (004A0EB6) -------------------------------------------------------- 3743 //----- (004A0EB6) --------------------------------------------------------
3778 void Render::ParseTargetPixelFormat() 3744 void Render::ParseTargetPixelFormat()
3779 { 3745 {
3780 Render *v1; // eax@1
3781 signed int v2; // ecx@1 3746 signed int v2; // ecx@1
3782 DWORD uRedMask; // edx@1 3747 DWORD uRedMask; // edx@1
3783 unsigned int uGreenMask; // esi@5 3748 unsigned int uGreenMask; // esi@5
3784 signed int v5; // ecx@5 3749 signed int v5; // ecx@5
3785 unsigned int uBlueMask; // edx@9 3750 unsigned int uBlueMask; // edx@9
3786 signed int v7; // ecx@9 3751 signed int v7; // ecx@9
3787 //unsigned int v8; // ecx@13 3752 //unsigned int v8; // ecx@13
3788 3753
3789 v1 = this;
3790 v2 = 0; 3754 v2 = 0;
3791 uRedMask = v1->ddpfPrimarySuface.dwRBitMask; 3755 uRedMask = this->ddpfPrimarySuface.dwRBitMask;
3792 v1->uTargetBBits = 0; 3756 this->uTargetBBits = 0;
3793 v1->uTargetGBits = 0; 3757 this->uTargetGBits = 0;
3794 v1->uTargetRBits = 0; 3758 this->uTargetRBits = 0;
3795 do 3759 do
3796 { 3760 {
3797 if ( (1 << v2) & uRedMask ) 3761 if ( (1 << v2) & uRedMask )
3798 ++v1->uTargetRBits; 3762 ++this->uTargetRBits;
3799 ++v2; 3763 ++v2;
3800 } 3764 }
3801 while ( v2 < 32 ); 3765 while ( v2 < 32 );
3802 uGreenMask = v1->ddpfPrimarySuface.dwGBitMask; 3766 uGreenMask = this->ddpfPrimarySuface.dwGBitMask;
3803 v5 = 0; 3767 v5 = 0;
3804 do 3768 do
3805 { 3769 {
3806 if ( (1 << v5) & uGreenMask ) 3770 if ( (1 << v5) & uGreenMask )
3807 ++v1->uTargetGBits; 3771 ++this->uTargetGBits;
3808 ++v5; 3772 ++v5;
3809 } 3773 }
3810 while ( v5 < 32 ); 3774 while ( v5 < 32 );
3811 uBlueMask = v1->ddpfPrimarySuface.dwBBitMask; 3775 uBlueMask = this->ddpfPrimarySuface.dwBBitMask;
3812 v7 = 0; 3776 v7 = 0;
3813 do 3777 do
3814 { 3778 {
3815 if ( (1 << v7) & uBlueMask ) 3779 if ( (1 << v7) & uBlueMask )
3816 ++v1->uTargetBBits; 3780 ++this->uTargetBBits;
3817 ++v7; 3781 ++v7;
3818 } 3782 }
3819 while ( v7 < 32 ); 3783 while ( v7 < 32 );
3820 v1->uTargetGMask = uGreenMask; 3784 this->uTargetGMask = uGreenMask;
3821 v1->uTargetRMask = v1->ddpfPrimarySuface.dwRBitMask; 3785 this->uTargetRMask = this->ddpfPrimarySuface.dwRBitMask;
3822 v1->uTargetBMask = uBlueMask; 3786 this->uTargetBMask = uBlueMask;
3823 } 3787 }
3824 3788
3825 //----- (004A0F40) -------------------------------------------------------- 3789 //----- (004A0F40) --------------------------------------------------------
3826 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) 3790 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags)
3827 { 3791 {
3828 IDirectDrawSurface4 *v4; // esi@1 3792 //IDirectDrawSurface4 *v4; // esi@1
3829 HRESULT result; // eax@1 3793 HRESULT result; // eax@1
3830 HRESULT v6; // eax@4 3794 HRESULT v6; // eax@4
3831 int v7; // [sp-8h] [bp-14h]@10 3795 int v7; // [sp-8h] [bp-14h]@10
3832 unsigned int v8; // [sp-4h] [bp-10h]@10 3796 unsigned int v8; // [sp-4h] [bp-10h]@10
3833 char v9; // [sp+Bh] [bp-1h]@1 3797 char v9; // [sp+Bh] [bp-1h]@1
3834 3798
3835 v4 = pSurface; 3799 //v4 = pSurface;
3836 v9 = 1; 3800 v9 = 1;
3837 result = pSurface->Lock(0, pDesc, uLockFlags, 0); 3801 result = pSurface->Lock(0, pDesc, uLockFlags, 0);
3838 if ( result == DDERR_SURFACELOST ) 3802 if ( result == DDERR_SURFACELOST )
3839 { 3803 {
3840 v6 = v4->Restore(); 3804 v6 = pSurface->Restore();
3841 if ( v6 ) 3805 if ( v6 )
3842 { 3806 {
3843 if ( v6 != DDERR_IMPLICITLYCREATED ) 3807 if ( v6 != DDERR_IMPLICITLYCREATED )
3844 { 3808 {
3845 LABEL_20: 3809 LABEL_20:
3846 v9 = 0; 3810 v9 = 0;
3847 result = (bool)memset(pDesc, 0, 4u); 3811 result = (bool)memset(pDesc, 0, 4u);
3848 goto LABEL_21; 3812 goto LABEL_21;
3849 } 3813 }
3850 pRenderer->pFrontBuffer4->Restore(); 3814 pRenderer->pFrontBuffer4->Restore();
3851 v4->Restore(); 3815 pSurface->Restore();
3852 } 3816 }
3853 result = v4->Lock(0, pDesc, DDLOCK_WAIT, 0); 3817 result = pSurface->Lock(0, pDesc, DDLOCK_WAIT, 0);
3854 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) 3818 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY )
3855 goto LABEL_20; 3819 goto LABEL_20;
3856 ErrD3D(result); 3820 ErrD3D(result);
3857 if ( result ) 3821 if ( result )
3858 { 3822 {
4189 } 4153 }
4190 4154
4191 //----- (004A1605) -------------------------------------------------------- 4155 //----- (004A1605) --------------------------------------------------------
4192 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow) 4156 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow)
4193 { 4157 {
4194 Render *v3; // esi@1
4195 signed int v4; // eax@3 4158 signed int v4; // eax@3
4196 4159
4197 v3 = this;
4198 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4160 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
4199 pVersion->pVersionInfo.dwMajorVersion != 4 ) 4161 pVersion->pVersionInfo.dwMajorVersion != 4 )
4200 { 4162 {
4201 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 4163 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3
4202 memset(&pDesc, 0, 0x7Cu); 4164 memset(&pDesc, 0, 0x7Cu);
4203 pDesc.dwSize = 124; 4165 pDesc.dwSize = 124;
4204 LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, DDLOCK_WAIT); 4166 LockSurface_DDraw4(this->pBackBuffer4, &pDesc, DDLOCK_WAIT);
4205 *pOutSurfacePtr = pDesc.lpSurface; 4167 *pOutSurfacePtr = pDesc.lpSurface;
4206 v4 = pDesc.lPitch; 4168 v4 = pDesc.lPitch;
4207 } 4169 }
4208 else 4170 else
4209 { 4171 {
4210 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 4172 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3
4211 memset(&pDesc.lPitch, 0, 0x6Cu); 4173 memset(&pDesc.lPitch, 0, 0x6Cu);
4212 pDesc.lPitch = 108; 4174 pDesc.lPitch = 108;
4213 LockSurface_DDraw2(v3->pBackBuffer2, &pDesc, 1u); 4175 LockSurface_DDraw2(this->pBackBuffer2, &pDesc, 1);
4214 *pOutSurfacePtr = (void *)pDesc.lpSurface; 4176 *pOutSurfacePtr = (void *)pDesc.lpSurface;
4215 v4 = pDesc.dwReserved; 4177 v4 = pDesc.dwReserved;
4216 } 4178 }
4217 *pOutPixelsPerRow = v4 >> 1; 4179 *pOutPixelsPerRow = v4 >> 1;
4218 } 4180 }
4228 } 4190 }
4229 4191
4230 //----- (004A172E) -------------------------------------------------------- 4192 //----- (004A172E) --------------------------------------------------------
4231 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) 4193 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow)
4232 { 4194 {
4233 Render *v3; // esi@1
4234 signed int v4; // eax@3 4195 signed int v4; // eax@3
4235 4196
4236 v3 = this;
4237 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 4197 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
4238 { 4198 {
4239 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 4199 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3
4240 memset(&pDesc, 0, 0x7Cu); 4200 memset(&pDesc, 0, 0x7Cu);
4241 pDesc.dwSize = 124; 4201 pDesc.dwSize = 124;
4242 LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, DDLOCK_WAIT); 4202 LockSurface_DDraw4(this->pFrontBuffer4, &pDesc, DDLOCK_WAIT);
4243 *pOutSurface = pDesc.lpSurface; 4203 *pOutSurface = pDesc.lpSurface;
4244 v4 = pDesc.lPitch; 4204 v4 = pDesc.lPitch;
4245 } 4205 }
4246 else 4206 else
4247 { 4207 {
4248 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 4208 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3
4249 memset(&pDesc.lPitch, 0, 0x6Cu); 4209 memset(&pDesc.lPitch, 0, 0x6Cu);
4250 pDesc.lPitch = 108; 4210 pDesc.lPitch = 108;
4251 LockSurface_DDraw2(v3->pFrontBuffer2, &pDesc, 1u); 4211 LockSurface_DDraw2(this->pFrontBuffer2, &pDesc, 1);
4252 *pOutSurface = (void *)pDesc.lpSurface; 4212 *pOutSurface = (void *)pDesc.lpSurface;
4253 v4 = pDesc.dwReserved; 4213 v4 = pDesc.dwReserved;
4254 } 4214 }
4255 *pOutPixelsPerRow = v4 >> 1; 4215 *pOutPixelsPerRow = v4 >> 1;
4256 } 4216 }