mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-09-12 12:35:26 -05:00
Implement data reinitialization/cache rebuilding.
This commit is contained in:
@@ -1,13 +1,29 @@
|
||||
#include "appstates/ExtrasMenuState.hpp"
|
||||
#include "appstates/MainMenuState.hpp"
|
||||
#include "colors.hpp"
|
||||
#include "data/data.hpp"
|
||||
#include "input.hpp"
|
||||
#include "keyboard.hpp"
|
||||
#include "strings.hpp"
|
||||
#include "ui/PopMessageManager.hpp"
|
||||
#include <string_view>
|
||||
|
||||
namespace
|
||||
{
|
||||
// This target is shared be a lot of states.
|
||||
constexpr std::string_view SECONDARY_TARGET = "SecondaryTarget";
|
||||
|
||||
// Enum for switch case readability.
|
||||
enum
|
||||
{
|
||||
REINIT_DATA,
|
||||
SD_TO_SD_BROWSER,
|
||||
BIS_PRODINFO_F,
|
||||
BIS_SAFE,
|
||||
BIS_SYSTEM,
|
||||
BIS_USER,
|
||||
TERMINATE_PROCESS
|
||||
};
|
||||
} // namespace
|
||||
|
||||
ExtrasMenuState::ExtrasMenuState(void)
|
||||
@@ -29,7 +45,24 @@ void ExtrasMenuState::update(void)
|
||||
{
|
||||
m_extrasMenu.update(AppState::has_focus());
|
||||
|
||||
if (input::button_pressed(HidNpadButton_B))
|
||||
if (input::button_pressed(HidNpadButton_A))
|
||||
{
|
||||
switch (m_extrasMenu.get_selected())
|
||||
{
|
||||
case REINIT_DATA:
|
||||
{
|
||||
// Reinitialize the data with the cache cleared.
|
||||
data::initialize(true);
|
||||
ui::PopMessageManager::push_message(ui::PopMessageManager::DEFAULT_MESSAGE_TICKS,
|
||||
strings::get_by_name(strings::names::EXTRAS_POP_MESSAGES, 0));
|
||||
|
||||
// This should be adequate for this...
|
||||
MainMenuState::refresh_view_states();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (input::button_pressed(HidNpadButton_B))
|
||||
{
|
||||
AppState::deactivate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user