(XDK) Abstracted screenshot code

(360) Fixed some XUI menu placements
This commit is contained in:
twinaphex 2012-08-21 20:40:13 +02:00
parent 5b196e9b7d
commit 476f5a9fe3
11 changed files with 91 additions and 24 deletions

View File

@ -494,7 +494,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
break;
case MENU_ITEM_SCREENSHOT_MODE:
if (g_console.info_msg_enable)
rarch_settings_msg(S_MSG_NOT_IMPLEMENTED, S_DELAY_180);
gfx_ctx_xdk_screenshot_dump(NULL);
break;
case MENU_ITEM_RESET:
if (g_console.emulator_initialized)
@ -524,6 +524,7 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
retro_get_system_info(&info);
const char *id = info.library_name ? info.library_name : "Unknown";
GetChildById(L"XuiLogo", &m_logoimage);
GetChildById(L"XuiBtnRomBrowser", &m_filebrowser);
GetChildById(L"XuiBtnSettings", &m_settings);
GetChildById(L"XuiBtnQuickMenu", &m_quick_menu);

View File

@ -89,6 +89,7 @@ class CRetroArchMain: public CXuiSceneImpl
CXuiControl m_quit;
CXuiTextElement m_title;
CXuiTextElement m_core;
CXuiControl m_logoimage;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );

View File

@ -8,7 +8,7 @@
<Id>XuiScene1</Id>
<Width>776.000061</Width>
<Height>512.000061</Height>
<Position>200.000015,112.000008,0.000000</Position>
<Position>245.000015,112.000008,0.000000</Position>
<ClassOverride>RetroArchControls</ClassOverride>
</Properties>
<XuiText>
@ -278,6 +278,18 @@ Reset all buttons to default
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>

View File

@ -8,7 +8,7 @@
<Id>XuiSceneFileBrowser</Id>
<Width>1000.000061</Width>
<Height>552.000000</Height>
<Position>118.000031,88.000015,0.000000</Position>
<Position>144.873901,88.000015,0.000000</Position>
<ClassOverride>RetroArchFileBrowser</ClassOverride>
</Properties>
<XuiText>
@ -141,6 +141,18 @@
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>

View File

@ -8,7 +8,7 @@
<Id>XuiScene1</Id>
<Width>824.000061</Width>
<Height>496.000061</Height>
<Position>32.029999,76.040001,0.000000</Position>
<Position>225.521820,110.438545,0.000000</Position>
<ClassOverride>RetroArchQuickMenu</ClassOverride>
</Properties>
<XuiText>
@ -139,6 +139,18 @@ Return to Dashboard
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>

View File

@ -8,7 +8,7 @@
<Id>XuiScene1</Id>
<Width>776.000061</Width>
<Height>512.000061</Height>
<Position>198.000031,112.000023,0.000000</Position>
<Position>238.000031,112.000023,0.000000</Position>
<ClassOverride>RetroArchSettings</ClassOverride>
</Properties>
<XuiText>
@ -224,6 +224,18 @@ Extract ZIP:
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>

View File

@ -154,19 +154,7 @@ static void rmenu_ctx_xdk_screenshot_enable(bool enable)
static void rmenu_ctx_xdk_screenshot_dump(void *data)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
char filename[PATH_MAX];
char shotname[PATH_MAX];
screenshot_generate_filename(shotname, 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);
XGWriteSurfaceToFile(surf, filename);
surf->Release();
msg_queue_push(g_extern.msg_queue, "Screenshot saved.", 1, 30);
gfx_ctx_xdk_screenshot_dump();
}
const rmenu_context_t rmenu_ctx_xdk = {

View File

@ -22,6 +22,7 @@
#include "config.h"
#endif
#include "../../screenshot.h"
#include "xdk_ctx.h"
#if defined(_XBOX1)
@ -144,6 +145,32 @@ void gfx_ctx_set_fbo(bool enable)
d3d->fbo_enabled = enable;
}
void gfx_ctx_xdk_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];
screenshot_generate_filename(shotname, 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 = 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);
}
}
/*============================================================
MISC
TODO: Refactor

View File

@ -29,5 +29,6 @@ void gfx_ctx_set_projection(xdk_d3d_video_t *d3d, const struct gl_ortho *ortho,
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index);
void gfx_ctx_set_overscan(void);
int gfx_ctx_check_resolution(unsigned resolution_id);
void gfx_ctx_xdk_screenshot_dump(void *data);
#endif

View File

@ -113,7 +113,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";%(PreprocessorDefinitions);HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";%(PreprocessorDefinitions);HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO;HAVE_SCREENSHOTS</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -151,7 +151,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;RARCH_CONSOLE;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;RARCH_CONSOLE;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO;HAVE_SCREENSHOTS</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -190,7 +190,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO;HAVE_SCREENSHOTS</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -234,7 +234,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";HAVE_DEFAULT_RETROPAD_INPUT;_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO;HAVE_SCREENSHOTS</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -275,7 +275,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;main=rarch_main;RARCH_CONSOLE=1;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;main=rarch_main;RARCH_CONSOLE=1;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO;HAVE_SCREENSHOTS</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -316,7 +316,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);HAVE_XINPUT2;PACKAGE_VERSION="0.9.7-rc1";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_HDD_CACHE_PARTITION;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9;_XBOX360;HAVE_FBO;HAVE_SCREENSHOTS</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -118,6 +118,7 @@ static void get_environment_settings (void)
strlcpy(default_paths.cache_dir, "cache:\\", sizeof(default_paths.cache_dir));
#endif
strlcpy(default_paths.filesystem_root_dir, "game:\\", sizeof(default_paths.filesystem_root_dir));
strlcpy(default_paths.screenshots_dir, "game:", sizeof(default_paths.screenshots_dir));
strlcpy(default_paths.shader_file, "game:\\media\\shaders\\stock.cg", sizeof(default_paths.shader_file));
strlcpy(default_paths.config_file, "game:\\retroarch.cfg", sizeof(default_paths.config_file));
strlcpy(default_paths.system_dir, "game:\\system\\", sizeof(default_paths.system_dir));