(RMenu) Add screenshot context functions - move more system-specific

code out of RMenu
This commit is contained in:
Twinaphex 2012-08-20 02:45:31 +02:00
parent 72d58954c3
commit 640d63d67c
4 changed files with 55 additions and 22 deletions

View File

@ -14,6 +14,11 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__CELLOS_LV2__)
#include <sdk_version.h>
#include <sysutil/sysutil_screenshot.h>
#endif
#ifdef HAVE_SYSUTILS
#include <cell/sysmodule.h>
#endif
@ -113,6 +118,32 @@ static void rmenu_ctx_ps3_render_menu_enable(bool enable)
gl->menu_render = enable;
}
static void rmenu_ctx_ps3_screenshot_enable(bool enable)
{
#if(CELL_SDK_VERSION > 0x340000)
if(enable)
{
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};
screenshot_param.photo_title = "RetroArch PS3";
screenshot_param.game_title = "RetroArch PS3";
cellScreenShotSetParameter (&screenshot_param);
cellScreenShotEnable();
}
else
{
cellScreenShotDisable();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
}
#endif
}
static void rmenu_ctx_ps3_screenshot_dump(void *data)
{
(void)data;
}
const rmenu_context_t rmenu_ctx_ps3 = {
.clear = rmenu_ctx_ps3_clear,
.blend = rmenu_ctx_ps3_blend,
@ -122,6 +153,8 @@ const rmenu_context_t rmenu_ctx_ps3 = {
.render_bg = rmenu_ctx_ps3_render_bg,
.render_menu_enable = rmenu_ctx_ps3_render_menu_enable,
.render_msg = rmenu_ctx_ps3_render_msg,
.screenshot_enable = rmenu_ctx_ps3_screenshot_enable,
.screenshot_dump = rmenu_ctx_ps3_screenshot_dump,
.swap_buffers = rmenu_ctx_ps3_swap_buffers,
.set_default_pos = rmenu_ctx_ps3_set_default_pos,
};

View File

@ -147,6 +147,15 @@ static void rmenu_ctx_xdk_render_menu_enable(bool enable)
{
}
static void rmenu_ctx_xdk_screenshot_enable(bool enable)
{
}
static void rmenu_ctx_xdk_screenshot_dump(void *data)
{
(void)data;
}
const rmenu_context_t rmenu_ctx_xdk = {
rmenu_ctx_xdk_clear,
rmenu_ctx_xdk_blend,
@ -156,6 +165,8 @@ const rmenu_context_t rmenu_ctx_xdk = {
rmenu_ctx_xdk_render_bg,
rmenu_ctx_xdk_render_menu_enable,
rmenu_ctx_xdk_render_msg,
rmenu_ctx_xdk_screenshot_enable,
rmenu_ctx_xdk_screenshot_dump,
rmenu_ctx_xdk_swap_buffers,
rmenu_ctx_xdk_set_default_pos,
};

View File

@ -16,7 +16,6 @@
#if defined(__CELLOS_LV2__)
#include <sdk_version.h>
#include <sysutil/sysutil_screenshot.h>
#if(CELL_SDK_VERSION > 0x340000)
#include <sysutil/sysutil_bgmplayback.h>
@ -1374,30 +1373,13 @@ static void producesettingentry(menu *current_menu, unsigned switchvalue, uint64
case SETTING_ENABLE_SCREENSHOTS:
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
#if(CELL_SDK_VERSION > 0x340000)
g_console.screenshots_enable = !g_console.screenshots_enable;
if(g_console.screenshots_enable)
{
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};
screenshot_param.photo_title = "RetroArch PS3";
screenshot_param.game_title = "RetroArch PS3";
cellScreenShotSetParameter (&screenshot_param);
cellScreenShotEnable();
}
else
{
cellScreenShotDisable();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
}
#endif
g_console.screenshots_enable = !g_console.screenshots_enable;
context->screenshot_enable(g_console.screenshots_enable);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
#if(CELL_SDK_VERSION > 0x340000)
g_console.screenshots_enable = true;
#endif
g_console.screenshots_enable = true;
context->screenshot_enable(g_console.screenshots_enable);
}
break;
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
@ -2075,6 +2057,11 @@ static void ingame_menu_screenshot(menu *current_menu, uint64_t input)
menu_stack_decrement();
context->render_menu_enable(true);
}
if(input & (1 << RMENU_DEVICE_NAV_B))
{
context->screenshot_dump(NULL);
}
}
}

View File

@ -87,6 +87,8 @@ typedef struct rmenu_context
void (*render_bg)(rmenu_position_t *position);
void (*render_menu_enable)(bool enable);
void (*render_msg)(float xpos, float ypos, float scale, unsigned color, const char *msg, ...);
void (*screenshot_enable)(bool enable);
void (*screenshot_dump)(void *data);
void (*swap_buffers)(void);
void (*set_default_pos)(rmenu_default_positions_t *position);
} rmenu_context_t;