Move more RMenu stuff to rmenu.c and out of the context drivers

This commit is contained in:
twinaphex 2013-03-10 15:23:34 +01:00
parent 92f673151e
commit d74b7156fa
3 changed files with 45 additions and 58 deletions

View File

@ -136,6 +136,44 @@ enum
RMENU_DEVICE_NAV_LAST
};
const char drive_mappings[][32] = {
#if defined(_XBOX1)
"C:",
"D:",
"E:",
"F:",
"G:"
#elif defined(__CELLOS_LV2__)
"/app_home/",
"/dev_hdd0/",
"/dev_hdd1/",
"/host_root/"
#endif
};
#if defined__CELLOS_LV2__
unsigned char drive_mapping_idx = 1;
#elif defined(_XBOX1)
unsigned char drive_mapping_idx = 2;
#else
unsigned char drive_mapping_idx = 0;
#endif
static const char *menu_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char *menu_drive_mapping_next(void)
{
size_t arr_size = sizeof(drive_mappings) / sizeof(drive_mappings[0]);
if((drive_mapping_idx + 1) < arr_size)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
/*============================================================
EVENT CALLBACKS (AND RELATED)
============================================================ */
@ -1965,6 +2003,7 @@ static int select_setting(void *data, void *state)
return 0;
}
int select_rom(void *data, void *state)
{
menu *current_menu = (menu*)data;
@ -2000,7 +2039,7 @@ int select_rom(void *data, void *state)
}
else if (input & (1ULL << RMENU_DEVICE_NAV_L1))
{
const char * drive_map = device_ptr->ctx_driver->drive_mapping_previous();
const char * drive_map = menu_drive_mapping_previous();
if(drive_map != NULL)
{
filebrowser_set_root_and_ext(filebrowser, g_extern.system.valid_extensions, drive_map);
@ -2009,7 +2048,7 @@ int select_rom(void *data, void *state)
}
else if (input & (1ULL << RMENU_DEVICE_NAV_R1))
{
const char * drive_map = device_ptr->ctx_driver->drive_mapping_next();
const char * drive_map = menu_drive_mapping_next();
if(drive_map != NULL)
{
filebrowser_set_root_and_ext(filebrowser, g_extern.system.valid_extensions, drive_map);

View File

@ -51,7 +51,6 @@ static PSGLdevice* gl_device;
static PSGLcontext* gl_context;
#endif
#define HARDCODE_FONT_SIZE 0.91f
#define POSITION_X 0.09f
#define POSITION_X_CENTER 0.5f
@ -70,17 +69,6 @@ static PSGLcontext* gl_context;
#define NUM_ENTRY_PER_PAGE 15
#define DRIVE_MAPPING_SIZE 4
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
"/app_home/",
"/dev_hdd0/",
"/dev_hdd1/",
"/host_root/"
};
unsigned char drive_mapping_idx = 1;
static int gfx_ctx_check_resolution(unsigned resolution_id)
{
return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
@ -167,20 +155,6 @@ static void rmenu_ctx_ps3_screenshot_dump(void *data)
(void)data;
}
static const char * rmenu_ctx_ps3_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char * rmenu_ctx_ps3_drive_mapping_next(void)
{
if((drive_mapping_idx + 1) < DRIVE_MAPPING_SIZE)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
static void gfx_ctx_get_available_resolutions (void)
{
bool defaultresolution;
@ -520,8 +494,8 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_set_default_pos,
rmenu_ctx_ps3_screenshot_enable,
rmenu_ctx_ps3_screenshot_dump,
rmenu_ctx_ps3_drive_mapping_previous,
rmenu_ctx_ps3_drive_mapping_next,
NULL,
NULL,
#endif
};

View File

@ -68,18 +68,6 @@
#define NUM_ENTRY_PER_PAGE 12
#define DRIVE_MAPPING_SIZE 5
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
"C:",
"D:",
"E:",
"F:",
"G:"
};
unsigned char drive_mapping_idx = 2;
int xpos, ypos;
#ifdef _XBOX1
// Rom list coordinates
@ -262,20 +250,6 @@ static void gfx_ctx_xdk_menu_screenshot_dump(void *data)
}
}
static const char *gfx_ctx_xdk_menu_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char *gfx_ctx_xdk_menu_drive_mapping_next(void)
{
if((drive_mapping_idx + 1) < DRIVE_MAPPING_SIZE)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
static void gfx_ctx_xdk_update_window_title(bool reset) { }
static void gfx_ctx_xdk_get_video_size(unsigned *width, unsigned *height)
@ -495,7 +469,7 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
gfx_ctx_xdk_menu_set_default_pos,
gfx_ctx_xdk_menu_screenshot_enable,
gfx_ctx_xdk_menu_screenshot_dump,
gfx_ctx_xdk_menu_drive_mapping_previous,
gfx_ctx_xdk_menu_drive_mapping_next
NULL,
NULL,
#endif
};