mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
(RMenu) Remove RMenu screenshot_dump function pointer - implement
screenshot_dump instead for XDK1
This commit is contained in:
parent
1c5144f9bd
commit
ec0e3e6087
@ -3082,8 +3082,6 @@ static int ingame_menu_resize(uint8_t menu_type, uint64_t input)
|
||||
|
||||
static int ingame_menu_screenshot(uint8_t menu_type, uint64_t input)
|
||||
{
|
||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
||||
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_DRAW);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_INGAME))
|
||||
@ -3094,9 +3092,21 @@ static int ingame_menu_screenshot(uint8_t menu_type, uint64_t input)
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_DRAW);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SCREENSHOTS
|
||||
if (input & (1ULL << RMENU_DEVICE_NAV_B))
|
||||
if (device_ptr->ctx_driver->rmenu_screenshot_dump)
|
||||
device_ptr->ctx_driver->rmenu_screenshot_dump(NULL);
|
||||
{
|
||||
const uint16_t *data = (const uint16_t*)g_extern.frame_cache.data;
|
||||
unsigned width = g_extern.frame_cache.width;
|
||||
unsigned height = g_extern.frame_cache.height;
|
||||
int pitch = g_extern.frame_cache.pitch;
|
||||
|
||||
// Negative pitch is needed as screenshot takes bottom-up,
|
||||
// but we use top-down.
|
||||
screenshot_dump(g_settings.screenshot_directory,
|
||||
data + (height - 1) * (pitch >> 1),
|
||||
width, height, -pitch, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -100,11 +100,6 @@ static void rmenu_ctx_ps3_screenshot_enable(bool enable)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rmenu_ctx_ps3_screenshot_dump(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void gfx_ctx_get_available_resolutions (void)
|
||||
{
|
||||
bool defaultresolution;
|
||||
@ -343,7 +338,6 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
|
||||
"ps3",
|
||||
#ifdef HAVE_RMENU
|
||||
rmenu_ctx_ps3_screenshot_enable,
|
||||
rmenu_ctx_ps3_screenshot_dump,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -30,10 +30,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <xgraphics.h>
|
||||
|
||||
#include "../../screenshot.h"
|
||||
|
||||
#include "../fonts/d3d_font.h"
|
||||
|
||||
#if defined(_XBOX1)
|
||||
@ -88,33 +84,6 @@ static void gfx_ctx_xdk_menu_screenshot_enable(bool enable)
|
||||
{
|
||||
}
|
||||
|
||||
static void gfx_ctx_xdk_menu_screenshot_dump(void *data)
|
||||
{
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
HRESULT ret = S_OK;
|
||||
char filename[PATH_MAX];
|
||||
char shotname[PATH_MAX];
|
||||
|
||||
fill_dated_filename(shotname, "bmp", sizeof(shotname));
|
||||
snprintf(filename, sizeof(filename), "%s\\%s", default_paths.screenshots_dir, shotname);
|
||||
|
||||
#if defined(_XBOX1)
|
||||
D3DSurface *surf = NULL;
|
||||
d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &surf);
|
||||
ret = XGWriteSurfaceToFile(surf, filename);
|
||||
surf->Release();
|
||||
#elif defined(_XBOX360)
|
||||
ret = 1; //false
|
||||
//ret = D3DXSaveTextureToFile(filename, D3DXIFF_BMP, d3d->lpTexture, NULL);
|
||||
#endif
|
||||
|
||||
if(ret == S_OK)
|
||||
{
|
||||
RARCH_LOG("Screenshot saved: %s.\n", filename);
|
||||
msg_queue_push(g_extern.msg_queue, "Screenshot saved.", 1, 30);
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_xdk_update_window_title(bool reset) { }
|
||||
|
||||
static void gfx_ctx_xdk_get_video_size(unsigned *width, unsigned *height)
|
||||
@ -260,8 +229,6 @@ static void gfx_ctx_xdk_destroy(void)
|
||||
|
||||
static void gfx_ctx_xdk_input_driver(const input_driver_t **input, void **input_data) { }
|
||||
|
||||
|
||||
|
||||
static bool gfx_ctx_xdk_bind_api(enum gfx_ctx_api api)
|
||||
{
|
||||
#if defined(_XBOX1)
|
||||
@ -302,6 +269,5 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
|
||||
"xdk",
|
||||
#if defined(HAVE_RMENU)
|
||||
gfx_ctx_xdk_menu_screenshot_enable,
|
||||
gfx_ctx_xdk_menu_screenshot_dump,
|
||||
#endif
|
||||
};
|
||||
|
@ -109,7 +109,6 @@ typedef struct gfx_ctx_driver
|
||||
|
||||
#if defined(HAVE_RMENU)
|
||||
void (*rmenu_screenshot_enable)(bool enable);
|
||||
void (*rmenu_screenshot_dump)(void *data);
|
||||
#endif
|
||||
} gfx_ctx_driver_t;
|
||||
|
||||
|
@ -435,7 +435,9 @@ NETPLAY
|
||||
/*============================================================
|
||||
SCREENSHOTS
|
||||
============================================================ */
|
||||
#ifdef HAVE_SCREENSHOTS
|
||||
#if defined(_XBOX1)
|
||||
#include "../xdk/screenshot_xdk1.c"
|
||||
#elif defined(HAVE_SCREENSHOTS)
|
||||
#include "../screenshot.c"
|
||||
#endif
|
||||
|
||||
|
49
xdk/screenshot_xdk1.c
Normal file
49
xdk/screenshot_xdk1.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2013 - 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 "../screenshot.h"
|
||||
|
||||
bool screenshot_dump(const char *folder, const void *frame,
|
||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
||||
{
|
||||
(void)folder;
|
||||
(void)frame;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)pitch;
|
||||
(void)bgr24;
|
||||
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
HRESULT ret = S_OK;
|
||||
char filename[PATH_MAX];
|
||||
char shotname[PATH_MAX];
|
||||
|
||||
fill_dated_filename(shotname, "bmp", sizeof(shotname));
|
||||
snprintf(filename, sizeof(filename), "%s\\%s", default_paths.screenshots_dir, shotname);
|
||||
|
||||
D3DSurface *surf = NULL;
|
||||
d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &surf);
|
||||
ret = XGWriteSurfaceToFile(surf, filename);
|
||||
surf->Release();
|
||||
|
||||
if(ret == S_OK)
|
||||
{
|
||||
RARCH_LOG("Screenshot saved: %s.\n", filename);
|
||||
msg_queue_push(g_extern.msg_queue, "Screenshot saved.", 1, 30);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user