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/core/main.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/core/main.cpp') 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 -- cgit v1.2.3