summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/FileMgr.h1
-rw-r--r--src/core/main.cpp38
-rw-r--r--src/skel/glfw/glfw.cpp16
-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.cpp17
7 files changed, 85 insertions, 0 deletions
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index 0ad9daa7..4734720e 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -19,4 +19,5 @@ public:
static bool ReadLine(int fd, char *buf, int len);
static int CloseFile(int fd);
static int GetErrorReadWrite(int fd);
+ static char *GetRootDirName() { return ms_rootDirName; }
};
diff --git a/src/core/main.cpp b/src/core/main.cpp
index b63688ec..8458a248 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -2,6 +2,7 @@
#include "rpmatfx.h"
#include "rphanim.h"
#include "rpskin.h"
+#include "rtbmp.h"
#include "main.h"
#include "CdStream.h"
@@ -61,6 +62,7 @@
#include "MemoryCard.h"
#include "SceneEdit.h"
#include "debugmenu.h"
+#include "Clock.h"
GlobalScene Scene;
@@ -288,6 +290,28 @@ DoFade(void)
}
}
+bool
+RwGrabScreen(RwCamera *camera, RwChar *filename)
+{
+ char temp[255];
+ RwImage *pImage = RsGrabScreen(camera);
+ bool result = true;
+
+ if (pImage == nil)
+ return false;
+
+ strcpy(temp, CFileMgr::GetRootDirName());
+ strcat(temp, filename);
+
+ if (RtBMPImageWrite(pImage, &temp[0]) == nil)
+ result = false;
+ RwImageDestroy(pImage);
+ return result;
+}
+
+#define TILE_WIDTH 576
+#define TILE_HEIGHT 432
+
void
DoRWStuffEndOfFrame(void)
{
@@ -296,6 +320,20 @@ DoRWStuffEndOfFrame(void)
FlushObrsPrintfs();
RwCameraEndUpdate(Scene.camera);
RsCameraShowRaster(Scene.camera);
+#ifndef MASTER
+ char s[48];
+ if (CPad::GetPad(1)->GetLeftShockJustDown()) {
+ // try using both controllers for this thing... crazy bastards
+ if (CPad::GetPad(0)->GetRightStickY() > 0) {
+ sprintf(s, "screen%d%d.ras", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
+ // TODO
+ //RtTileRender(Scene.camera, TILE_WIDTH * 2, TILE_HEIGHT * 2, TILE_WIDTH, TILE_HEIGHT, &NewTileRendererCB, nil, s);
+ } else {
+ sprintf(s, "screen%d%d.bmp", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
+ RwGrabScreen(Scene.camera, s);
+ }
+ }
+#endif // !MASTER
}
static RwBool
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index ed442348..920bb8a9 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -181,6 +181,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;
+}
/*
*****************************************************************************
diff --git a/src/skel/platform.h b/src/skel/platform.h
index 0f314b9d..c9a8a11f 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 8191107e..4780316a 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 cf4749b1..a064788c 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -241,6 +241,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)
{