mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-08 17:28:49 -10:00
First-run downloads: reuse the Online Updater path, fix the space check
Follow-up to the first-run download prompt (PR #18878). - Downloads go through action_ok_download_generic (new public wrapper action_ok_download_bundle) instead of a copied version of it. The copy predated the stream-to-disk sink, so a first run held the 72MB assets zip and the 52MB database zip in RAM, and skipped the check that refuses to truncate an archive still being extracted. - The free-space check asked about the target directory, which on a real first run does not exist yet: statvfs failed, -1 came back, and assets and databases were never offered. It now asks the nearest existing parent, and an unknown answer no longer blocks the download. - The prompt is an ordinary msg enum through menu_dialog_confirm_set. The 512-byte confirm_text buffer in menu_dialog, the second confirm setter and the extra branches in the iterate path are gone. - Missing bundles are scanned once at menu init into a bitmask that the confirm handler uses; directories are not walked a second time. - Offered only with HAVE_CONFIGFILE, the only first-run signal there is; dead have_bundled_assets logic removed. - path_get_free_space: GetDiskFreeSpaceExA resolved at run time (not in the first Windows 95), GetDiskFreeSpaceA fallback, no <windows.h> on Xbox, statfs on Android (statvfs needs API 19), statvfs only on platforms known to have it instead of every __unix__ target. - path_is_empty_directory: dotfiles (.nomedia, .DS_Store) do not count, the open call does not filter them outside Windows; documented. - Ozone caches the Cancel label with the other footer labels instead of measuring it every frame the dialog is up. - Pointer: one close, then confirm or cancel. - Prompt text no longer promises overlays on platforms that skip them.
This commit is contained in:
1 parent
bf93e5568a
commit
5bf0c36d14
10 files changed
+191
-169
No files matched your search
+3
-3
@@ -33747,9 +33747,9 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_FIRST_RUN_DOWNLOAD_PROMPT,
|
||||
"RetroArch is missing assets, core & controller profiles as well as overlays.\n\n"
|
||||
"Would you like to download them now? The process requires your internet connection.\n\n"
|
||||
"Further downloads can be managed later in the online updater."
|
||||
"Some of RetroArch's downloadable files (menu assets, controller profiles, core info, databases) are missing.\n\n"
|
||||
"Download them now? This needs an internet connection.\n\n"
|
||||
"They can be updated later from the Online Updater."
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_TO,
|
||||
|
||||
@@ -55,13 +55,23 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#if !defined(_XBOX)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#else
|
||||
#include <unistd.h> /* stat() is defined here */
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
/* Free-space query: only where the call is known to exist. Everything
|
||||
* else reports "unknown" (-1) rather than guessing at a header. */
|
||||
#if defined(__ANDROID__)
|
||||
#include <sys/vfs.h> /* statfs: every API level, statvfs is 19+ */
|
||||
#define PATH_FREE_SPACE_STATFS
|
||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__NetBSD__) \
|
||||
|| defined(__OpenBSD__) || defined(__DragonFly__) || defined(__HAIKU__) \
|
||||
|| defined(__EMSCRIPTEN__) || (defined(__FreeBSD__) && !defined(ORBIS))
|
||||
#include <sys/statvfs.h>
|
||||
#define PATH_FREE_SPACE_STATVFS
|
||||
#endif
|
||||
|
||||
/* <direct.h> (MinGW, included just above) can re-establish the mkdir
|
||||
@@ -172,29 +182,26 @@ bool path_is_directory(const char *path)
|
||||
|
||||
bool path_is_empty_directory(const char *dir)
|
||||
{
|
||||
struct retro_vfs_dir_handle *d;
|
||||
const char *name;
|
||||
struct retro_vfs_dir_handle *d = retro_vfs_opendir_impl(dir, false);
|
||||
|
||||
d = retro_vfs_opendir_impl(dir, false);
|
||||
if (!d)
|
||||
return false;
|
||||
if (!d)
|
||||
return false;
|
||||
|
||||
while (retro_vfs_readdir_impl(d))
|
||||
{
|
||||
name = retro_vfs_dirent_get_name_impl(d);
|
||||
while (retro_vfs_readdir_impl(d))
|
||||
{
|
||||
const char *name = retro_vfs_dirent_get_name_impl(d);
|
||||
|
||||
/* Skip . and .. */
|
||||
if (name &&
|
||||
strcmp(name, ".") != 0 &&
|
||||
strcmp(name, "..") != 0)
|
||||
{
|
||||
retro_vfs_closedir_impl(d);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/* ".", ".." and dotfiles (.nomedia, .DS_Store) do not count:
|
||||
* the open call does not filter them outside Windows */
|
||||
if (name && name[0] != '.')
|
||||
{
|
||||
retro_vfs_closedir_impl(d);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
retro_vfs_closedir_impl(d);
|
||||
return true;
|
||||
retro_vfs_closedir_impl(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool path_is_character_special(const char *path)
|
||||
@@ -354,18 +361,53 @@ bool path_mkdir(const char *dir)
|
||||
|
||||
int64_t path_get_free_space(const char *path)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
ULARGE_INTEGER free_bytes_available;
|
||||
if (GetDiskFreeSpaceExA(path, &free_bytes_available, NULL, NULL))
|
||||
return (int64_t)free_bytes_available.QuadPart;
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
ULARGE_INTEGER avail;
|
||||
#if defined(__WINRT__)
|
||||
if (GetDiskFreeSpaceExA(path, &avail, NULL, NULL))
|
||||
return (int64_t)avail.QuadPart;
|
||||
#else
|
||||
/* GetDiskFreeSpaceEx is not in the first release of Windows 95, and
|
||||
* a static import would stop the binary loading there. The plain
|
||||
* call is everywhere; it tops out at 2GB on old systems, which is
|
||||
* still a correct lower bound. */
|
||||
typedef BOOL (WINAPI *disk_free_ex_t)(LPCSTR, PULARGE_INTEGER,
|
||||
PULARGE_INTEGER, PULARGE_INTEGER);
|
||||
static disk_free_ex_t p_disk_free_ex = NULL;
|
||||
static int resolved = 0;
|
||||
DWORD spc, bps, free_clusters, total_clusters;
|
||||
|
||||
if (!resolved)
|
||||
{
|
||||
HMODULE k32 = GetModuleHandleA("kernel32.dll");
|
||||
resolved = 1;
|
||||
if (k32)
|
||||
p_disk_free_ex = (disk_free_ex_t)GetProcAddress(k32,
|
||||
"GetDiskFreeSpaceExA");
|
||||
}
|
||||
|
||||
if (p_disk_free_ex)
|
||||
{
|
||||
if (p_disk_free_ex(path, &avail, NULL, NULL))
|
||||
return (int64_t)avail.QuadPart;
|
||||
}
|
||||
else if (GetDiskFreeSpaceA(path, &spc, &bps,
|
||||
&free_clusters, &total_clusters))
|
||||
return (int64_t)free_clusters * (int64_t)spc * (int64_t)bps;
|
||||
#endif
|
||||
return -1;
|
||||
#elif defined(__unix__) || defined(__APPLE__)
|
||||
#elif defined(PATH_FREE_SPACE_STATFS)
|
||||
struct statfs fs;
|
||||
if (statfs(path, &fs) == 0)
|
||||
return (int64_t)fs.f_bavail * (int64_t)fs.f_bsize;
|
||||
return -1;
|
||||
#elif defined(PATH_FREE_SPACE_STATVFS)
|
||||
struct statvfs fs;
|
||||
if (statvfs(path, &fs) == 0)
|
||||
return (int64_t)fs.f_bavail * (int64_t)fs.f_frsize;
|
||||
return -1;
|
||||
#else
|
||||
/* Unsupported platform */
|
||||
(void)path;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
@@ -683,8 +683,23 @@ bool path_rmdir(const char *dir);
|
||||
*/
|
||||
bool path_is_directory(const char *path);
|
||||
|
||||
/**
|
||||
* path_is_empty_directory:
|
||||
* @dir : path
|
||||
*
|
||||
* @return true if @dir is a directory holding nothing but "." and "..",
|
||||
* false if it holds anything else or cannot be opened.
|
||||
*/
|
||||
bool path_is_empty_directory(const char *dir);
|
||||
|
||||
/**
|
||||
* path_get_free_space:
|
||||
* @path : an existing file or directory
|
||||
*
|
||||
* @return bytes available to the caller on the volume holding @path,
|
||||
* or -1 when that cannot be determined (no such path, or a platform
|
||||
* without a free-space query).
|
||||
*/
|
||||
int64_t path_get_free_space(const char *path);
|
||||
|
||||
/* Time format strings with AM-PM designation require special
|
||||
|
||||
@@ -6446,6 +6446,13 @@ static int action_ok_sideload_core(const char *path,
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
/* An Online Updater bundle (assets, autoconfig, core info, databases,
|
||||
* overlays...) by its CB enum, for callers outside a menu entry */
|
||||
int action_ok_download_bundle(enum msg_hash_enums enum_idx)
|
||||
{
|
||||
return action_ok_download_generic("", "", NULL, 0, 0, 0, enum_idx);
|
||||
}
|
||||
|
||||
DEFAULT_ACTION_OK_DOWNLOAD(action_ok_core_system_files_download, MENU_ENUM_LABEL_CB_CORE_SYSTEM_FILES_DOWNLOAD)
|
||||
DEFAULT_ACTION_OK_DOWNLOAD(action_ok_core_content_thumbnails, MENU_ENUM_LABEL_CB_CORE_THUMBNAILS_DOWNLOAD)
|
||||
DEFAULT_ACTION_OK_DOWNLOAD(action_ok_download_url, MENU_ENUM_LABEL_CB_DOWNLOAD_URL)
|
||||
|
||||
@@ -580,6 +580,7 @@ struct ozone_handle
|
||||
{
|
||||
ozone_footer_label_t ok;
|
||||
ozone_footer_label_t back;
|
||||
ozone_footer_label_t cancel;
|
||||
ozone_footer_label_t scan;
|
||||
ozone_footer_label_t clear_setting;
|
||||
ozone_footer_label_t random_select;
|
||||
@@ -8052,11 +8053,9 @@ OZONE_NOINLINE static void ozone_draw_messagebox(
|
||||
float icon_x = x - (width / 2) + icon_size + (icon_padding * 3);
|
||||
float icon_y = video_height - y + (height / 2) - icon_size - (icon_padding * 2);
|
||||
float label_y = icon_y + (icon_size / 2.0f) + ozone->fonts.footer.line_centre_offset;
|
||||
const char *str_cancel = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CANCEL);
|
||||
int str_cancel_width = font_driver_get_message_width(ozone->fonts.footer.font, str_cancel, strlen(str_cancel), 1.0f);
|
||||
int cursor_x = icon_x - icon_padding;
|
||||
int cursor_y = icon_y - icon_padding;
|
||||
int cursor_w = icon_size + (icon_padding * 4) + str_cancel_width;
|
||||
int cursor_w = icon_size + (icon_padding * 4) + ozone->footer_labels.cancel.width;
|
||||
int cursor_h = icon_size + (icon_padding * 2);
|
||||
|
||||
gfx_display_set_alpha(col, 0.25f);
|
||||
@@ -8104,7 +8103,7 @@ OZONE_NOINLINE static void ozone_draw_messagebox(
|
||||
|
||||
gfx_display_draw_text(
|
||||
ozone->fonts.footer.font,
|
||||
str_cancel,
|
||||
ozone->footer_labels.cancel.str,
|
||||
icon_x + icon_size + icon_padding,
|
||||
label_y,
|
||||
video_dims,
|
||||
@@ -10493,6 +10492,10 @@ static void ozone_cache_footer_labels(ozone_handle_t *ozone)
|
||||
&ozone->footer_labels.back,
|
||||
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK);
|
||||
|
||||
ozone_cache_footer_label(ozone,
|
||||
&ozone->footer_labels.cancel,
|
||||
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CANCEL);
|
||||
|
||||
ozone_cache_footer_label(ozone,
|
||||
&ozone->footer_labels.search,
|
||||
MENU_ENUM_LABEL_VALUE_SEARCH);
|
||||
|
||||
@@ -401,6 +401,10 @@ void cb_generic_download(retro_task_t *task,
|
||||
void *task_data,
|
||||
void *user_data, const char *err);
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
int action_ok_download_bundle(enum msg_hash_enums enum_idx);
|
||||
#endif
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
+3
-1
@@ -17,6 +17,8 @@
|
||||
#ifndef __MENU_DEFINES__H
|
||||
#define __MENU_DEFINES__H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include "../audio/audio_defines.h"
|
||||
@@ -601,7 +603,7 @@ struct menu_dialog
|
||||
unsigned confirm_msg;
|
||||
unsigned confirm_cmd;
|
||||
unsigned pending_cmd;
|
||||
char confirm_text[512];
|
||||
uint8_t first_run_downloads; /* bundles to fetch on OK */
|
||||
bool confirm_hover_ok;
|
||||
bool confirm_hover_back;
|
||||
bool pending_push;
|
||||
|
||||
+82
-131
@@ -45,8 +45,6 @@
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#include "../network/netplay/netplay.h"
|
||||
#include "../tasks/task_file_transfer.h"
|
||||
#include <net/net_http.h>
|
||||
#endif
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
@@ -3772,8 +3770,7 @@ static enum action_iterate_type action_iterate_type(const char *label, struct me
|
||||
/* a combination being set by holding its buttons: over any list */
|
||||
if (input_entry_capture_running())
|
||||
return ITERATE_TYPE_ENTRY_CAPTURE;
|
||||
if ( (menu_st->dialog_st.confirm_msg || menu_st->dialog_st.confirm_text[0])
|
||||
&& menu_st->dialog_st.confirm_cmd)
|
||||
if (menu_st->dialog_st.confirm_msg && menu_st->dialog_st.confirm_cmd)
|
||||
return ITERATE_TYPE_CONFIRM;
|
||||
if (!strcmp(label, "info_screen"))
|
||||
return ITERATE_TYPE_INFO;
|
||||
@@ -4042,107 +4039,87 @@ static void bundle_decompressed(retro_task_t *task,
|
||||
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
|
||||
}
|
||||
|
||||
#if defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_COMPRESSION)
|
||||
static void menu_download(enum msg_hash_enums enum_idx)
|
||||
#if defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_COMPRESSION) && defined(HAVE_CONFIGFILE)
|
||||
enum menu_first_run_dl
|
||||
{
|
||||
char s[PATH_MAX_LENGTH];
|
||||
char s2[PATH_MAX_LENGTH];
|
||||
char s3[PATH_MAX_LENGTH];
|
||||
const char *path;
|
||||
file_transfer_t *transf = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *network_buildbot_assets_url =
|
||||
settings->paths.network_buildbot_assets_url;
|
||||
MENU_FIRST_RUN_DL_ASSETS = (1 << 0),
|
||||
MENU_FIRST_RUN_DL_AUTOCONFIG = (1 << 1),
|
||||
MENU_FIRST_RUN_DL_CORE_INFO = (1 << 2),
|
||||
MENU_FIRST_RUN_DL_DATABASES = (1 << 3),
|
||||
MENU_FIRST_RUN_DL_OVERLAYS = (1 << 4)
|
||||
};
|
||||
|
||||
fill_pathname_join_special(s,
|
||||
network_buildbot_assets_url,
|
||||
"frontend", sizeof(s));
|
||||
|
||||
switch (enum_idx)
|
||||
{
|
||||
case MENU_ENUM_LABEL_CB_UPDATE_ASSETS:
|
||||
path = FILE_PATH_ASSETS_ZIP;
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES:
|
||||
path = FILE_PATH_AUTOCONFIG_ZIP;
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES:
|
||||
path = FILE_PATH_CORE_INFO_ZIP;
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_UPDATE_DATABASES:
|
||||
path = FILE_PATH_DATABASE_RDB_ZIP;
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_UPDATE_OVERLAYS:
|
||||
path = FILE_PATH_OVERLAYS_ZIP;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
transf = (file_transfer_t*)calloc(1, sizeof(*transf));
|
||||
transf->enum_idx = enum_idx;
|
||||
strlcpy(transf->path, path, sizeof(transf->path));
|
||||
fill_pathname_join_special(s2, s, path, sizeof(s2));
|
||||
net_http_urlencode_full(s3, s2, sizeof(s3));
|
||||
task_push_http_transfer_file(s3, false,
|
||||
msg_hash_to_str(enum_idx), cb_generic_download, transf);
|
||||
/* A directory that is configured but missing or empty */
|
||||
static bool menu_first_run_dir_missing(const char *dir)
|
||||
{
|
||||
return *dir && (!path_is_directory(dir) || path_is_empty_directory(dir));
|
||||
}
|
||||
|
||||
/* Returns true if any asset is missing; downloads them if first run */
|
||||
static bool menu_first_run_download(settings_t *settings, bool start)
|
||||
/* On a first run the directory usually does not exist yet, so ask the
|
||||
* nearest existing parent. An unknown answer (-1) does not hold the
|
||||
* download back; only a known shortfall does. */
|
||||
static bool menu_first_run_has_space(const char *dir, int64_t need)
|
||||
{
|
||||
bool needed = false;
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
strlcpy(tmp, dir, sizeof(tmp));
|
||||
while (*tmp && !path_is_directory(tmp))
|
||||
path_parent_dir(tmp, strlen(tmp));
|
||||
if (*tmp)
|
||||
{
|
||||
int64_t avail = path_get_free_space(tmp);
|
||||
if (avail >= 0 && avail < need)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Which bundles are missing; scanned once, at menu init */
|
||||
static uint8_t menu_first_run_scan(settings_t *settings)
|
||||
{
|
||||
uint8_t mask = 0;
|
||||
#ifdef HAVE_UPDATE_ASSETS
|
||||
if (!path_is_directory(settings->paths.directory_assets) || path_is_empty_directory(settings->paths.directory_assets))
|
||||
{
|
||||
if (path_get_free_space(settings->paths.directory_assets) >= ASSETS_ZIP_PLUS_DECOMPRESSION_SIZE)
|
||||
{
|
||||
needed = true;
|
||||
if (start)
|
||||
menu_download(MENU_ENUM_LABEL_CB_UPDATE_ASSETS);
|
||||
}
|
||||
}
|
||||
if ( menu_first_run_dir_missing(settings->paths.directory_assets)
|
||||
&& menu_first_run_has_space(settings->paths.directory_assets,
|
||||
ASSETS_ZIP_PLUS_DECOMPRESSION_SIZE))
|
||||
mask |= MENU_FIRST_RUN_DL_ASSETS;
|
||||
#endif
|
||||
if (!path_is_directory(settings->paths.directory_autoconfig) || path_is_empty_directory(settings->paths.directory_autoconfig))
|
||||
{
|
||||
needed = true;
|
||||
if (start)
|
||||
menu_download(MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES);
|
||||
}
|
||||
if (menu_first_run_dir_missing(settings->paths.directory_autoconfig))
|
||||
mask |= MENU_FIRST_RUN_DL_AUTOCONFIG;
|
||||
#ifdef HAVE_UPDATE_CORE_INFO
|
||||
if (!path_is_directory(settings->paths.path_libretro_info) || path_is_empty_directory(settings->paths.path_libretro_info))
|
||||
{
|
||||
needed = true;
|
||||
if (start)
|
||||
menu_download(MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES);
|
||||
}
|
||||
if (menu_first_run_dir_missing(settings->paths.path_libretro_info))
|
||||
mask |= MENU_FIRST_RUN_DL_CORE_INFO;
|
||||
#endif
|
||||
#if defined(HAVE_LIBRETRODB)
|
||||
if (!path_is_directory(settings->paths.path_content_database) || path_is_empty_directory(settings->paths.path_content_database))
|
||||
{
|
||||
if (path_get_free_space(settings->paths.path_content_database) >= DATABASE_RDB_ZIP_PLUS_DECOMPRESSION_SIZE)
|
||||
{
|
||||
needed = true;
|
||||
if (start)
|
||||
menu_download(MENU_ENUM_LABEL_CB_UPDATE_DATABASES);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
if ( menu_first_run_dir_missing(settings->paths.path_content_database)
|
||||
&& menu_first_run_has_space(settings->paths.path_content_database,
|
||||
DATABASE_RDB_ZIP_PLUS_DECOMPRESSION_SIZE))
|
||||
mask |= MENU_FIRST_RUN_DL_DATABASES;
|
||||
#endif
|
||||
#if defined(RARCH_MOBILE) && defined(HAVE_OVERLAY)
|
||||
if (!path_is_directory(settings->paths.directory_overlay) || path_is_empty_directory(settings->paths.directory_overlay))
|
||||
{
|
||||
needed = true;
|
||||
if (start)
|
||||
menu_download(MENU_ENUM_LABEL_CB_UPDATE_OVERLAYS);
|
||||
}
|
||||
if (menu_first_run_dir_missing(settings->paths.directory_overlay))
|
||||
mask |= MENU_FIRST_RUN_DL_OVERLAYS;
|
||||
#endif
|
||||
return needed;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* Confirmed: push the downloads found at init, through the same path
|
||||
* as the Online Updater entries (streamed straight to disk) */
|
||||
void menu_first_run_download_start(void)
|
||||
{
|
||||
menu_first_run_download(config_get_ptr(), true);
|
||||
uint8_t mask = menu_driver_state.dialog_st.first_run_downloads;
|
||||
|
||||
menu_driver_state.dialog_st.first_run_downloads = 0;
|
||||
|
||||
if (mask & MENU_FIRST_RUN_DL_ASSETS)
|
||||
action_ok_download_bundle(MENU_ENUM_LABEL_CB_UPDATE_ASSETS);
|
||||
if (mask & MENU_FIRST_RUN_DL_AUTOCONFIG)
|
||||
action_ok_download_bundle(MENU_ENUM_LABEL_CB_UPDATE_AUTOCONFIG_PROFILES);
|
||||
if (mask & MENU_FIRST_RUN_DL_CORE_INFO)
|
||||
action_ok_download_bundle(MENU_ENUM_LABEL_CB_UPDATE_CORE_INFO_FILES);
|
||||
if (mask & MENU_FIRST_RUN_DL_DATABASES)
|
||||
action_ok_download_bundle(MENU_ENUM_LABEL_CB_UPDATE_DATABASES);
|
||||
if (mask & MENU_FIRST_RUN_DL_OVERLAYS)
|
||||
action_ok_download_bundle(MENU_ENUM_LABEL_CB_UPDATE_OVERLAYS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4159,9 +4136,6 @@ static bool rarch_menu_init(
|
||||
bool menu_show_start_screen = settings->bools.menu_show_start_screen;
|
||||
bool config_save_on_exit = settings->bools.config_save_on_exit;
|
||||
#endif
|
||||
#ifdef HAVE_COMPRESSION
|
||||
bool have_bundled_assets = false;
|
||||
#endif
|
||||
|
||||
/* thumbnail initialization */
|
||||
if (!(menu_st->thumbnail_path_data = gfx_thumbnail_path_init()))
|
||||
@@ -4204,7 +4178,6 @@ static bool rarch_menu_init(
|
||||
!= settings->uints.bundle_assets_extract_last_version)
|
||||
)
|
||||
{
|
||||
have_bundled_assets = true;
|
||||
p_dialog->current_type = MENU_DIALOG_HELP_EXTRACT;
|
||||
task_push_decompress(
|
||||
settings->paths.bundle_assets_src,
|
||||
@@ -4221,21 +4194,14 @@ static bool rarch_menu_init(
|
||||
configuration_set_int(settings,
|
||||
settings->uints.bundle_assets_extract_last_version, 1);
|
||||
}
|
||||
#if defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING)
|
||||
else
|
||||
#if defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_CONFIGFILE)
|
||||
/* First run with nothing bundled: offer what is missing */
|
||||
else if (menu_show_start_screen)
|
||||
{
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
if (!menu_show_start_screen)
|
||||
return true;
|
||||
#endif
|
||||
#ifdef HAVE_COMPRESSION
|
||||
if (have_bundled_assets)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (menu_first_run_download(settings, false))
|
||||
menu_dialog_confirm_set_text(menu_st,
|
||||
msg_hash_to_str(MSG_FIRST_RUN_DOWNLOAD_PROMPT),
|
||||
p_dialog->first_run_downloads = menu_first_run_scan(settings);
|
||||
if (p_dialog->first_run_downloads)
|
||||
menu_dialog_confirm_set(menu_st,
|
||||
MSG_FIRST_RUN_DOWNLOAD_PROMPT,
|
||||
CMD_EVENT_MENU_FIRST_RUN_DOWNLOAD);
|
||||
}
|
||||
#endif
|
||||
@@ -7129,21 +7095,20 @@ MENU_NOINLINE static int menu_input_post_iterate(
|
||||
* outside of Back/OK buttons */
|
||||
else if (messagebox_active)
|
||||
{
|
||||
if (menu_st->dialog_st.confirm_cmd)
|
||||
/* A confirm dialog is answered by any tap: OK confirms,
|
||||
* anywhere else cancels, so it cannot be left half-closed */
|
||||
unsigned confirm_cmd = menu_st->dialog_st.confirm_cmd;
|
||||
bool hover_ok = menu_st->dialog_st.confirm_hover_ok;
|
||||
|
||||
menu_input_pointer_close_messagebox(menu_st);
|
||||
|
||||
if (confirm_cmd)
|
||||
{
|
||||
if (menu_st->dialog_st.confirm_hover_ok)
|
||||
{
|
||||
menu_input_pointer_close_messagebox(menu_st);
|
||||
if (hover_ok)
|
||||
menu_dialog_confirm(menu_st);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_input_pointer_close_messagebox(menu_st);
|
||||
menu_dialog_confirm_clear(menu_st);
|
||||
}
|
||||
}
|
||||
else
|
||||
menu_input_pointer_close_messagebox(menu_st);
|
||||
}
|
||||
/* Normal menu input */
|
||||
else
|
||||
@@ -8414,9 +8379,7 @@ static int generic_menu_iterate(
|
||||
break;
|
||||
case ITERATE_TYPE_CONFIRM:
|
||||
strlcpy(menu->menu_state_msg,
|
||||
menu_st->dialog_st.confirm_text[0]
|
||||
? menu_st->dialog_st.confirm_text
|
||||
: msg_hash_to_str((enum msg_hash_enums)menu_st->dialog_st.confirm_msg),
|
||||
msg_hash_to_str((enum msg_hash_enums)menu_st->dialog_st.confirm_msg),
|
||||
sizeof(menu->menu_state_msg));
|
||||
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
@@ -9809,7 +9772,6 @@ static void menu_dialog_confirm_reset(struct menu_state *menu_st)
|
||||
{
|
||||
menu_st->dialog_st.confirm_msg = MSG_UNKNOWN;
|
||||
menu_st->dialog_st.confirm_cmd = CMD_EVENT_NONE;
|
||||
menu_st->dialog_st.confirm_text[0] = '\0';
|
||||
|
||||
menu_st->dialog_st.confirm_hover_ok = false;
|
||||
menu_st->dialog_st.confirm_hover_back = false;
|
||||
@@ -9822,17 +9784,6 @@ void menu_dialog_confirm_set(struct menu_state *menu_st, unsigned msg, unsigned
|
||||
{
|
||||
menu_st->dialog_st.confirm_msg = msg;
|
||||
menu_st->dialog_st.confirm_cmd = cmd;
|
||||
menu_st->dialog_st.confirm_text[0] = '\0';
|
||||
menu_st->dialog_st.pending_cmd = CMD_EVENT_NONE;
|
||||
}
|
||||
|
||||
void menu_dialog_confirm_set_text(struct menu_state *menu_st,
|
||||
const char *text, unsigned cmd)
|
||||
{
|
||||
menu_st->dialog_st.confirm_msg = MSG_UNKNOWN;
|
||||
menu_st->dialog_st.confirm_cmd = cmd;
|
||||
strlcpy(menu_st->dialog_st.confirm_text, text,
|
||||
sizeof(menu_st->dialog_st.confirm_text));
|
||||
menu_st->dialog_st.pending_cmd = CMD_EVENT_NONE;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -866,11 +866,9 @@ size_t menu_playlists_tab_random_selection(size_t selection);
|
||||
|
||||
void menu_dialog_confirm_set(struct menu_state *menu_st,
|
||||
unsigned msg, unsigned cmd);
|
||||
void menu_dialog_confirm_set_text(struct menu_state *menu_st,
|
||||
const char *text, unsigned cmd);
|
||||
void menu_dialog_confirm_clear(struct menu_state *menu_st);
|
||||
|
||||
#if defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_COMPRESSION)
|
||||
#if defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_COMPRESSION) && defined(HAVE_CONFIGFILE)
|
||||
void menu_first_run_download_start(void);
|
||||
#endif
|
||||
void menu_dialog_confirm(struct menu_state *menu_st);
|
||||
|
||||
+1
-1
@@ -5666,7 +5666,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
input_driver_restart_with_next_video_restart();
|
||||
break;
|
||||
case CMD_EVENT_MENU_FIRST_RUN_DOWNLOAD:
|
||||
#if defined(HAVE_MENU) && defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_COMPRESSION)
|
||||
#if defined(HAVE_MENU) && defined(HAVE_ONLINE_UPDATER) && defined(HAVE_NETWORKING) && defined(HAVE_COMPRESSION) && defined(HAVE_CONFIGFILE)
|
||||
menu_first_run_download_start();
|
||||
#endif
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user