mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 17:43:02 +00:00
(RGUI) add screenshot command
(GX) general cleanups, change joystick threshold
This commit is contained in:
parent
35c223fb12
commit
83c51f136a
@ -304,6 +304,7 @@ MENU
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RGUI
|
#ifdef HAVE_RGUI
|
||||||
|
#include "../../screenshot.c"
|
||||||
#include "../rgui/rgui.c"
|
#include "../rgui/rgui.c"
|
||||||
#include "../rgui/list.c"
|
#include "../rgui/list.c"
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "rgui.h"
|
#include "rgui.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "../rarch_console_video.h"
|
#include "../rarch_console_video.h"
|
||||||
|
#include "../../screenshot.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -32,8 +33,6 @@
|
|||||||
#define TERM_WIDTH (((RGUI_WIDTH - TERM_START_X - 15) / (FONT_WIDTH_STRIDE)))
|
#define TERM_WIDTH (((RGUI_WIDTH - TERM_START_X - 15) / (FONT_WIDTH_STRIDE)))
|
||||||
#define TERM_HEIGHT (((RGUI_HEIGHT - TERM_START_Y - 15) / (FONT_HEIGHT_STRIDE)) - 1)
|
#define TERM_HEIGHT (((RGUI_HEIGHT - TERM_START_Y - 15) / (FONT_HEIGHT_STRIDE)) - 1)
|
||||||
|
|
||||||
extern char app_dir[PATH_MAX];
|
|
||||||
|
|
||||||
struct rgui_handle
|
struct rgui_handle
|
||||||
{
|
{
|
||||||
uint32_t *frame_buf;
|
uint32_t *frame_buf;
|
||||||
@ -421,6 +420,23 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
rarch_settings_change(S_RETURN_TO_GAME);
|
rarch_settings_change(S_RETURN_TO_GAME);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RGUI_SETTINGS_SCREENSHOT:
|
||||||
|
if (action == RGUI_ACTION_OK)
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
bool r = screenshot_dump(default_paths.savestate_dir,
|
||||||
|
data + (height - 1) * (pitch >> 1),
|
||||||
|
width, height, -pitch, false);
|
||||||
|
|
||||||
|
msg_queue_push(g_extern.msg_queue, r ? "Screenshot saved" : "Screenshot failed to save", 1, S_DELAY_90);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case RGUI_SETTINGS_VIDEO_FILTER:
|
case RGUI_SETTINGS_VIDEO_FILTER:
|
||||||
if (action == RGUI_ACTION_START)
|
if (action == RGUI_ACTION_START)
|
||||||
rarch_settings_default(S_DEF_HW_TEXTURE_FILTER);
|
rarch_settings_default(S_DEF_HW_TEXTURE_FILTER);
|
||||||
@ -577,6 +593,7 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
|
|||||||
RGUI_MENU_ITEM("Savestate Slot", RGUI_SETTINGS_SAVESTATE_SLOT);
|
RGUI_MENU_ITEM("Savestate Slot", RGUI_SETTINGS_SAVESTATE_SLOT);
|
||||||
RGUI_MENU_ITEM("Save State", RGUI_SETTINGS_SAVESTATE_SAVE);
|
RGUI_MENU_ITEM("Save State", RGUI_SETTINGS_SAVESTATE_SAVE);
|
||||||
RGUI_MENU_ITEM("Load State", RGUI_SETTINGS_SAVESTATE_LOAD);
|
RGUI_MENU_ITEM("Load State", RGUI_SETTINGS_SAVESTATE_LOAD);
|
||||||
|
RGUI_MENU_ITEM("Take Screenshot", RGUI_SETTINGS_SCREENSHOT);
|
||||||
}
|
}
|
||||||
RGUI_MENU_ITEM("Hardware filtering", RGUI_SETTINGS_VIDEO_FILTER);
|
RGUI_MENU_ITEM("Hardware filtering", RGUI_SETTINGS_VIDEO_FILTER);
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -624,7 +641,7 @@ static const char *rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t acti
|
|||||||
const char *label = 0;
|
const char *label = 0;
|
||||||
rgui_list_at(rgui->folder_buf, rgui->directory_ptr, &label, &type, NULL);
|
rgui_list_at(rgui->folder_buf, rgui->directory_ptr, &label, &type, NULL);
|
||||||
if (type == RGUI_SETTINGS_CORE)
|
if (type == RGUI_SETTINGS_CORE)
|
||||||
label = app_dir;
|
label = default_paths.port_dir;
|
||||||
const char *dir = 0;
|
const char *dir = 0;
|
||||||
rgui_file_type_t menu_type = 0;
|
rgui_file_type_t menu_type = 0;
|
||||||
size_t directory_ptr = 0;
|
size_t directory_ptr = 0;
|
||||||
|
@ -36,6 +36,7 @@ typedef enum
|
|||||||
RGUI_SETTINGS_SAVESTATE_SLOT,
|
RGUI_SETTINGS_SAVESTATE_SLOT,
|
||||||
RGUI_SETTINGS_SAVESTATE_SAVE,
|
RGUI_SETTINGS_SAVESTATE_SAVE,
|
||||||
RGUI_SETTINGS_SAVESTATE_LOAD,
|
RGUI_SETTINGS_SAVESTATE_LOAD,
|
||||||
|
RGUI_SETTINGS_SCREENSHOT,
|
||||||
RGUI_SETTINGS_VIDEO_FILTER,
|
RGUI_SETTINGS_VIDEO_FILTER,
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
RGUI_SETTINGS_VIDEO_SOFT_FILTER,
|
RGUI_SETTINGS_VIDEO_SOFT_FILTER,
|
||||||
|
@ -49,8 +49,6 @@ FILE * log_fp;
|
|||||||
uint32_t menu_framebuf[320 * 240];
|
uint32_t menu_framebuf[320 * 240];
|
||||||
rgui_handle_t *rgui;
|
rgui_handle_t *rgui;
|
||||||
|
|
||||||
char app_dir[PATH_MAX];
|
|
||||||
|
|
||||||
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
|
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
|
||||||
static devoptab_t dotab_stdout = {
|
static devoptab_t dotab_stdout = {
|
||||||
"stdout", // device name
|
"stdout", // device name
|
||||||
@ -89,9 +87,7 @@ int gx_logger_net(struct _reent *r, int fd, const char *ptr, size_t len)
|
|||||||
logger_send("%s", temp);
|
logger_send("%s", temp);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(HAVE_FILE_LOGGER)
|
||||||
|
|
||||||
#ifdef HAVE_FILE_LOGGER
|
|
||||||
int gx_logger_file(struct _reent *r, int fd, const char *ptr, size_t len)
|
int gx_logger_file(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||||
{
|
{
|
||||||
fwrite(ptr, 1, len, log_fp);
|
fwrite(ptr, 1, len, log_fp);
|
||||||
@ -340,7 +336,6 @@ int main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fatInitDefault();
|
fatInitDefault();
|
||||||
getcwd(app_dir, sizeof(app_dir));
|
|
||||||
|
|
||||||
get_environment_settings();
|
get_environment_settings();
|
||||||
|
|
||||||
@ -350,8 +345,7 @@ int main(void)
|
|||||||
devoptab_list[STD_OUT] = &dotab_stdout;
|
devoptab_list[STD_OUT] = &dotab_stdout;
|
||||||
devoptab_list[STD_ERR] = &dotab_stdout;
|
devoptab_list[STD_ERR] = &dotab_stdout;
|
||||||
dotab_stdout.write_r = gx_logger_net;
|
dotab_stdout.write_r = gx_logger_net;
|
||||||
#endif
|
#elif defined(HAVE_FILE_LOGGER)
|
||||||
#ifdef HAVE_FILE_LOGGER
|
|
||||||
g_extern.verbose = true;
|
g_extern.verbose = true;
|
||||||
log_fp = fopen("/retroarch-log.txt", "w");
|
log_fp = fopen("/retroarch-log.txt", "w");
|
||||||
devoptab_list[STD_OUT] = &dotab_stdout;
|
devoptab_list[STD_OUT] = &dotab_stdout;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "../libretro.h"
|
#include "../libretro.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define JOYSTICK_THRESHOLD 64
|
#define JOYSTICK_THRESHOLD 48
|
||||||
|
|
||||||
#define MAX_PADS 4
|
#define MAX_PADS 4
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user