Restart Menu on theme change

This commit is contained in:
XorTroll 2020-02-12 16:28:11 +01:00
parent 2c02a41a6c
commit bb48192a62
5 changed files with 34 additions and 32 deletions

View file

@ -41,6 +41,7 @@ hb::HbTargetParams hbapplaunch_flag_temp = {};
u64 titlelaunch_flag = 0;
WebCommonConfig webapplet_flag = {};
bool album_flag = false;
bool menu_restart_flag = false;
bool app_opened_hb = false;
u8 *usbbuf = nullptr;
cfg::Config config = {};
@ -317,6 +318,13 @@ void HandleMenuMessage()
break;
}
case am::DaemonMessage::RestartMenu:
{
reader.FinishRead();
menu_restart_flag = true;
break;
}
default:
break;
}
@ -377,6 +385,17 @@ namespace daemn
memset(&webapplet_flag, 0, sizeof(webapplet_flag));
}
}
if(menu_restart_flag)
{
if(!am::LibraryAppletIsActive())
{
auto status = CreateStatus();
UL_R_TRY(LaunchMenu(am::MenuStartMode::StartupScreen, status))
sth_done = true;
menu_restart_flag = false;
}
}
if(album_flag)
{
if(!am::LibraryAppletIsActive())

View file

@ -35,6 +35,7 @@ namespace am
OpenWebPage,
GetSelectedUser,
OpenAlbum,
RestartMenu,
};
struct DaemonStatus

View file

@ -5,34 +5,6 @@
namespace am
{
namespace controller
{
struct InitialArg
{
u32 this_size;
u32 arg_size;
bool unk2; // unk2 (and unk3?) need to be true for controller to launch
bool unk3;
u8 mode; // Changing this doesn't seem to affect, but this is the mode according to SDK RE...?
u32 npad_style_set;
u32 npad_joy_hold_type;
} PACKED;
struct MainArg
{
s8 min_player_count;
s8 max_player_count;
bool take_over_connection;
bool left_justify;
bool permit_dual_joy;
bool single_mode;
bool use_colors;
u32 colors[4];
bool use_controller_names;
char controller_names[4][0x81];
} PACKED;
}
bool LibraryAppletIsActive();
void LibraryAppletSetMenuAppletId(AppletId id);
bool LibraryAppletIsMenu();

View file

@ -4,8 +4,6 @@
namespace am
{
static Service g_daemon_private_srv;
#define UL_AM_LOOP_TRY_WITH(...) { \
Result rc = 0; \
do \

View file

@ -131,7 +131,13 @@ namespace ui
{
g_ul_config.theme_name = "";
cfg::SaveConfig(g_ul_config);
g_menu_app_instance->ShowNotification(cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "theme_changed"));
am::MenuCommandWriter writer(am::DaemonMessage::RestartMenu);
writer.FinishWrite();
g_menu_app_instance->StopPlayBGM();
g_menu_app_instance->CloseWithFadeOut();
// g_menu_app_instance->ShowNotification(cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "theme_changed"));
}
}
}
@ -148,7 +154,13 @@ namespace ui
{
g_ul_config.theme_name = seltheme.base_name;
cfg::SaveConfig(g_ul_config);
g_menu_app_instance->ShowNotification(cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "theme_changed"));
am::MenuCommandWriter writer(am::DaemonMessage::RestartMenu);
writer.FinishWrite();
g_menu_app_instance->StopPlayBGM();
g_menu_app_instance->CloseWithFadeOut();
// g_menu_app_instance->ShowNotification(cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "theme_changed"));
}
}
}