Implement shuffle from main menu

This commit is contained in:
RandyTheSilly committed 2026-10-11 18:17:03 -04:00
1 parent f8ef8b5667
commit 0bf16cda63
2 files changed
+120 -4

No files matched your search

+25 -2
View File
@@ -142,6 +142,29 @@ static void to_pkjs_play_from_track(uint16_t seqId) {
}
}
static void to_pkjs_shuffle_in_scope(NavScope scope, uint16_t *subscope_index, bool use_groups) {
if (!s_pkjs_ready) {
return;
}
DictionaryIterator *out;
AppMessageResult result = app_message_outbox_begin(&out);
if (result != APP_MSG_OK) {
return;
}
const char *subscope = subscope_index ? s_current_menu_vanity[*subscope_index] : "";
if (subscope_index) {
dict_write_cstring(out, MESSAGE_KEY_OUT_MENU_NAV_SUBSCOPE, subscope);
}
dict_write_uint8(out, MESSAGE_KEY_BIDIR_MENU_NAV_SCOPE, scope);
dict_write_uint8(out, MESSAGE_KEY_OUT_SHUFFLE_MODE, use_groups ? 2 : 1);
result = app_message_outbox_send();
if (result != APP_MSG_OK) {
return;
}
}
static void to_pkjs_move_deeper(NavScope scope, uint16_t *subscope_index) {
if (!s_pkjs_ready) {
return;
@@ -236,10 +259,10 @@ static void menu_select_click(struct MenuLayer *menu_layer, MenuIndex *clicked_i
case NAV_SCOPE_MAIN:
switch (clicked_index->row) {
case 0:
// TODO tell PKJS to shuffle all songs
to_pkjs_shuffle_in_scope(s_current_menu_scope, NULL, false);
break;
case 1:
// TODO tell PKJS to shuffle artists
to_pkjs_shuffle_in_scope(s_current_menu_scope, NULL, true);
break;
case 2:
to_pkjs_move_deeper(NAV_SCOPE_ARTISTS, NULL);