mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Integrate Xbox 1 code in screenshot.c
This commit is contained in:
parent
9a1b258d13
commit
41de3f7114
25
screenshot.c
25
screenshot.c
@ -36,6 +36,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _XBOX1
|
||||||
|
#include <xtl.h>
|
||||||
|
#include <xgraphics.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_DEFLATE
|
#ifdef HAVE_ZLIB_DEFLATE
|
||||||
|
|
||||||
#include <formats/rpng.h>
|
#include <formats/rpng.h>
|
||||||
@ -346,6 +351,7 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||||||
uint8_t *out_buffer = NULL;
|
uint8_t *out_buffer = NULL;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
|
||||||
(void)file;
|
(void)file;
|
||||||
(void)out_buffer;
|
(void)out_buffer;
|
||||||
@ -355,7 +361,24 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||||||
fill_dated_filename(shotname, IMG_EXT, sizeof(shotname));
|
fill_dated_filename(shotname, IMG_EXT, sizeof(shotname));
|
||||||
fill_pathname_join(filename, folder, shotname, sizeof(filename));
|
fill_pathname_join(filename, folder, shotname, sizeof(filename));
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_DEFLATE
|
#ifdef _XBOX1
|
||||||
|
d3d_video_t *d3d = (d3d_video_t*)driver->video_data;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
D3DSurface *surf = NULL;
|
||||||
|
d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &surf);
|
||||||
|
ret = XGWriteSurfaceToFile(surf, filename);
|
||||||
|
surf->Release();
|
||||||
|
|
||||||
|
if(ret == S_OK)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Screenshot saved: %s.\n", filename);
|
||||||
|
rarch_main_msg_queue_push("Screenshot saved.", 1, 30, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = false;
|
||||||
|
#elif defined(HAVE_ZLIB_DEFLATE)
|
||||||
out_buffer = (uint8_t*)malloc(width * height * 3);
|
out_buffer = (uint8_t*)malloc(width * height * 3);
|
||||||
if (!out_buffer)
|
if (!out_buffer)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
|
||||||
*
|
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
||||||
* of the GNU General Public License as published by the Free Software Found-
|
|
||||||
* ation, either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <xtl.h>
|
|
||||||
#include <xgraphics.h>
|
|
||||||
#include <retro_miscellaneous.h>
|
|
||||||
#include "../screenshot.h"
|
|
||||||
#include "../runloop.h"
|
|
||||||
|
|
||||||
bool screenshot_dump(const char *folder, const void *frame,
|
|
||||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
|
||||||
{
|
|
||||||
char filename[PATH_MAX_LENGTH];
|
|
||||||
char shotname[PATH_MAX_LENGTH];
|
|
||||||
HRESULT ret = S_OK;
|
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
d3d_video_t *d3d = (d3d_video_t*)driver->video_data;
|
|
||||||
|
|
||||||
(void)folder;
|
|
||||||
(void)frame;
|
|
||||||
(void)width;
|
|
||||||
(void)height;
|
|
||||||
(void)pitch;
|
|
||||||
(void)bgr24;
|
|
||||||
|
|
||||||
|
|
||||||
fill_dated_filename(shotname, "bmp", sizeof(shotname));
|
|
||||||
snprintf(filename, sizeof(filename), "%s\\%s", settings->screenshot_directory, shotname);
|
|
||||||
|
|
||||||
D3DSurface *surf = NULL;
|
|
||||||
d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &surf);
|
|
||||||
ret = XGWriteSurfaceToFile(surf, filename);
|
|
||||||
surf->Release();
|
|
||||||
|
|
||||||
if(ret == S_OK)
|
|
||||||
{
|
|
||||||
RARCH_LOG("Screenshot saved: %s.\n", filename);
|
|
||||||
rarch_main_msg_queue_push("Screenshot saved.", 1, 30, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user