yati: signal change to games menu when a new game is installed.

This commit is contained in:
ITotalJustice
2025-09-14 14:52:21 +01:00
parent a019103ed5
commit c05ce5eff4
3 changed files with 18 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ enum OrderType {
using LayoutType = grid::LayoutType;
void SignalChange();
struct Menu final : grid::Menu {
Menu(u32 flags);
~Menu();

View File

@@ -36,6 +36,8 @@
namespace sphaira::ui::menu::game {
namespace {
constinit UEvent g_change_uevent;
struct NspSource final : dump::BaseSource {
NspSource(const std::vector<NspEntry>& entries) : m_entries{entries} {
m_is_file_based_emummc = App::IsFileBaseEmummc();
@@ -270,6 +272,10 @@ Result NspEntry::Read(void* buf, s64 off, s64 size, u64* bytes_read) {
return 0x1;
}
void SignalChange() {
ueventSignal(&g_change_uevent);
}
Menu::Menu(u32 flags) : grid::Menu{"Games"_i18n, flags} {
this->SetActions(
std::make_pair(Button::L3, Action{[this](){
@@ -455,6 +461,7 @@ Menu::Menu(u32 flags) : grid::Menu{"Games"_i18n, flags} {
fsOpenGameCardDetectionEventNotifier(std::addressof(m_gc_event_notifier));
fsEventNotifierGetEventHandle(std::addressof(m_gc_event_notifier), std::addressof(m_gc_event), true);
ueventCreate(&g_change_uevent, true);
}
Menu::~Menu() {
@@ -469,8 +476,10 @@ Menu::~Menu() {
}
void Menu::Update(Controller* controller, TouchInfo* touch) {
// force update if gamecard state changed.
m_dirty |= R_SUCCEEDED(eventWait(&m_gc_event, 0));
s32 wait_dummy_idx;
if (R_SUCCEEDED(waitMulti(&wait_dummy_idx, 0, waiterForEvent(&m_gc_event), waiterForUEvent(&g_change_uevent)))) {
m_dirty = true;
}
if (m_dirty) {
App::Notify("Updating application record list"_i18n);

View File

@@ -16,6 +16,8 @@
#include "utils/thread.hpp"
#include "ui/progress_box.hpp"
#include "ui/menus/game_menu.hpp"
#include "app.hpp"
#include "i18n.hpp"
#include "log.hpp"
@@ -873,6 +875,9 @@ Yati::~Yati() {
}
App::SetAutoSleepDisabled(false);
// force update the game menu, as we may have installed a game.
ui::menu::game::SignalChange();
}
Result Yati::Setup(const ConfigOverride& override) {