comparison Render.cpp @ 2133:e378232bfd36

screenshot
author Ritor1
date Tue, 31 Dec 2013 16:26:08 +0600
parents 49de109bbab5
children e99081a3a66a
comparison
equal deleted inserted replaced
2132:49de109bbab5 2133:e378232bfd36
2193 //----- (0049EDB6) -------------------------------------------------------- 2193 //----- (0049EDB6) --------------------------------------------------------
2194 void Render::SavePCXScreenshot() 2194 void Render::SavePCXScreenshot()
2195 { 2195 {
2196 int v5; // eax@8 2196 int v5; // eax@8
2197 FILE *pOutFile; // edi@10 2197 FILE *pOutFile; // edi@10
2198 unsigned short * v8; // eax@11 2198 unsigned short *v8; // eax@11
2199 int v9; // eax@13 2199 int v9; // eax@13
2200 int v10; // ecx@15 2200 int v10; // ecx@15
2201 signed int v12; // eax@18 2201 signed int v12; // eax@18
2202 HRESULT v14; // eax@29 2202 HRESULT v14; // eax@29
2203 char v15[56]; // [sp+Ch] [bp-158h]@10 2203 char v15[56]; // [sp+Ch] [bp-158h]@10
2297 { 2297 {
2298 lineG = (char *)lineRGB + pitch; 2298 lineG = (char *)lineRGB + pitch;
2299 lineB = (char *)lineRGB + 2 * pitch; 2299 lineB = (char *)lineRGB + 2 * pitch;
2300 for ( uint x = 0; x < this->field_10; x++ ) 2300 for ( uint x = 0; x < this->field_10; x++ )
2301 { 2301 {
2302 lineRGB[x] = (signed int)(r_mask & *line_picture_data) >> (num_g_bits + num_b_bits + num_r_bits - 8); 2302 int p = *line_picture_data;
2303 lineG[x] = (signed int)(g_mask & *line_picture_data) >> (num_b_bits + num_g_bits - 8); 2303 int for_rad = (pRenderer->uTargetGBits + pRenderer->uTargetBBits );
2304 lineB[x] = (b_mask & *line_picture_data) << (8 - num_b_bits); 2304 int value = (pRenderer->uTargetRMask & *line_picture_data);
2305 int result = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits );
2306 lineRGB[x] = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits );// + pRenderer->uTargetRBits - 8);
2307 lineG[x] = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits);// + pRenderer->uTargetGBits - 8);
2308 int value2 = (pRenderer->uTargetGMask & *line_picture_data);
2309 int result2 = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits);
2310 lineB[x] = (pRenderer->uTargetBMask & *line_picture_data);// << (8 - pRenderer->uTargetBBits);
2305 line_picture_data += 2; 2311 line_picture_data += 2;
2306 } 2312 }
2307 } 2313 }
2308 for ( uint i = 0; i < image_width; i += test_byte ) 2314 for ( uint i = 0; i < image_width; i += test_byte )
2309 { 2315 {
2341 // 4EFA80: using guessed type int dword_4EFA80; 2347 // 4EFA80: using guessed type int dword_4EFA80;
2342 2348
2343 //----- (0049F1BC) -------------------------------------------------------- 2349 //----- (0049F1BC) --------------------------------------------------------
2344 void Render::SaveWinnersCertificate(const char *a1) 2350 void Render::SaveWinnersCertificate(const char *a1)
2345 { 2351 {
2346 Render *v2; // esi@1
2347 __int16 v3; // di@1
2348 int v4; // eax@4
2349 char *v5; // ecx@4
2350 unsigned int v6; // eax@8 2352 unsigned int v6; // eax@8
2351 FILE *v7; // edi@10 2353 //FILE *v7; // edi@10
2352 int v8; // ecx@11 2354 int v8; // ecx@11
2353 int v9; // eax@11 2355 unsigned short *v9; // eax@11
2354 int v10; // eax@13 2356 int v10; // eax@13
2355 const char *v11; // ecx@15
2356 unsigned __int8 v12; // dl@15
2357 signed int v13; // eax@18 2357 signed int v13; // eax@18
2358 char v14; // zf@27 2358 char v14; // zf@27
2359 HRESULT v15; // eax@29 2359 HRESULT v15; // eax@29
2360 char v16; // [sp+Ch] [bp-12Ch]@10 2360 char v16[56]; // [sp+Ch] [bp-12Ch]@10
2361 __int16 v17; // [sp+44h] [bp-F4h]@10 2361 __int16 v17; // [sp+44h] [bp-F4h]@10
2362 int Dst; // [sp+48h] [bp-F0h]@7 2362 DDSURFACEDESC2 Dst; // [sp+48h] [bp-F0h]@7
2363 int v19; // [sp+58h] [bp-E0h]@8 2363 int v19; // [sp+58h] [bp-E0h]@8
2364 unsigned __int16 *v20; // [sp+6Ch] [bp-CCh]@8 2364 unsigned __int16 *v20; // [sp+6Ch] [bp-CCh]@8
2365 char v21; // [sp+C4h] [bp-74h]@10 2365 char color_map[48]; // [sp+C4h] [bp-74h]@10
2366 unsigned int v22; // [sp+F4h] [bp-44h]@11 2366 unsigned int v22; // [sp+F4h] [bp-44h]@11
2367 char *v23; // [sp+F8h] [bp-40h]@14 2367 char *lineB; // [sp+F8h] [bp-40h]@14
2368 int v24; // [sp+FCh] [bp-3Ch]@11 2368 int image_width; // [sp+FCh] [bp-3Ch]@11
2369 int v25; // [sp+100h] [bp-38h]@4 2369 int v25; // [sp+100h] [bp-38h]@4
2370 FILE *File; // [sp+104h] [bp-34h]@3 2370 FILE *File; // [sp+104h] [bp-34h]@3
2371 char Str; // [sp+108h] [bp-30h]@10 2371 char Str; // [sp+108h] [bp-30h]@10
2372 char v28; // [sp+109h] [bp-2Fh]@10 2372 char v28; // [sp+109h] [bp-2Fh]@10
2373 char v29; // [sp+10Ah] [bp-2Eh]@10 2373 char v29; // [sp+10Ah] [bp-2Eh]@10
2380 __int16 v36; // [sp+116h] [bp-22h]@10 2380 __int16 v36; // [sp+116h] [bp-22h]@10
2381 char v37; // [sp+118h] [bp-20h]@10 2381 char v37; // [sp+118h] [bp-20h]@10
2382 char v38; // [sp+119h] [bp-1Fh]@10 2382 char v38; // [sp+119h] [bp-1Fh]@10
2383 __int16 v39; // [sp+11Ah] [bp-1Eh]@10 2383 __int16 v39; // [sp+11Ah] [bp-1Eh]@10
2384 __int16 v40; // [sp+11Ch] [bp-1Ch]@10 2384 __int16 v40; // [sp+11Ch] [bp-1Ch]@10
2385 void *ptr; // [sp+120h] [bp-18h]@10 2385 char *lineRGB; // [sp+120h] [bp-18h]@10
2386 unsigned __int16 *v42; // [sp+124h] [bp-14h]@8 2386 void *surface; // [sp+124h] [bp-14h]@8
2387 int v43; // [sp+128h] [bp-10h]@4 2387 int pitch; // [sp+128h] [bp-10h]@4
2388 char v44; // [sp+12Fh] [bp-9h]@25 2388 char v44; // [sp+12Fh] [bp-9h]@25
2389 char *i; // [sp+130h] [bp-8h]@10 2389 char *lineG; // [sp+130h] [bp-8h]@10
2390 unsigned __int8 v46; // [sp+137h] [bp-1h]@17 2390 unsigned char pict_byte; // [sp+137h] [bp-1h]@17
2391 2391 byte test_byte;
2392 v2 = this; 2392
2393 v3 = 0; 2393 int num_r_bits = 5;
2394 int num_g_bits = 6;
2395 int num_b_bits = 5;
2396
2397 int r_mask = 0xF800;
2398 int g_mask = 0x7E0;
2399 int b_mask = 0x1F;
2400
2394 if ( !this->pRenderD3D || this->using_software_screen_buffer ) 2401 if ( !this->pRenderD3D || this->using_software_screen_buffer )
2395 { 2402 {
2396 ++dword_4EFA84; 2403 ++dword_4EFA84;
2397 File = fopen(a1, "wb"); 2404 File = fopen(a1, "wb");
2398 if ( File ) 2405 if ( File )
2399 { 2406 {
2400 v4 = v2->field_10; 2407 v25 = this->field_10;
2401 v5 = (char *)v2->field_14; 2408 pitch = this->field_10;
2402 v25 = v4; 2409 if ( this->field_10 & 1 )
2403 a1 = v5; 2410 pitch = this->field_10 + 1;
2404 v43 = v4; 2411 if ( this->pRenderD3D )
2405 if ( v4 & 1 ) 2412 {
2406 v43 = v4 + 1; 2413 memset(&Dst, 0, 0x7C);
2407 if ( v2->pRenderD3D ) 2414 Dst.dwSize = 124;
2408 {
2409 memset(&Dst, 0, 0x7Cu);
2410 Dst = 124;
2411 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) ) 2415 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) )
2412 return; 2416 return;
2413 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used 2417 surface = Dst.lpSurface;
2414 v42 = v20; 2418 v6 = Dst.lPitch / 2;
2415 __debugbreak(); // warning C4700: uninitialized local variable 'v19' used
2416 v6 = v19 >> 1;
2417 v3 = 0;
2418 } 2419 }
2419 else 2420 else
2420 { 2421 {
2421 pRenderer->BeginScene(); 2422 pRenderer->BeginScene();
2422 //v42 = pRenderer->pTargetSurface; 2423 surface = pRenderer->pTargetSurface;
2423 v6 = pRenderer->uTargetSurfacePitch; 2424 v6 = pRenderer->uTargetSurfacePitch;
2424 } 2425 }
2425 i = (char *)v6; 2426 v33 = this->field_10 - 1;
2426 v33 = v25 - 1; 2427 v31 = 0;
2427 v31 = v3; 2428 v34 = (short)this->field_14 - 1;
2428 v34 = (short)a1 - 1; 2429 v32 = 0;
2429 v32 = v3; 2430 v39 = pitch;
2430 v39 = v43; 2431 memset(&color_map, 0, sizeof(color_map));
2431 memset(&v21, 0, 0x30u); 2432 memset(&v16, 0, sizeof(v16));
2432 memset(&v16, 0, 0x38u);
2433 v37 = 0; 2433 v37 = 0;
2434 Str = 10; 2434 Str = 10;
2435 v17 = 0; 2435 v17 = 0;
2436 v7 = File;
2437 v28 = 5; 2436 v28 = 5;
2438 v29 = 1; 2437 v29 = 1;
2439 v30 = 8; 2438 v30 = 8;
2440 v35 = 75; 2439 v35 = 75;
2441 v36 = 75; 2440 v36 = 75;
2442 v38 = 3; 2441 v38 = 3;
2443 v40 = 1; 2442 v40 = 1;
2444 fwrite(&Str, 1u, 1u, File); 2443 fwrite(&Str, 1, 1, File);
2445 fwrite(&v28, 1u, 1u, v7); 2444 fwrite(&v28, 1, 1, File);
2446 fwrite(&v29, 1u, 1u, v7); 2445 fwrite(&v29, 1, 1, File);
2447 fwrite(&v30, 1u, 1u, v7); 2446 fwrite(&v30, 1, 1, File);
2448 fwrite(&v31, 2u, 1u, v7); 2447 fwrite(&v31, 2, 1, File);
2449 fwrite(&v32, 2u, 1u, v7); 2448 fwrite(&v32, 2, 1, File);
2450 fwrite(&v33, 2u, 1u, v7); 2449 fwrite(&v33, 2, 1, File);
2451 fwrite(&v34, 2u, 1u, v7); 2450 fwrite(&v34, 2, 1, File);
2452 fwrite(&v35, 2u, 1u, v7); 2451 fwrite(&v35, 2, 1, File);
2453 fwrite(&v36, 2u, 1u, v7); 2452 fwrite(&v36, 2, 1, File);
2454 fwrite(&v21, 0x30u, 1u, v7); 2453 fwrite(&color_map, 0x30, 1, File);
2455 fwrite(&v37, 1u, 1u, v7); 2454 fwrite(&v37, 1, 1, File);
2456 fwrite(&v38, 1u, 1u, v7); 2455 fwrite(&v38, 1, 1, File);
2457 fwrite(&v39, 2u, 1u, v7); 2456 fwrite(&v39, 2, 1, File);
2458 fwrite(&v40, 2u, 1u, v7); 2457 fwrite(&v40, 2, 1, File);
2459 fwrite(&v16, 0x3Au, 1u, v7); 2458 fwrite(&v16, 0x3A, 1, File);
2460 ptr = malloc(3 * v25 + 6); 2459 lineRGB = (char *)malloc(3 * (v25 + 2));
2461 if ( (signed int)a1 > 0 ) 2460 if ( (signed int)this->field_14 > 0 )
2462 { 2461 {
2463 v8 = v43; 2462 image_width = 3 * pitch;
2464 File = (FILE *)a1; 2463 v9 = (unsigned short *)surface;
2465 v24 = 3 * v43; 2464 for ( uint j = 0; j < this->field_14; j++)
2466 v22 = 2 * (int)i;
2467 v9 = (int)v42;
2468 while ( 1 )
2469 { 2465 {
2470 a1 = (const char *)v9; 2466 a1 = (const char *)v9;
2471 v10 = 0;
2472 if ( v25 > 0 ) 2467 if ( v25 > 0 )
2473 { 2468 {
2474 i = (char *)ptr + v8; 2469 lineG = (char *)lineRGB + pitch;
2475 v23 = (char *)ptr + 2 * v43; 2470 lineB = (char *)lineRGB + 2 * pitch;
2476 do 2471 for ( v10 = 0; v10 < v25; v10++ )
2477 { 2472 {
2478 *((char *)ptr + v10) = (signed int)(v2->uTargetRMask & *(short *)a1) >> (LOBYTE(v2->uTargetGBits) 2473 lineRGB[v10] = (signed int)(r_mask & *(short *)a1) >> (num_g_bits + num_b_bits + num_r_bits - 8);
2479 + LOBYTE(v2->uTargetBBits) 2474 lineG[v10] = (signed int)(g_mask & *(short *)a1) >> (num_b_bits + num_g_bits - 8);
2480 + v2->uTargetRBits 2475 lineB[v10] = (b_mask & *(short *)a1) << (8 - num_b_bits);
2481 - 8);
2482 i[v10] = (signed int)(v2->uTargetGMask & *(short *)a1) >> (LOBYTE(v2->uTargetBBits)
2483 + LOBYTE(v2->uTargetGBits)
2484 - 8);
2485 v11 = a1;
2486 v12 = LOBYTE(v2->uTargetBMask);
2487 a1 += 2; 2476 a1 += 2;
2488 v23[v10++] = ((unsigned __int8)*v11 & v12) << (8 - LOBYTE(v2->uTargetBBits));
2489 } 2477 }
2490 while ( v10 < v25 );
2491 } 2478 }
2492 for ( i = 0; (signed int)i < v24; i += BYTE3(a1) ) 2479 for ( uint i = 0; i < image_width; i += test_byte )
2493 { 2480 {
2494 BYTE3(a1) = 1; 2481 pict_byte = lineRGB[i];
2495 v46 = *((char *)ptr + (int)i); 2482 for ( test_byte = 1; test_byte < 0x3F; test_byte )
2496 do
2497 { 2483 {
2498 v13 = (signed int)&i[BYTE3(a1)]; 2484 v13 = i + test_byte;
2499 if ( *((char *)ptr + v13) != v46 ) 2485 if ( lineRGB[v13] != pict_byte )
2500 break; 2486 break;
2501 if ( !(v13 % v43) ) 2487 if ( !(v13 % pitch) )
2502 break; 2488 break;
2503 ++BYTE3(a1);
2504 } 2489 }
2505 while ( BYTE3(a1) < 0x3Fu ); 2490 if ( i + test_byte > image_width )
2506 if ( (signed int)&i[BYTE3(a1)] > v24 ) 2491 test_byte = 3 * pitch - i;
2507 BYTE3(a1) = 3 * v43 - (char)i; 2492 if ( test_byte > 1 || pict_byte >= 0xC0 )
2508 if ( BYTE3(a1) > 1u || v46 >= 0xC0u )
2509 { 2493 {
2510 v44 = BYTE3(a1) | 0xC0; 2494 v44 = test_byte | 0xC0;
2511 fwrite(&v44, 1u, 1u, v7); 2495 fwrite(&v44, 1, 1, File);
2512 } 2496 }
2513 fwrite(&v46, 1u, 1u, v7); 2497 fwrite(&pict_byte, 1, 1, File);
2514 } 2498 }
2515 v9 = (int)&v42[v22 / 2]; 2499 v9 += pitch;
2516 v14 = File == (FILE *)1;
2517 File = (FILE *)((char *)File - 1);
2518 v42 = (unsigned __int16 *)((char *)v42 + v22);
2519 if ( v14 )
2520 break;
2521 v8 = v43;
2522 } 2500 }
2523 } 2501 }
2524 if ( v2->pRenderD3D ) 2502 if ( this->pRenderD3D )
2525 {
2526 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); 2503 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
2527 }
2528 else 2504 else
2529 {
2530 pRenderer->EndScene(); 2505 pRenderer->EndScene();
2531 } 2506 free(lineRGB);
2532 free(ptr); 2507 fclose(File);
2533 fclose(v7);
2534 } 2508 }
2535 } 2509 }
2536 } 2510 }
2537 // 4EFA84: using guessed type int dword_4EFA84; 2511 // 4EFA84: using guessed type int dword_4EFA84;
2538 2512