comparison VideoPlayer.cpp @ 185:48f9a1ac8376

Слияние
author Ritor1
date Thu, 20 Dec 2012 09:26:47 +0600
parents 705a6c270835 80201f210d42
children 0a0eb74e8e95
comparison
equal deleted inserted replaced
184:705a6c270835 185:48f9a1ac8376
283 BYTE3(_this->uBinkDDSurfaceType) &= 0x7F; 283 BYTE3(_this->uBinkDDSurfaceType) &= 0x7F;
284 else 284 else
285 BYTE3(_this->uBinkDDSurfaceType) &= 0xFB; 285 BYTE3(_this->uBinkDDSurfaceType) &= 0xFB;
286 } 286 }
287 } 287 }
288
289
290
291
292 //----- (004BF794) -------------------------------------------------------- 288 //----- (004BF794) --------------------------------------------------------
293 void __cdecl ShowIntroVideo_and_LoadingScreen() 289 void __cdecl ShowIntroVideo_and_LoadingScreen()
294 { 290 {
295 RGBTexture tex; // [sp+Ch] [bp-30h]@1 291 RGBTexture tex; // [sp+Ch] [bp-30h]@1
296 unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8 292 unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
462 } 458 }
463 459
464 //----- (004BE9D8) -------------------------------------------------------- 460 //----- (004BE9D8) --------------------------------------------------------
465 void VideoPlayer::Initialize() 461 void VideoPlayer::Initialize()
466 { 462 {
467 //VideoPlayer *v1; // esi@1
468 HANDLE v2; // eax@1
469 char *v3; // ebp@2
470 HANDLE v4; // eax@5
471 HANDLE v5; // eax@7
472 unsigned int v6; // eax@9
473 const char *v7; // [sp-8h] [bp-1Ch]@3
474 char *v8; // [sp-4h] [bp-18h]@2
475 DWORD NumberOfBytesRead; // [sp+10h] [bp-4h]@9 463 DWORD NumberOfBytesRead; // [sp+10h] [bp-4h]@9
476 464
477
478 uint uBinkVersionMajor = -1, 465 uint uBinkVersionMajor = -1,
479 uBinkVersionMinor = -1; 466 uBinkVersionMinor = -1;
480 GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor); 467 GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor);
481 uBinkVersion = (unsigned __int64)uBinkVersionMajor << 32 | uBinkVersionMinor; 468 uBinkVersion = (unsigned __int64)uBinkVersionMajor << 32 | uBinkVersionMinor;
482 469
483
484 //v1 = this;
485 strcpy(pTmpBuf, "anims\\might7.vid"); 470 strcpy(pTmpBuf, "anims\\might7.vid");
486 v2 = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); 471 hMightVid = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
487 hMightVid = v2; 472 if ( hMightVid == INVALID_HANDLE_VALUE )
488 if ( v2 == INVALID_HANDLE_VALUE ) 473 {
489 { 474 sprintf(pTmpBuf2, "Can't open file - anims\\%s.smk", pTmpBuf);
490 v8 = pTmpBuf; 475 MessageBoxA(0, pTmpBuf2, "Video File Error", 0);
491 v3 = pTmpBuf2;
492 LABEL_3:
493 v7 = "Can't open file - anims\\%s.smk";
494 LABEL_4:
495 sprintf(v3, v7, v8);
496 MessageBoxA(0, v3, "Video File Error", 0);
497 return; 476 return;
498 } 477 }
499 strcpy(pTmpBuf, "anims\\magic7.vid"); 478 strcpy(pTmpBuf, "anims\\magic7.vid");
500 v4 = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); 479 hMagicVid = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
501 hMagicVid = v4; 480 if ( hMagicVid == INVALID_HANDLE_VALUE )
502 if ( v4 == INVALID_HANDLE_VALUE ) 481 {
503 {
504 v3 = pTmpBuf2;
505 v8 = pTmpBuf;
506 if ( !bCanLoadFromCD ) 482 if ( !bCanLoadFromCD )
507 goto LABEL_3; 483 {
484 sprintf(pTmpBuf2, "Can't open file - anims\\%s.smk", pTmpBuf);
485 MessageBoxA(0, pTmpBuf2, "Video File Error", 0);
486 return;
487 }
508 sprintf(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf); 488 sprintf(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf);
509 v5 = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); 489 hMagicVid = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
510 hMagicVid = v5; 490 if ( hMagicVid == (HANDLE)INVALID_HANDLE_VALUE )
511 if ( v5 == (HANDLE)INVALID_HANDLE_VALUE ) 491 {
512 { 492 sprintf(pTmpBuf2, "Can't open file - %s", pTmpBuf);
513 v8 = pTmpBuf; 493 MessageBoxA(0, pTmpBuf2, "Video File Error", 0);
514 v7 = "Can't open file - %s"; 494 return;
515 goto LABEL_4; 495 }
516 } 496 }
517 } 497 ReadFile(hMightVid, &uNumMightVideoHeaders, 4, &NumberOfBytesRead, 0);
518 ReadFile(hMightVid, &uNumMightVideoHeaders, 4u, &NumberOfBytesRead, 0); 498 ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4, &NumberOfBytesRead, 0);
519 ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4u, &NumberOfBytesRead, 0);
520 v6 = 44 * uNumMightVideoHeaders + 2;
521 pMagicVideoHeaders = 0; 499 pMagicVideoHeaders = 0;
522 pMightVideoHeaders = 0; 500 pMightVideoHeaders = 0;
523 pMightVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(0, v6, 0); 501 pMightVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(0, 44 * uNumMightVideoHeaders + 2, 0);
524 pMagicVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk( 502 pMagicVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(pMagicVideoHeaders, 44 * uNumMagicVideoHeaders + 2, 0);
525 pMagicVideoHeaders,
526 44 * uNumMagicVideoHeaders + 2,
527 0);
528 ReadFile(hMightVid, pMightVideoHeaders, 44 * uNumMightVideoHeaders, &NumberOfBytesRead, 0); 503 ReadFile(hMightVid, pMightVideoHeaders, 44 * uNumMightVideoHeaders, &NumberOfBytesRead, 0);
529 ReadFile(hMagicVid, pMagicVideoHeaders, 44 * uNumMagicVideoHeaders, &NumberOfBytesRead, 0); 504 ReadFile(hMagicVid, pMagicVideoHeaders, 44 * uNumMagicVideoHeaders, &NumberOfBytesRead, 0);
530 } 505 }
531 506
532 //----- (004BEB41) -------------------------------------------------------- 507 //----- (004BEB41) --------------------------------------------------------
548 v1->pBinkBuffer = 0; 523 v1->pBinkBuffer = 0;
549 v1->bPlayingMovie = 0; 524 v1->bPlayingMovie = 0;
550 v1->bFirstFrame = 0; 525 v1->bFirstFrame = 0;
551 v1->bUsingSmackerMMX = SmackUseMMX(1); 526 v1->bUsingSmackerMMX = SmackUseMMX(1);
552 BinkSetSoundSystem(BinkOpenMiles, pAudioPlayer->hDigDriver); 527 BinkSetSoundSystem(BinkOpenMiles, pAudioPlayer->hDigDriver);
553 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) 528 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5 )
554 v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer4; 529 v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer4;
555 else 530 else
556 v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer2; 531 v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer2;
557 v1->uBinkDirectDrawSurfaceType = BinkDDSurfaceType(v2); 532 v1->uBinkDirectDrawSurfaceType = BinkDDSurfaceType(v2);
558 _flushall(); 533 _flushall();
666 { 641 {
667 BinkDoFrame(pBinkMovie); 642 BinkDoFrame(pBinkMovie);
668 BinkGetRects(pBinkMovie, pBinkBuffer->uBinkDDSurfaceType); 643 BinkGetRects(pBinkMovie, pBinkBuffer->uBinkDDSurfaceType);
669 if ( BinkLockBuffer(pBinkBuffer) ) 644 if ( BinkLockBuffer(pBinkBuffer) )
670 { 645 {
671 BinkCopyToBuffer( 646 BinkCopyToBuffer(pBinkMovie, pBinkBuffer->pDDrawSurfaceData, pBinkBuffer->uDDrawSurfacePitch, pBinkBuffer->uHeight,
672 pBinkMovie, 647 0, 0, pBinkBuffer->uBinkDDSurfaceType);
673 pBinkBuffer->pDDrawSurfaceData,
674 pBinkBuffer->uDDrawSurfacePitch,
675 pBinkBuffer->uHeight,
676 0,
677 0,
678 pBinkBuffer->uBinkDDSurfaceType);
679 BinkUnlockBuffer(pBinkBuffer); 648 BinkUnlockBuffer(pBinkBuffer);
680 } 649 }
681 v5 = pBinkBuffer; 650 v5 = pBinkBuffer;
682 if ( pRenderer->bWindowMode ) 651 if ( pRenderer->bWindowMode )
683 { 652 {
813 else 782 else
814 { 783 {
815 while ( v8 ) 784 while ( v8 )
816 { 785 {
817 v10 = v4->pSmackerMovie; 786 v10 = v4->pSmackerMovie;
818 SmackBlit( 787 SmackBlit(v4->pSmackMovieBlit, pOutSurface, uPixelsPerRow, Point.x + v10->LastRectx, a3 + Point.y + v10->LastRecty,
819 v4->pSmackMovieBlit, 788 v4->pSomeSmackerBuffer, v10->Width, v10->LastRectx, v10->LastRecty, v10->LastRectw, v10->LastRecth);
820 pOutSurface,
821 uPixelsPerRow,
822 Point.x + v10->LastRectx,
823 a3 + Point.y + v10->LastRecty,
824 v4->pSomeSmackerBuffer,
825 v10->Width,
826 v10->LastRectx,
827 v10->LastRecty,
828 v10->LastRectw,
829 v10->LastRecth);
830 v8 = SmackToBufferRect(v4->pSmackerMovie, 0); 789 v8 = SmackToBufferRect(v4->pSmackerMovie, 0);
831 } 790 }
832 } 791 }
833 } 792 }
834 else 793 else
835 { 794 {
836 while ( SmackToBufferRect(v4->pSmackerMovie, 0) ) 795 while ( SmackToBufferRect(v4->pSmackerMovie, 0) )
837 { 796 {
838 v11 = v4->pSmackerMovie; 797 v11 = v4->pSmackerMovie;
839 SmackBlit( 798 SmackBlit(v4->pSmackMovieBlit, pOutSurface, uPixelsPerRow, v11->LastRectx, a3 + v11->LastRecty, v4->pSomeSmackerBuffer,
840 v4->pSmackMovieBlit, 799 v11->Width, v11->LastRectx, v11->LastRecty, v11->LastRectw, v11->LastRecth);
841 pOutSurface,
842 uPixelsPerRow,
843 v11->LastRectx,
844 a3 + v11->LastRecty,
845 v4->pSomeSmackerBuffer,
846 v11->Width,
847 v11->LastRectx,
848 v11->LastRecty,
849 v11->LastRectw,
850 v11->LastRecth);
851 } 800 }
852 } 801 }
853 pRenderer->UnlockFrontBuffer(); 802 pRenderer->UnlockFrontBuffer();
854 if ( v4->pSmackerMovie->FrameNum != v4->pSmackerMovie->Frames - 1 || v4->bLoopPlaying ) 803 if ( v4->pSmackerMovie->FrameNum != v4->pSmackerMovie->Frames - 1 || v4->bLoopPlaying )
855 SmackNextFrame(v4->pSmackerMovie); 804 SmackNextFrame(v4->pSmackerMovie);
942 { 891 {
943 VideoPlayer *pVideoPlayer; // esi@1 892 VideoPlayer *pVideoPlayer; // esi@1
944 signed int v3; // edi@1 893 signed int v3; // edi@1
945 int v4; // ebx@2 894 int v4; // ebx@2
946 signed int v5; // edi@5 895 signed int v5; // edi@5
947 int v6; // ebx@6 896 //int v6; // ebx@6
948 HANDLE v8; // [sp-Ch] [bp-1Ch]@10 897 //HANDLE v8; // [sp-Ch] [bp-1Ch]@10
949 unsigned int v9; // [sp-8h] [bp-18h]@10 898 //unsigned int v9; // [sp-8h] [bp-18h]@10
950 signed int v10; // [sp-4h] [bp-14h]@10 899 //signed int v10; // [sp-4h] [bp-14h]@10
951 900
952 pVideoPlayer = this; 901 pVideoPlayer = this;
953 v3 = 0;
954 if ( (signed int)this->uNumMightVideoHeaders > 0 ) 902 if ( (signed int)this->uNumMightVideoHeaders > 0 )
955 { 903 {
956 v4 = 0; 904 for ( v3 = 0; v3 < (signed int)pVideoPlayer->uNumMightVideoHeaders; ++v3)
957 while ( _strcmpi(pVideoPlayer->pMightVideoHeaders[v4].pVideoName, pFilename) ) 905 {
958 { 906 v4 = _strcmpi(pVideoPlayer->pMightVideoHeaders[v3].pVideoName, pFilename);
959 ++v3; 907 if ( !v4 )
960 ++v4; 908 {
961 if ( v3 >= (signed int)pVideoPlayer->uNumMightVideoHeaders ) 909 SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0);
962 goto LABEL_5; 910 return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1);
963 } 911 }
964 SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); 912 }
965 return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1); 913 }
966 }
967 LABEL_5:
968 v5 = 0; 914 v5 = 0;
969 if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 ) 915 if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 )
970 { 916 {
971 v6 = 0; 917 while ( _strcmpi(pVideoPlayer->pMagicVideoHeaders[v5].pVideoName, pFilename) )
972 while ( _strcmpi(pVideoPlayer->pMagicVideoHeaders[v6].pVideoName, pFilename) )
973 { 918 {
974 ++v5; 919 ++v5;
975 ++v6;
976 if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders ) 920 if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders )
977 return 0; 921 return 0;
978 } 922 }
979 SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0); 923 SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0);
980 v10 = -1; 924 return SmackOpen(pVideoPlayer->hMagicVid, 0x7140, -1);
981 v9 = 0x7140u;
982 v8 = pVideoPlayer->hMagicVid;
983 return SmackOpen(v8, v9, v10);
984 } 925 }
985 return 0; 926 return 0;
986 } 927 }
987 928
988 //----- (004BF28F) -------------------------------------------------------- 929 //----- (004BF28F) --------------------------------------------------------