HAVE_RGUI and HAVE_RMENU are now mutually exclusive - no longer

have to be defined both for (say) the Android port
This commit is contained in:
twinaphex 2013-03-09 17:42:19 +01:00
parent e7f206be79
commit 66e7606b25
16 changed files with 59 additions and 71 deletions

View File

@ -62,7 +62,7 @@ CFLAGS += -DHAVE_FILE_LOGGER
CFLAGS += -Iconsole/logger
endif
CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RMENU -DHAVE_RGUI -DRARCH_CONSOLE -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Wno-char-subscripts
CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DRARCH_CONSOLE -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Wno-char-subscripts
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g

View File

@ -8,7 +8,7 @@ INCDIR =
CFLAGS = -O2 -G0 -g -std=gnu99 -ffast-math
ASFLAGS = $(CFLAGS)
RARCH_DEFINES = -DPSP -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_FILEBROWSER -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -DHAVE_NULLVIDEO -DHAVE_NULLAUDIO -DHAVE_RMENU
RARCH_DEFINES = -DPSP -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_FILEBROWSER -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -DHAVE_NULLVIDEO -DHAVE_NULLAUDIO
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER

View File

@ -65,7 +65,7 @@ CFLAGS += -Iconsole/logger
endif
CFLAGS += -std=gnu99 -DHAVE_SINC -DSINC_LOWER_QUALITY -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DRARCH_CONSOLE -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RARCH_EXEC -DHAVE_RMENU -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Wno-char-subscripts
CFLAGS += -std=gnu99 -DHAVE_SINC -DSINC_LOWER_QUALITY -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DRARCH_CONSOLE -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RARCH_EXEC -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Wno-char-subscripts
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g -DDEBUG

View File

@ -51,7 +51,7 @@ ifeq ($(PERF_TEST), 1)
LOCAL_CFLAGS += -DPERF_TEST
endif
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_RMENU -DHAVE_RGUI -DHAVE_SCREENSHOTS -DWANT_MINIZ -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 -I../../../deps/miniz
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_RGUI -DHAVE_SCREENSHOTS -DWANT_MINIZ -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 -I../../../deps/miniz
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 $(LOGGER_LDLIBS) -ldl

View File

@ -240,8 +240,7 @@ static const bool aspect_ratio_auto = false; // 1:1 PAR
static const bool crop_overscan = true;
// Font size for on-screen messages.
// TODO: use RARCH_CONSOLE instead? need to test
#if defined(HAVE_RMENU) && !defined(HAVE_RGUI)
#if defined(HAVE_RMENU)
static const float font_size = 1.0f;
#else
static const float font_size = 48;

View File

@ -437,14 +437,11 @@ MENU
#include "../../frontend/menu/rgui.c"
#endif
#ifdef HAVE_RMENU
#include "../../frontend/menu/rmenu_settings.c"
#if defined(_XBOX360)
#include "../../frontend/menu/rmenu_xui.cpp"
#endif
#endif
#include "../../frontend/menu/rmenu_settings.c"
#ifdef __cplusplus
extern "C" {

View File

@ -240,11 +240,12 @@ typedef struct video_driver
const char *ident;
// Callbacks essentially useless on PC, but useful on consoles where the drivers are used for more stuff.
#if defined(HAVE_RMENU)
#if defined(RARCH_CONSOLE)
void (*start)(void);
void (*stop)(void);
void (*restart)(void);
void (*apply_state_changes)(void);
#endif
#if defined(HAVE_RMENU) || defined(HAVE_RGUI)
void (*set_aspect_ratio)(void *data, unsigned aspectratio_index);
#endif

View File

@ -37,6 +37,12 @@
#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)
#if defined(HAVE_OPENGL)
#define DECLARE_DEVICE_PTR() gl_t *device_ptr = (gl_t*)driver.video_data
#elif defined(GEKKO)
#define DECLARE_DEVICE_PTR() gx_video_t *device_ptr = (gx_video_t*)driver.video_data
#endif
#ifdef GEKKO
enum
{
@ -582,7 +588,8 @@ static void render_text(rgui_handle_t *rgui)
#ifdef GEKKO
const char *message_queue;
gx_video_t *gx = (gx_video_t*)driver.video_data;
DECLARE_DEVICE_PTR();
if (rgui->msg_force)
{
message_queue = msg_queue_pull(g_extern.msg_queue);
@ -590,7 +597,7 @@ static void render_text(rgui_handle_t *rgui)
}
else
{
message_queue = gx->msg;
message_queue = device_ptr->msg;
}
render_messagebox(rgui, message_queue);
#endif
@ -604,6 +611,7 @@ static void render_text(rgui_handle_t *rgui)
static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t action, rgui_file_type_t menu_type)
{
DECLARE_DEVICE_PTR();
#ifdef RARCH_CONSOLE
unsigned port = menu_type - RGUI_SETTINGS_CONTROLLER_1;
#endif
@ -694,7 +702,7 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
else
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
break;
#endif
@ -728,14 +736,14 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
if (action == RGUI_ACTION_START)
{
g_extern.console.screen.gamma_correction = 0;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
else if (action == RGUI_ACTION_LEFT)
{
if(g_extern.console.screen.gamma_correction > 0)
{
g_extern.console.screen.gamma_correction--;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
}
else if (action == RGUI_ACTION_RIGHT)
@ -743,7 +751,7 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
if(g_extern.console.screen.gamma_correction < MAX_GAMMA_SETTING)
{
g_extern.console.screen.gamma_correction++;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
}
break;
@ -777,17 +785,17 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
if (action == RGUI_ACTION_START)
{
rmenu_settings_set_default(S_DEF_OVERSCAN);
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
else if (action == RGUI_ACTION_LEFT)
{
rmenu_settings_set(S_OVERSCAN_DECREMENT);
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
else if (action == RGUI_ACTION_RIGHT)
{
rmenu_settings_set(S_OVERSCAN_INCREMENT);
driver.video->apply_state_changes();
device_ptr->should_resize = true;
}
break;
case RGUI_SETTINGS_AUDIO_MUTE:
@ -1029,9 +1037,7 @@ static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
{
#ifdef GEKKO
gx_video_t *gx = (gx_video_t*)driver.video_data;
#endif
DECLARE_DEVICE_PTR();
rgui_file_type_t menu_type = 0;
rgui_list_back(rgui->path_stack, NULL, &menu_type, NULL);
@ -1045,7 +1051,7 @@ static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
else
g_extern.console.screen.viewports.custom_vp.height -= 1;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
break;
case RGUI_ACTION_DOWN:
@ -1056,7 +1062,7 @@ static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
else
g_extern.console.screen.viewports.custom_vp.height += 1;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
break;
case RGUI_ACTION_LEFT:
@ -1067,7 +1073,7 @@ static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
else
g_extern.console.screen.viewports.custom_vp.width -= 1;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
break;
case RGUI_ACTION_RIGHT:
@ -1078,7 +1084,7 @@ static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
else
g_extern.console.screen.viewports.custom_vp.width += 1;
driver.video->apply_state_changes();
device_ptr->should_resize = true;
break;
case RGUI_ACTION_CANCEL:
@ -1116,11 +1122,11 @@ static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
else
{
g_extern.console.screen.viewports.custom_vp.width = gx->win_width - g_extern.console.screen.viewports.custom_vp.x;
g_extern.console.screen.viewports.custom_vp.height = gx->win_height - g_extern.console.screen.viewports.custom_vp.y;
g_extern.console.screen.viewports.custom_vp.width = device_ptr->win_width - g_extern.console.screen.viewports.custom_vp.x;
g_extern.console.screen.viewports.custom_vp.height = device_ptr->win_height - g_extern.console.screen.viewports.custom_vp.y;
}
#endif
driver.video->apply_state_changes();
device_ptr->should_resize = true;
break;
case RGUI_ACTION_SETTINGS:
@ -1625,11 +1631,7 @@ RMENU API
void menu_init(void)
{
#if defined(HAVE_OPENGL)
gl_t *device_ptr = (gl_t*)driver.video_data;
#elif defined(GEKKO)
gx_video_t *device_ptr = (gx_video_t*)driver.video_data;
#endif
DECLARE_DEVICE_PTR();
device_ptr->menu_data = (uint32_t *) menu_framebuf;
@ -1677,12 +1679,13 @@ int rmenu_input_process(void *data, void *state)
bool menu_iterate(void)
{
DECLARE_DEVICE_PTR();
static uint16_t old_input_state = 0;
static bool initial_held = true;
static bool first_held = false;
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_DRAW);
driver.video->apply_state_changes();
device_ptr->should_resize = true;
g_extern.frame_count++;

View File

@ -169,7 +169,7 @@ void gfx_scale_integer(struct rarch_viewport *vp, unsigned width, unsigned heigh
vp->y = padding_y >> 1;
}
#ifdef HAVE_RMENU
#if defined(HAVE_RMENU) || defined(HAVE_RGUI)
struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ "1:1", 1.0f },

View File

@ -40,7 +40,7 @@ void gfx_set_dwm(void);
void gfx_scale_integer(struct rarch_viewport *vp, unsigned win_width, unsigned win_height,
float aspect_ratio, bool keep_aspect);
#ifdef HAVE_RMENU
#if defined(HAVE_RMENU) || defined(HAVE_RGUI)
#define MIN_SCALING_FACTOR (1.0f)

View File

@ -23,7 +23,7 @@
#include "../config.h"
#endif
#if defined(RARCH_CONSOLE) || defined(HAVE_RMENU)
#if defined(HAVE_RMENU)
#include "../frontend/menu/rmenu.h"
#endif
@ -117,7 +117,7 @@ typedef struct gfx_ctx_driver
// Human readable string.
const char *ident;
#if defined(HAVE_RMENU) || defined(_XBOX360)
#if defined(HAVE_RMENU)
void (*set_blend)(bool enable);
void (*set_filtering)(unsigned index, bool set_smooth);
void (*get_available_resolutions)(void);

View File

@ -1289,9 +1289,8 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
RARCH_PERFORMANCE_START(frame_run);
gl_t *gl = (gl_t*)data;
#ifdef HAVE_RMENU
uint64_t lifecycle_mode_state = g_extern.lifecycle_mode_state;
#endif
(void)lifecycle_mode_state;
gl_shader_use_func(gl, 1);
@ -1388,7 +1387,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
RARCH_PERFORMANCE_STOP(frame_run);
#if defined(HAVE_RMENU) && !defined(HAVE_RGUI)
#if defined(HAVE_RMENU)
if (lifecycle_mode_state & (1ULL << MODE_MENU_DRAW))
context_rmenu_frame_func(gl);
else
@ -1814,7 +1813,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
if (input && input_data)
context_input_driver_func(input, input_data);
#if !defined(HAVE_RMENU) || !defined(RARCH_CONSOLE)
#if !defined(HAVE_RMENU)
// Comes too early for console - moved to gl_start
if (g_settings.video.font_enable)
gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size);
@ -2080,13 +2079,9 @@ static void gl_restart(void)
#endif
gl_start();
}
#endif
static void gl_apply_state_changes(void)
{
gl_t *gl = (gl_t*)driver.video_data;
gl->should_resize = true;
}
#if defined(HAVE_RGUI) || defined(HAVE_RMENU)
static void gl_set_aspect_ratio(void *data, unsigned aspectratio_index)
{
(void)data;
@ -2249,10 +2244,10 @@ const video_driver_t video_gl = {
gl_start,
gl_stop,
gl_restart,
gl_apply_state_changes,
#endif
#if defined(HAVE_RMENU) || defined(HAVE_RGUI)
gl_set_aspect_ratio,
#endif
gl_set_rotation,
#ifndef NO_GL_READ_VIEWPORT

View File

@ -536,14 +536,14 @@ static void thread_get_overlay_interface(void *data, const video_overlay_interfa
#endif
#if defined(HAVE_RMENU)
// all stubs for now, might not have to implement them unless we want to port this to consoles
static void thread_start(void) {}
static void thread_stop(void) {}
static void thread_restart(void) {}
static void thread_apply_state_changes(void) {}
static void thread_set_aspect_ratio(void *data, unsigned aspectratio_index) {}
#endif
#if defined(HAVE_RMENU) || defined(HAVE_RGUI)
static void thread_set_aspect_ratio(void *data, unsigned aspectratio_index) {}
#endif
static const video_driver_t video_thread = {
@ -559,7 +559,8 @@ static const video_driver_t video_thread = {
thread_start,
thread_stop,
thread_restart,
thread_apply_state_changes,
#endif
#if defined(HAVE_RMENU) || defined(HAVE_RGUI)
thread_set_aspect_ratio,
#endif
thread_set_rotation,

View File

@ -1012,12 +1012,6 @@ static void gx_set_rotation(void *data, unsigned orientation)
gx->should_resize = true;
}
static void gx_apply_state_changes(void)
{
gx_video_t *gx = (gx_video_t*)driver.video_data;
gx->should_resize = true;
}
static bool gx_set_shader(void *data, enum rarch_shader_type type, const char *path, unsigned index)
{
(void)data;
@ -1041,6 +1035,5 @@ const video_driver_t video_gx = {
.start = gx_start,
.stop = gx_stop,
.restart = gx_restart,
.apply_state_changes = gx_apply_state_changes,
.set_aspect_ratio = gx_set_aspect_ratio
};

View File

@ -274,7 +274,9 @@ void config_set_defaults(void)
g_extern.console.screen.resolutions.current.id = 0;
strlcpy(g_extern.console.main_wrap.default_rom_startup_dir, default_paths.filebrowser_startup_dir, sizeof(g_extern.console.main_wrap.default_rom_startup_dir));
strlcpy(g_extern.console.main_wrap.default_savestate_dir, default_paths.savestate_dir, sizeof(g_extern.console.main_wrap.default_savestate_dir));
#ifdef HAVE_RMENU
strlcpy(g_extern.console.menu_texture_path, default_paths.menu_border_file, sizeof(g_extern.console.menu_texture_path));
#endif
#if defined(__CELLOS_LV2) || defined(_XBOX360)
g_settings.video.aspect_ratio_idx = ASPECT_RATIO_16_9;
@ -497,8 +499,10 @@ bool config_load_file(const char *path)
if (config_get_path(conf, "default_rom_startup_dir", tmp_str, sizeof(tmp_str)))
strlcpy(g_extern.console.main_wrap.default_rom_startup_dir, tmp_str, sizeof(g_extern.console.main_wrap.default_rom_startup_dir));
#ifdef HAVE_RMENU
if (config_get_path(conf, "menu_texture_path", tmp_str, sizeof(tmp_str)))
strlcpy(g_extern.console.menu_texture_path, tmp_str, sizeof(g_extern.console.menu_texture_path));
#endif
if (config_get_bool(conf, "info_msg_enable", &msg_enable))
{
@ -1264,7 +1268,9 @@ bool config_save_file(const char *path)
config_set_int(conf, "custom_viewport_x", g_extern.console.screen.viewports.custom_vp.x);
config_set_int(conf, "custom_viewport_y", g_extern.console.screen.viewports.custom_vp.y);
config_set_string(conf, "default_rom_startup_dir", g_extern.console.main_wrap.default_rom_startup_dir);
#ifdef HAVE_RMENU
config_set_string(conf, "menu_texture_path", g_extern.console.menu_texture_path);
#endif
config_set_float(conf, "overscan_amount", g_extern.console.screen.overscan_amount);
config_set_float(conf, "video_font_size", g_settings.video.font_size);

View File

@ -982,12 +982,6 @@ static void xdk_d3d_restart(void)
d3dr->Reset(&d3dpp);
}
static void xdk_d3d_apply_state_changes(void)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
d3d->should_resize = true;
}
static void xdk_d3d_set_aspect_ratio(void *data, unsigned aspectratio_index)
{
(void)data;
@ -1015,7 +1009,6 @@ const video_driver_t video_xdk_d3d = {
xdk_d3d_start,
xdk_d3d_stop,
xdk_d3d_restart,
xdk_d3d_apply_state_changes,
xdk_d3d_set_aspect_ratio,
xdk_d3d_set_rotation,
};