win32+core_updater: fix taskbar progress overlay during downloads

The Win32 taskbar progress overlay (the green bar drawn on the
RetroArch taskbar icon during downloads) never appeared. Two
independent bugs were keeping it dark:

1) wndproc: the 'TaskbarButtonCreated' message check was nested
   inside unrelated 'case' arms (WM_MOUSEMOVE..WM_NCLBUTTONDBLCLK,
   WM_DROPFILES..WM_COMMAND, and the WM_PAINT branch of the GDI
   wrappers). Since 'TaskbarButtonCreated' is a registered window
   message with its own dynamically-allocated value, those arms
   could never match it, so WIN32_CMN_FLAG_TASKBAR_CREATED was
   never set and dispserv_win32's set_window_progress() always
   early-outed without calling ITaskbarList3::SetProgressValue.

   Move the comparison to the top of each dispatcher
   (wnd_proc_common, wnd_proc_common_internal,
   wnd_proc_winraw_common_internal, wnd_proc_common_dinput_internal)
   so it sees every incoming message. Short-circuit on the flag
   bit so the comparison only runs until the message arrives once.
   The HAVE_TASKBAR gate is unchanged; pre-Win7 builds either don't
   define it or fall back through the existing taskbar_list NULL
   guard in dispserv_win32.

2) task_core_updater: even with the flag set, the five outer
   aggregating tasks (get_list, single download,
   update_installed_cores, play_feature_delivery_install,
   play_feature_delivery_switch) never set a progress_cb. They
   spawn inner http transfers with mute=true to suppress per-core
   on-screen toasts, which also suppresses the inner tasks'
   progress_cb invocation in task_queue_push_progress(). Net
   result: video_display_server_set_window_progress() was never
   being called during a Core Updater run.

   Promote the existing http progress forwarder
   (http_transfer_progress_cb in task_http.c) to a public helper
   named task_window_progress_cb, declare it in tasks_internal.h,
   and wire it as the progress_cb of all five outer tasks. The
   aggregating tasks already drive task->progress in 0..100 across
   their state machines, so no other plumbing is needed.

Single-zip update flows (Update Assets, Update Cheats, Update
Databases, etc.) were already working because their underlying
http transfer is unmuted and titled, and the existing progress_cb
fired for those.
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-04-28 17:08:41 +02:00
1 parent 5f0afac80f
commit d1228e6854
4 files changed
+49 -47

No files matched your search

+29 -45
View File
@@ -508,6 +508,14 @@ static LRESULT CALLBACK wnd_proc_common(
bool *quit, HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam)
{
#ifdef HAVE_TASKBAR
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
if ( !(g_win32_flags & WIN32_CMN_FLAG_TASKBAR_CREATED)
&& g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
switch (message)
{
case WM_SYSCOMMAND:
@@ -709,6 +717,13 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
bool quit = false;
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
#ifdef HAVE_TASKBAR
if ( !(g_win32_flags & WIN32_CMN_FLAG_TASKBAR_CREATED)
&& g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
switch (message)
{
case WM_KEYUP: /* Key released */
@@ -771,10 +786,6 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
case WM_NCLBUTTONDBLCLK:
#ifdef HAVE_TASKBAR
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
break;
case WM_DROPFILES:
case WM_SYSCOMMAND:
@@ -793,10 +804,6 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
ret = wnd_proc_common(&quit, hwnd, message, wparam, lparam);
if (quit)
return ret;
#ifdef HAVE_TASKBAR
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
break;
case WM_SETFOCUS:
#ifdef HAVE_CLIP_WINDOW
@@ -830,6 +837,13 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
bool quit = false;
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
#ifdef HAVE_TASKBAR
if ( !(g_win32_flags & WIN32_CMN_FLAG_TASKBAR_CREATED)
&& g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
switch (message)
{
case WM_KEYUP: /* Key released */
@@ -857,10 +871,6 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
case WM_NCLBUTTONDBLCLK:
#ifdef HAVE_TASKBAR
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
break;
case WM_DROPFILES:
case WM_SYSCOMMAND:
@@ -879,10 +889,6 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
ret = wnd_proc_common(&quit, hwnd, message, wparam, lparam);
if (quit)
return ret;
#ifdef HAVE_TASKBAR
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
break;
case WM_SETFOCUS:
#ifdef HAVE_CLIP_WINDOW
@@ -936,6 +942,13 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
bool quit = false;
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
#ifdef HAVE_TASKBAR
if ( !(g_win32_flags & WIN32_CMN_FLAG_TASKBAR_CREATED)
&& g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
switch (message)
{
case WM_IME_ENDCOMPOSITION:
@@ -1074,10 +1087,6 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
case WM_NCLBUTTONDBLCLK:
#ifdef HAVE_TASKBAR
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
#if !defined(_XBOX)
{
void* input_data = (void*)(LONG_PTR)GetWindowLongPtr(main_window.hwnd, GWLP_USERDATA);
@@ -1104,10 +1113,6 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
ret = wnd_proc_common(&quit, hwnd, message, wparam, lparam);
if (quit)
return ret;
#ifdef HAVE_TASKBAR
if (g_win32->taskbar_message && message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
break;
case WM_SETFOCUS:
#ifdef HAVE_CLIP_WINDOW
@@ -1342,7 +1347,6 @@ LRESULT CALLBACK wnd_proc_gdi_dinput(HWND hwnd, UINT message,
return wnd_proc_wm_gdi_create(hwnd);
else if (message == WM_PAINT)
{
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
gdi_t *gdi = (gdi_t*)video_driver_get_ptr();
if (gdi && gdi->memDC)
@@ -1365,12 +1369,6 @@ LRESULT CALLBACK wnd_proc_gdi_dinput(HWND hwnd, UINT message,
SelectObject(gdi->memDC, gdi->bmp_old);
}
#ifdef HAVE_TASKBAR
if ( g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
}
return wnd_proc_common_dinput_internal(hwnd, message, wparam, lparam);
@@ -1385,7 +1383,6 @@ LRESULT CALLBACK wnd_proc_gdi_winraw(HWND hwnd, UINT message,
return wnd_proc_wm_gdi_create(hwnd);
else if (message == WM_PAINT)
{
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
gdi_t *gdi = (gdi_t*)video_driver_get_ptr();
if (gdi && gdi->memDC)
@@ -1408,12 +1405,6 @@ LRESULT CALLBACK wnd_proc_gdi_winraw(HWND hwnd, UINT message,
SelectObject(gdi->memDC, gdi->bmp_old);
}
#ifdef HAVE_TASKBAR
if ( g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
}
return wnd_proc_winraw_common_internal(hwnd, message, wparam, lparam);
@@ -1427,7 +1418,6 @@ LRESULT CALLBACK wnd_proc_gdi_common(HWND hwnd, UINT message,
return wnd_proc_wm_gdi_create(hwnd);
else if (message == WM_PAINT)
{
win32_common_state_t *g_win32 = (win32_common_state_t*)&win32_st;
gdi_t *gdi = (gdi_t*)video_driver_get_ptr();
if (gdi && gdi->memDC)
@@ -1450,12 +1440,6 @@ LRESULT CALLBACK wnd_proc_gdi_common(HWND hwnd, UINT message,
SelectObject(gdi->memDC, gdi->bmp_old);
}
#ifdef HAVE_TASKBAR
if ( g_win32->taskbar_message
&& message == g_win32->taskbar_message)
g_win32_flags |= WIN32_CMN_FLAG_TASKBAR_CREATED;
#endif
}
return wnd_proc_common_internal(hwnd, message, wparam, lparam);
+5
View File
@@ -476,6 +476,7 @@ void *task_push_get_core_updater_list(
task->state = list_handle;
task->title = strdup(msg_hash_to_str(MSG_FETCHING_CORE_LIST));
task->progress = 0;
task->progress_cb = task_window_progress_cb;
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
if (mute)
task->flags |= RETRO_TASK_FLG_MUTE;
@@ -1118,6 +1119,7 @@ void *task_push_core_updater_download(
task->state = download_handle;
task->title = strdup(task_title);
task->progress = 0;
task->progress_cb = task_window_progress_cb;
task->callback = cb_task_core_updater_download;
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
if (mute)
@@ -1547,6 +1549,7 @@ void task_push_update_installed_cores(
task->state = update_installed_handle;
task->title = strdup(msg_hash_to_str(MSG_FETCHING_CORE_LIST));
task->progress = 0;
task->progress_cb = task_window_progress_cb;
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
/* Push task */
@@ -1869,6 +1872,7 @@ void *task_push_play_feature_delivery_core_install(
task->state = pfd_install_handle;
task->title = strdup(task_title);
task->progress = 0;
task->progress_cb = task_window_progress_cb;
task->callback = cb_task_core_updater_download;
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
if (mute)
@@ -2239,6 +2243,7 @@ void task_push_play_feature_delivery_switch_installed_cores(
task->state = pfd_switch_cores_handle;
task->title = strdup(msg_hash_to_str(MSG_SCANNING_CORES));
task->progress = 0;
task->progress_cb = task_window_progress_cb;
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
/* Push task */
+7 -2
View File
@@ -243,7 +243,12 @@ static bool task_http_finder(retro_task_t *task, void *user_data)
return false;
}
static void http_transfer_progress_cb(retro_task_t *task)
/* Forward task progress to the platform's window/taskbar progress
* indicator (e.g. ITaskbarList3 on Win32). Exposed via tasks_internal.h
* so non-HTTP tasks (such as the Core Updater's outer aggregating tasks)
* can wire it as their progress_cb and have the desktop reflect their
* progress, the same way titled HTTP transfers already do. */
void task_window_progress_cb(retro_task_t *task)
{
#ifdef RARCH_INTERNAL
if (task)
@@ -312,7 +317,7 @@ static void *task_push_http_transfer_generic_titled(
t->handler = task_http_transfer_handler;
t->state = http;
t->callback = cb;
t->progress_cb = http_transfer_progress_cb;
t->progress_cb = task_window_progress_cb;
t->cleanup = task_http_transfer_cleanup;
t->user_data = user_data;
t->progress = -1;
+8
View File
@@ -61,6 +61,14 @@ typedef struct
int status;
} http_transfer_data_t;
/* Generic progress_cb that forwards a task's progress (0-100) to the
* platform's window/taskbar progress indicator. Set this on any task
* whose progress should be reflected on the taskbar -- aggregating
* tasks (e.g. the Core Updater's outer task) need to do this manually
* because their inner http transfers run muted and so their own
* progress callbacks never fire. */
void task_window_progress_cb(retro_task_t *task);
void *task_push_http_transfer(const char *url, bool mute, const char *type,
retro_task_callback_t cb, void *userdata);