(RMenu) Split up platform-specific code into Rmenu context files

This commit is contained in:
Twinaphex 2012-08-18 22:45:46 +02:00
parent c14b560255
commit 7c4189cdd5
8 changed files with 105 additions and 12 deletions

View File

@ -295,6 +295,11 @@ NETPLAY
MENU
============================================================ */
#ifdef HAVE_RMENU
#if defined(__CELLOS_LV2__)
#include "../rmenu/context/rmenu_ctx_ps3.c"
#elif defined(_XBOX1)
#include "../rmenu/context/rmenu_ctx_xdk.c"
#endif
#include "../rmenu/rmenu.c"
#endif

View File

@ -0,0 +1,33 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - 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 "../rmenu.h"
#include "../../../gfx/context/ps3_ctx.h"
static void rmenu_ctx_ps3_clear(void)
{
gfx_ctx_clear();
}
static void rmenu_ctx_ps3_blend(bool enable)
{
gfx_ctx_set_blend(enable);
}
const rmenu_context_t rmenu_ctx_ps3 = {
.clear = rmenu_ctx_ps3_clear,
.blend = rmenu_ctx_ps3_blend,
};

View File

@ -0,0 +1,33 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - 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 "../rmenu.h"
#include "../../gfx/context/xdk_ctx.h"
static void rmenu_ctx_xdk_clear(void)
{
gfx_ctx_clear();
}
static void rmenu_ctx_xdk_blend(bool enable)
{
gfx_ctx_set_blend(enable);
}
const rmenu_context_t rmenu_ctx_xdk = {
.clear = rmenu_ctx_xdk_clear,
.blend = rmenu_ctx_xdk_blend,
};

View File

@ -95,6 +95,8 @@ unsigned set_shader = 0;
unsigned currently_selected_controller_menu = 0;
char m_title[256];
static const rmenu_context_t *context;
static uint64_t old_state = 0;
typedef enum {
@ -1017,7 +1019,7 @@ static void rarch_filename_input_and_save (unsigned filename_type)
while(OSK_IS_RUNNING(g_console.oskutil_handle))
{
gfx_ctx_clear();
context->clear();
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
@ -1053,7 +1055,7 @@ static void rarch_filename_input_and_save (unsigned filename_type)
while(OSK_IS_RUNNING(g_console.oskutil_handle))
{
/* OSK Util gets updated */
gfx_ctx_clear();
context->clear();
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
@ -1427,7 +1429,7 @@ static void producesettingentry(menu *current_menu, item *items, unsigned switch
oskutil_start(&g_console.oskutil_handle);
while(OSK_IS_RUNNING(g_console.oskutil_handle))
{
gfx_ctx_clear();
context->clear();
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
@ -2319,6 +2321,12 @@ void menu_init (void)
snprintf(m_title, sizeof(m_title), "Libretro core: %s %s", id, info.library_version);
rmenu_filebrowser_init();
#if defined(__CELLOS_LV2__)
context = &rmenu_ctx_ps3;
#elif defined(_XBOX1)
context = (rmenu_context_t*)&rmenu_ctx_xdk;
#endif
}
void menu_free (void)
@ -2474,7 +2482,7 @@ void menu_loop(void)
}
}
gfx_ctx_clear();
context->clear();
if(current_menu->enum_id == INGAME_MENU_RESIZE && (trig_state & RETRO_DEVICE_ID_JOYPAD_Y) || current_menu->enum_id == INGAME_MENU_SCREENSHOT)
{
@ -2484,7 +2492,7 @@ void menu_loop(void)
}
else
{
gfx_ctx_set_blend(true);
context->blend(true);
#ifdef __CELLOS_LV2__
device_ptr->menu_render = true;
#endif
@ -2603,7 +2611,7 @@ void menu_loop(void)
if(current_menu->enum_id == INGAME_MENU_RESIZE && (old_state & (1 << RETRO_DEVICE_ID_JOYPAD_Y)) || current_menu->enum_id == INGAME_MENU_SCREENSHOT)
{ }
else
gfx_ctx_set_blend(false);
context->blend(false);
}while(g_console.menu_enable);
#ifdef __CELLOS_LV2__

View File

@ -224,6 +224,12 @@ enum
#define MAX_NO_OF_PATH_SETTINGS SETTING_PATH_DEFAULT_ALL+1
#define MAX_NO_OF_CONTROLS_SETTINGS SETTING_CONTROLS_DEFAULT_ALL+1
typedef struct rmenu_context
{
void (*clear)(void);
void (*blend)(bool enable);
} rmenu_context_t;
void menu_init (void);
void menu_loop (void);
void menu_free (void);

View File

@ -362,7 +362,7 @@ int main(void)
config_set_defaults();
input_gx.init();
video_start_func();
video_gx.start();
gx_video_t *gx = (gx_video_t*)driver.video_data;
gx->menu_data = menu_framebuf;
@ -420,7 +420,7 @@ begin_shutdown:
input_gx.free(NULL);
video_stop_func();
video_gx.stop();
menu_free();
#ifdef HAVE_FILE_LOGGER

View File

@ -284,7 +284,7 @@ int main(int argc, char *argv[])
#endif
#endif
video_start_func();
video_gl.start();
#ifdef HAVE_OSKUTIL
oskutil_init(&g_console.oskutil_handle, 0);
@ -342,7 +342,7 @@ begin_shutdown:
rarch_main_deinit();
input_ps3.free(NULL);
video_stop_func();
video_gl.stop();
menu_free();
#ifdef HAVE_OSKUTIL

View File

@ -170,7 +170,11 @@ int main(int argc, char *argv[])
input_xinput.post_init();
video_start_func();
#if defined(HAVE_D3D9) || defined(HAVE_D3D8)
video_xdk_d3d.start();
#else
video_null.start();
#endif
system_init();
@ -206,7 +210,11 @@ begin_shutdown:
rarch_config_save(default_paths.config_file);
menu_free();
video_stop_func();
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
video_xdk_d3d.stop();
#else
video_null.stop();
#endif
input_xinput.free(NULL);
if(g_console.return_to_launcher)