summaryrefslogtreecommitdiffstats
path: root/src/skel
diff options
context:
space:
mode:
Diffstat (limited to 'src/skel')
-rw-r--r--src/skel/glfw/glfw.cpp22
-rw-r--r--src/skel/platform.h1
-rw-r--r--src/skel/skeleton.cpp9
-rw-r--r--src/skel/skeleton.h3
-rw-r--r--src/skel/win/win.cpp30
5 files changed, 62 insertions, 3 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index 9a4f2188..21b5c3c0 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -185,6 +185,22 @@ psCameraShowRaster(RwCamera *camera)
return;
}
+/*
+ *****************************************************************************
+ */
+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;
+}
/*
*****************************************************************************
@@ -213,7 +229,11 @@ double
psTimer(void)
{
struct timespec start;
+#ifdef __linux__
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
+#else
+ clock_gettime(CLOCK_MONOTONIC, &start);
+#endif
return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0;
}
#endif
@@ -1386,7 +1406,7 @@ WinMain(HINSTANCE instance,
RwChar** argv;
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE);
-#if 0
+#if 1
// TODO: make this an option somewhere
AllocConsole();
freopen("CONIN$", "r", stdin);
diff --git a/src/skel/platform.h b/src/skel/platform.h
index 806c0a73..0475d20a 100644
--- a/src/skel/platform.h
+++ b/src/skel/platform.h
@@ -22,6 +22,7 @@ extern void psTerminate(void);
extern void psCameraShowRaster(RwCamera *camera);
extern RwBool psCameraBeginUpdate(RwCamera *camera);
+extern RwImage *psGrabScreen(RwCamera *camera);
extern void psMouseSetPos(RwV2d *pos);
diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp
index 073155d6..99f44fed 100644
--- a/src/skel/skeleton.cpp
+++ b/src/skel/skeleton.cpp
@@ -53,6 +53,15 @@ RsCameraBeginUpdate(RwCamera * camera)
/*
*****************************************************************************
*/
+RwImage*
+RsGrabScreen(RwCamera *camera)
+{
+ return psGrabScreen(camera);
+}
+
+/*
+ *****************************************************************************
+ */
RwBool
RsRegisterImageLoader(void)
{
diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h
index b5ea5abf..1c468179 100644
--- a/src/skel/skeleton.h
+++ b/src/skel/skeleton.h
@@ -274,6 +274,9 @@ RsCameraBeginUpdate(RwCamera *camera);
//extern void
//RsMouseSetVisibility(RwBool visible);
+extern RwImage*
+RsGrabScreen(RwCamera *camera);
+
extern void
RsMouseSetPos(RwV2d *pos);
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index 75a3a7c9..cc106e39 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -245,6 +245,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;
+}
+
+/*
+ *****************************************************************************
+ */
RwUInt32
psTimer(void)
{
@@ -1593,7 +1610,9 @@ psSelectDevice()
PSGLOBAL(fullScreen) = FALSE;
#endif
}
-
+#ifdef MULTISAMPLING
+ RwD3D8EngineSetMultiSamplingLevels(1 << FrontEndMenuManager.m_nPrefsMSAALevel);
+#endif
return TRUE;
}
@@ -1863,7 +1882,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,
@@ -2233,9 +2256,10 @@ WinMain(HINSTANCE instance,
case GS_INIT_INTRO_MPEG:
{
+#ifndef NO_MOVIES
CloseClip();
-
CoUninitialize();
+#endif
if ( FrontEndMenuManager.OS_Language == LANG_FRENCH || FrontEndMenuManager.OS_Language == LANG_GERMAN )
PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg");
@@ -2269,8 +2293,10 @@ WinMain(HINSTANCE instance,
case GS_INIT_ONCE:
{
+#ifndef NO_MOVIES
CloseClip();
CoUninitialize();
+#endif
#ifdef FIX_BUGS
// draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on