Mercurial > mm7
diff VideoPlayer.cpp @ 1810:1bf19913fcdb
Слияние
author | Ritor1 |
---|---|
date | Mon, 07 Oct 2013 15:20:41 +0600 |
parents | 633f81bb3ae7 |
children | 140ca8123384 |
line wrap: on
line diff
--- a/VideoPlayer.cpp Mon Oct 07 15:20:32 2013 +0600 +++ b/VideoPlayer.cpp Mon Oct 07 15:20:41 2013 +0600 @@ -68,7 +68,7 @@ void BinkUnlockBuffer(struct _BINKBUF *_this); //----- (004BFE2D) -------------------------------------------------------- -_BINKBUF *VideoPlayer::CreateBinkBuffer(HWND hWindow, unsigned int uWidth, unsigned int uHeight, char a4) +_BINKBUF *VideoPlayer::CreateBinkBuffer(unsigned int uWidth, unsigned int uHeight, char a4) { __int32 v4; // edi@3 _BINKBUF *v5; // esi@3 @@ -79,14 +79,13 @@ DDSURFACEDESC2 v11; // [sp+Ch] [bp-108h]@7 DDSURFACEDESC Dst; // [sp+88h] [bp-8Ch]@3 unsigned int v13; // [sp+F4h] [bp-20h]@1 - struct tagRECT Rect; // [sp+F8h] [bp-1Ch]@11 + //struct tagRECT Rect; // [sp+F8h] [bp-1Ch]@11 IDirectDrawSurface4 *v15; // [sp+108h] [bp-Ch]@7 IDirectDrawSurface2 *a2; // [sp+10Ch] [bp-8h]@3 - HWND hWnd; // [sp+110h] [bp-4h]@1 v13 = uWidth; - hWnd = hWindow; - if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) + if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || + pVersion->pVersionInfo.dwMajorVersion >= 5u ) { v4 = 0; v15 = 0; @@ -101,6 +100,7 @@ v5 = new _BINKBUF_3_0_0_0; memset(v5, 0, sizeof(_BINKBUF_3_0_0_0)); } + else __debugbreak(); memset(&v11, 0, 0x7Cu); v11.dwSize = 124; @@ -142,6 +142,7 @@ v5 = new _BINKBUF_3_0_0_0; memset(v5, 0, sizeof(_BINKBUF_3_0_0_0)); } + else __debugbreak(); memset(&Dst, 0, 0x6Cu); Dst.dwSize = 108; @@ -170,27 +171,29 @@ v7 = (IDirectDrawSurface *)a2; } v5->pTargetDDrawSurface = v7; - v5->hWnd = hWnd; + v5->hWnd = window->GetApiHandle(); v9 = a4; v5->field_4C = v4; v5->field_68 = v4; v5->field_5C = v4; v5->field_74 = v9 & 0x1F; v5->field_78 = 1; - v5->field_24 = GetSystemMetrics(v4); - v5->field_28 = GetSystemMetrics(SM_CYSCREEN); + v5->target_width = GetSystemMetrics(SM_CXSCREEN); + v5->target_height = GetSystemMetrics(SM_CYSCREEN); v5->field_2C = 16; - GetWindowRect(hWnd, &Rect); - v5->field_8 = Rect.right - Rect.left; - v5->field_C = Rect.bottom - Rect.top; + + RECT Rect; + GetWindowRect(window->GetApiHandle(), &Rect); + v5->field_8 = window->GetWidth(); + v5->field_C = window->GetHeight(); v5->field_1C = Rect.left; v5->field_20 = Rect.top; Rect.left = v4; Rect.top = v4; - ClientToScreen(hWnd, (LPPOINT)&Rect); + ClientToScreen(window->GetApiHandle(), (POINT *)&Rect); v5->field_1C = Rect.left - v5->field_1C; v5->field_20 = Rect.top - v5->field_20; - GetClientRect(hWnd, &Rect); + GetClientRect(window->GetApiHandle(), &Rect); v5->field_30 = v5->field_8 - Rect.right; v5->field_34 = v5->field_C - Rect.bottom; v5->field_8 = v5->uWidth + v5->field_30; @@ -351,7 +354,7 @@ //----- (004BE70E) -------------------------------------------------------- -void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int a4) +void VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int a4) { int v4; // ebp@1 const char *pName; // edi@1 @@ -382,7 +385,7 @@ { if ( pVideoPlayer->pBinkMovie ) { - pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); + pVideoPlayer->BinkDrawFrame(v4, ScreenSizeFlag); while ( pVideoPlayer->pBinkMovie ) { if ( pVideoPlayer->bStopBeforeSchedule ) @@ -400,7 +403,7 @@ if ( !pVideoPlayer->pBinkMovie ) break; if ( !BinkWait(pVideoPlayer->pBinkMovie) && !pVideoPlayer->bStopBeforeSchedule ) - pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); + pVideoPlayer->BinkDrawFrame(v4, ScreenSizeFlag); } } if ( pVideoPlayer->bStopBeforeSchedule == 1 ) @@ -412,7 +415,7 @@ { if ( pVideoPlayer->pSmackerMovie ) { - pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); + pVideoPlayer->SmackDrawFrame(v4, ScreenSizeFlag); while ( pVideoPlayer->pSmackerMovie ) { if ( pVideoPlayer->bStopBeforeSchedule ) @@ -430,7 +433,7 @@ if ( !pVideoPlayer->pSmackerMovie ) break; if ( !SmackWait(pVideoPlayer->pSmackerMovie) && !pVideoPlayer->bStopBeforeSchedule ) - pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag); + pVideoPlayer->SmackDrawFrame(v4, ScreenSizeFlag); } } } @@ -475,10 +478,12 @@ } //----- (004BE9D8) -------------------------------------------------------- -void VideoPlayer::Initialize() +void VideoPlayer::Initialize(OSWindow *target_window) { DWORD NumberOfBytesRead; // [sp+10h] [bp-4h]@9 + window = target_window; + uint uBinkVersionMajor = -1, uBinkVersionMinor = -1; GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor); @@ -524,79 +529,70 @@ //----- (004BEB41) -------------------------------------------------------- void VideoPlayer::Prepare() { - VideoPlayer *pVideoPlayer; // esi@1 - IDirectDrawSurface *v2; // [sp-4h] [bp-Ch]@5 - - pVideoPlayer = this; pEventTimer->Pause(); - pVideoPlayer->bStopBeforeSchedule = 0; if ( pAudioPlayer->hAILRedbook ) AIL_redbook_pause(pAudioPlayer->hAILRedbook); - pVideoPlayer->field_54 = 1; - pVideoPlayer->hWindow = hWnd; - pVideoPlayer->pSmackerMovie = 0; - pVideoPlayer->pSmackerBuffer = 0; - pVideoPlayer->pBinkMovie = 0; - pVideoPlayer->pBinkBuffer = 0; - pVideoPlayer->bPlayingMovie = 0; - pVideoPlayer->bFirstFrame = 0; - pVideoPlayer->bUsingSmackerMMX = SmackUseMMX(1); + + bStopBeforeSchedule = false; + field_54 = 1; + pSmackerMovie = 0; + pSmackerBuffer = 0; + pBinkMovie = 0; + pBinkBuffer = 0; + bPlayingMovie = false; + bFirstFrame = false; + bUsingSmackerMMX = SmackUseMMX(1); BinkSetSoundSystem(BinkOpenMiles, pAudioPlayer->hDigDriver); - if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5 ) - v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer4; + if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5) + uBinkDirectDrawSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)pRenderer->pBackBuffer4); else - v2 = (IDirectDrawSurface*)pRenderer->pBackBuffer2; - pVideoPlayer->uBinkDirectDrawSurfaceType = BinkDDSurfaceType(v2); - _flushall(); + uBinkDirectDrawSurfaceType = BinkDDSurfaceType((IDirectDrawSurface *)pRenderer->pBackBuffer2); } //----- (004BEBD7) -------------------------------------------------------- void VideoPlayer::Unload() { - VideoPlayer *pVideoPlayer; // esi@1 - _BINK *pBinkMovie; // eax@1 - _BINKBUF *pBinkBuffer; // eax@3 - _SMACK *pSmackerMovie; // eax@5 + //_BINK *pBinkMovie; // eax@1 + //_BINKBUF *pBinkBuffer; // eax@3 + //_SMACK *pSmackerMovie; // eax@5 - pVideoPlayer = this; - pBinkMovie = this->pBinkMovie; if ( pBinkMovie ) { BinkPause(pBinkMovie, 1); Sleep(300); - BinkClose(pVideoPlayer->pBinkMovie); - pVideoPlayer->pBinkMovie = 0; + BinkClose(pBinkMovie); + pBinkMovie = 0; } - pBinkBuffer = pVideoPlayer->pBinkBuffer; + if ( pBinkBuffer ) { pBinkBuffer->pTargetDDrawSurface->Release(); - pVideoPlayer->pBinkBuffer->pTargetDDrawSurface = 0; - free(pVideoPlayer->pBinkBuffer); - pVideoPlayer->pBinkBuffer = 0; + pBinkBuffer->pTargetDDrawSurface = 0; + free(pBinkBuffer); + pBinkBuffer = 0; } - pSmackerMovie = pVideoPlayer->pSmackerMovie; + if ( pSmackerMovie ) { SmackSoundOnOff(pSmackerMovie, 0); - SmackClose(pVideoPlayer->pSmackerMovie); - pVideoPlayer->pSmackerMovie = 0; + SmackClose(pSmackerMovie); + pSmackerMovie = 0; } - if ( pVideoPlayer->pSmackerBuffer ) + if ( pSmackerBuffer ) { - SmackBufferClose(pVideoPlayer->pSmackerBuffer); - pVideoPlayer->pSmackerBuffer = 0; + SmackBufferClose(pSmackerBuffer); + pSmackerBuffer = 0; } - if ( pVideoPlayer->pSmackMovieBlit ) + if ( pSmackMovieBlit ) { - SmackBlitClose(pVideoPlayer->pSmackMovieBlit); - pVideoPlayer->pSmackMovieBlit = 0; + SmackBlitClose(pSmackMovieBlit); + pSmackMovieBlit = 0; } - pVideoPlayer->field_54 = 0; - pVideoPlayer->uMovieFormat = 0; - pVideoPlayer->dword_0000A0 = 0; - memset(pVideoPlayer->pCurrentMovieName, 0, 0x40); + field_54 = 0; + uMovieFormat = 0; + dword_0000A0 = 0; + memset(pCurrentMovieName, 0, 0x40); if ( pAudioPlayer->hAILRedbook && !bGameoverLoop ) AIL_redbook_resume(pAudioPlayer->hAILRedbook); pEventTimer->Resume(); @@ -643,7 +639,7 @@ //----- (004BED4F) -------------------------------------------------------- -void VideoPlayer::BinkDrawFrame(HWND hWnd, int a3, int a4) +void VideoPlayer::BinkDrawFrame(int a3, int a4) { //VideoPlayer *v4; // esi@1 _BINKBUF *v5; // eax@5 @@ -712,7 +708,7 @@ //----- (004BEE6B) -------------------------------------------------------- -void VideoPlayer::SmackDrawFrame(HWND hWnd, int a3, int a4) +void VideoPlayer::SmackDrawFrame(int a3, int a4) { VideoPlayer *v4; // esi@1 _SMACK *v5; // eax@3 @@ -733,7 +729,7 @@ unsigned int uPixelsPerRow; // [sp+14h] [bp-4h]@5 v4 = this; - if ( !pRenderer->bWindowMode || GetFocus() == hWnd ) + if ( !pRenderer->bWindowMode || window->Focused()) { v5 = v4->pSmackerMovie; if ( v5->NewPalette ) @@ -749,7 +745,7 @@ { Point.y = 0; Point.x = 0; - ClientToScreen(hWnd, &Point); + ClientToScreen(window->GetApiHandle(), &Point); v17 = -1; v16 = 480; v15 = 640; @@ -774,7 +770,7 @@ { Point.y = 0; Point.x = 0; - ClientToScreen(hWnd, &Point); + ClientToScreen(window->GetApiHandle(), &Point); v8 = SmackToBufferRect(v4->pSmackerMovie, 0); if ( a4 ) { @@ -824,9 +820,28 @@ } } +void VideoPlayer::_inlined_in_463149() +{ + if ( pSmackerMovie && !SmackWait(pSmackerMovie) ) + { + pRenderer->BeginScene(); + pMouse->DrawCursorToTarget(); + SmackUpdatePalette(); + pMouse->_469EA4(); + pRenderer->EndScene(); + } + else if ( pBinkMovie && !BinkWait(pBinkMovie) ) + { + pRenderer->BeginScene(); + pMouse->DrawCursorToTarget(); + BinkUpdatePalette(); + pMouse->_469EA4(); + pRenderer->EndScene(); + } +} //----- (004BF08B) -------------------------------------------------------- -void VideoPlayer::SmackUpdatePalette(HWND hWnd) +void VideoPlayer::SmackUpdatePalette() { VideoPlayer *v2; // esi@1 unsigned __int16 *v3; // ebx@1 @@ -950,7 +965,7 @@ this->uMovieFormat = 1; strcpy(this->pCurrentMovieName, (const char *)pMovieName); this->dword_0000A0 = 1; - this->pSmackerBuffer = (_SMACKBUF *)SmackBufferOpen(this->hWindow, 4, LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height), LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height)); + this->pSmackerBuffer = (_SMACKBUF *)SmackBufferOpen(window->GetApiHandle(), 4, LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height), LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height)); if ( this->pSmackerBuffer ) { pRenderer->BeginScene(); @@ -986,7 +1001,7 @@ pBinkMovie = this->pBinkMovie; this->dword_0000A0 = 1; if ( pBinkMovie ) - this->pBinkBuffer = CreateBinkBuffer(this->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); + this->pBinkBuffer = CreateBinkBuffer(pBinkMovie->uWidth, pBinkMovie->uHeight, 0); } else {