mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 02:43:03 +00:00
Add action_scan
This commit is contained in:
parent
65e770359e
commit
a5d8f37b34
@ -348,6 +348,7 @@ ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
menu/menu_entries_cbs_left.o \
|
||||
menu/menu_entries_cbs_right.o \
|
||||
menu/menu_entries_cbs_deferred_push.o \
|
||||
menu/menu_entries_cbs_scan.o \
|
||||
menu/menu_entries_cbs_representation.o \
|
||||
menu/menu_entries_cbs_iterate.o \
|
||||
menu/menu_entries_cbs_up.o \
|
||||
|
@ -723,6 +723,7 @@ MENU
|
||||
#include "../menu/menu_entries_cbs_left.c"
|
||||
#include "../menu/menu_entries_cbs_right.c"
|
||||
#include "../menu/menu_entries_cbs_deferred_push.c"
|
||||
#include "../menu/menu_entries_cbs_scan.c"
|
||||
#include "../menu/menu_entries_cbs_representation.c"
|
||||
#include "../menu/menu_entries_cbs_iterate.c"
|
||||
#include "../menu/menu_entries_cbs_up.c"
|
||||
|
@ -200,6 +200,7 @@ static void menu_driver_list_delete_common(file_list_t *list, size_t idx,
|
||||
cbs->action_left = NULL;
|
||||
cbs->action_right = NULL;
|
||||
cbs->action_deferred_push = NULL;
|
||||
cbs->action_scan = NULL;
|
||||
free(list->list[idx].actiondata);
|
||||
}
|
||||
list->list[idx].actiondata = NULL;
|
||||
|
@ -191,6 +191,7 @@ void menu_entries_cbs_init(void *data,
|
||||
|
||||
menu_entries_cbs_init_bind_ok(cbs, path, label, type, idx, elem0, elem1, menu_label);
|
||||
menu_entries_cbs_init_bind_cancel(cbs, path, label, type, idx, elem0, elem1);
|
||||
menu_entries_cbs_init_bind_scan(cbs, path, label, type, idx, elem0, elem1);
|
||||
menu_entries_cbs_init_bind_start(cbs, path, label, type, idx, elem0, elem1);
|
||||
menu_entries_cbs_init_bind_select(cbs, path, label, type, idx, elem0, elem1);
|
||||
menu_entries_cbs_init_bind_content_list_switch(cbs, path, label, type, idx, elem0, elem1);
|
||||
|
@ -85,6 +85,10 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx,
|
||||
const char *elem0, const char *elem1);
|
||||
|
||||
void menu_entries_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx,
|
||||
const char *elem0, const char *elem1);
|
||||
|
||||
int deferred_push_content_list(void *data, void *userdata,
|
||||
const char *path, const char *label, unsigned type);
|
||||
|
||||
|
58
menu/menu_entries_cbs_scan.c
Normal file
58
menu/menu_entries_cbs_scan.c
Normal file
@ -0,0 +1,58 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2015 - 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 <file/file_path.h>
|
||||
#include "menu.h"
|
||||
#include "menu_entries_cbs.h"
|
||||
#include "menu_entry.h"
|
||||
#include "menu_setting.h"
|
||||
|
||||
#include "../runloop_data.h"
|
||||
|
||||
static int action_scan_directory(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
char fullpath[PATH_MAX_LENGTH];
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return -1;
|
||||
|
||||
menu_list_get_last_stack(menu->menu_list,
|
||||
&menu_path, &menu_label, NULL);
|
||||
|
||||
fill_pathname_join(fullpath, menu_path, path, sizeof(fullpath));
|
||||
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_DB, fullpath, "cb_db_scan", 0, 1, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_entries_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx,
|
||||
const char *elem0, const char *elem1)
|
||||
{
|
||||
if (!cbs)
|
||||
return;
|
||||
|
||||
cbs->action_scan = NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MENU_FILE_DIRECTORY:
|
||||
cbs->action_scan = action_scan_directory;
|
||||
break;
|
||||
}
|
||||
}
|
@ -516,8 +516,8 @@ int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
|
||||
break;
|
||||
|
||||
case MENU_ACTION_SCAN:
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_DB, "/home/squarepusher/roms", "cb_db_scan", 0, 1,
|
||||
true);
|
||||
if (cbs && cbs->action_scan)
|
||||
ret = cbs->action_scan(entry->path, entry->label, entry->type, i);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -40,6 +40,8 @@ typedef struct menu_file_list_cbs
|
||||
size_t idx);
|
||||
int (*action_cancel)(const char *path, const char *label, unsigned type,
|
||||
size_t idx);
|
||||
int (*action_scan)(const char *path, const char *label, unsigned type,
|
||||
size_t idx);
|
||||
int (*action_start)(unsigned type, const char *label);
|
||||
int (*action_select)(unsigned type, const char *label);
|
||||
int (*action_content_list_switch)(void *data, void *userdata, const char
|
||||
|
Loading…
x
Reference in New Issue
Block a user