From ce0633a0c2370ad0e075ca5ae0a65bc7061cc65d Mon Sep 17 00:00:00 2001 From: withmorten Date: Fri, 7 Aug 2020 18:21:05 +0200 Subject: remove CoUninitialize calls for FIX_BUGS (fixes PIX crash) and don't check return value for CoInitialize --- src/skel/win/win.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/skel/win') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 5c5c7ece..6d44ce80 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1851,7 +1851,11 @@ void PlayMovieInWindow(int cmdShow, const char* szFile) MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1); // Initialize COM +#ifdef FIX_BUGS // will also return S_FALSE if it has already been inited in the same thread + CoInitialize(nil); +#else JIF(CoInitialize(nil)); +#endif // Get the interface for DirectShow's GraphBuilder JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, @@ -2225,7 +2229,9 @@ WinMain(HINSTANCE instance, { CloseClip(); - CoUninitialize(); +#ifndef FIX_BUGS + CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter +#endif if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg"); @@ -2260,7 +2266,9 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { CloseClip(); - CoUninitialize(); +#ifndef FIX_BUGS + CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter +#endif #ifdef FIX_BUGS // draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on -- cgit v1.2.3 From 24a1644b2a1f4cd0b20385fd29acd7be9808e027 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 8 Aug 2020 17:12:23 +0200 Subject: don't CoUninitialize for NO_MOVIES --- src/skel/win/win.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/skel/win') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 6d44ce80..cf4749b1 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2227,10 +2227,9 @@ WinMain(HINSTANCE instance, case GS_INIT_INTRO_MPEG: { +#ifndef NO_MOVIES CloseClip(); - -#ifndef FIX_BUGS - CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter + CoUninitialize(); #endif if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) @@ -2265,9 +2264,9 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { +#ifndef NO_MOVIES CloseClip(); -#ifndef FIX_BUGS - CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter + CoUninitialize(); #endif #ifdef FIX_BUGS -- cgit v1.2.3 From e7945625b59750459ff4876f7e076b4b8d5c3aee Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 14 Aug 2020 18:57:23 +0300 Subject: Original screen grabber --- src/skel/win/win.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/skel/win') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index cf4749b1..a064788c 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -238,6 +238,23 @@ psCameraShowRaster(RwCamera *camera) } +/* + ***************************************************************************** + */ +RwImage * +psGrabScreen(RwCamera *pCamera) +{ +#ifndef LIBRW + RwRaster *pRaster = RwCameraGetRaster(pCamera); + if (RwImage *pImage = RwImageCreate(pRaster->width, pRaster->height, 32)) { + RwImageAllocatePixels(pImage); + RwImageSetFromRaster(pImage, pRaster); + return pImage; + } +#endif + return nil; +} + /* ***************************************************************************** */ -- cgit v1.2.3