mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-04-25 16:15:11 -05:00
Implement data reinitialization/cache rebuilding.
This commit is contained in:
parent
025c778011
commit
53c9a4633f
|
|
@ -17,6 +17,7 @@ namespace strings
|
|||
static constexpr std::string_view SAVE_DATA_TYPES = "SaveDataTypes";
|
||||
static constexpr std::string_view SETTINGS_MENU = "SettingsMenu";
|
||||
static constexpr std::string_view EXTRAS_MENU = "ExtrasMenu";
|
||||
static constexpr std::string_view EXTRAS_POP_MESSAGES = "ExtrasPopMessages";
|
||||
static constexpr std::string_view YES_NO = "YesNo";
|
||||
static constexpr std::string_view HOLDING_STRINGS = "HoldingStrings";
|
||||
static constexpr std::string_view ON_OFF = "OnOff";
|
||||
|
|
|
|||
|
|
@ -60,14 +60,16 @@
|
|||
"Sets the speed at which transitions and animations occur. Lower is faster."
|
||||
],
|
||||
"ExtrasMenu": [
|
||||
"Reload Titles",
|
||||
"Reinitialize Data",
|
||||
"SD to SD Browser",
|
||||
"BIS: ProdInfoF",
|
||||
"BIS: Safe",
|
||||
"BIS: System",
|
||||
"BIS: User",
|
||||
"Terminate Process",
|
||||
"Mount System Save"
|
||||
"Terminate Process"
|
||||
],
|
||||
"ExtrasPopMessages": [
|
||||
"Data reinitialized!"
|
||||
],
|
||||
"YesNo": [
|
||||
"Yes [A]",
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user