mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-09-12 20:45:11 -05:00
Get Text mode working.
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
#include "appstates/TextTitleSelectState.hpp"
|
||||
#include "JKSV.hpp"
|
||||
#include "appstates/BackupMenuState.hpp"
|
||||
#include "appstates/MainMenuState.hpp"
|
||||
#include "appstates/TitleOptionState.hpp"
|
||||
#include "colors.hpp"
|
||||
#include "config.hpp"
|
||||
#include "fs/save_mount.hpp"
|
||||
#include "fslib.hpp"
|
||||
#include "input.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "sdl.hpp"
|
||||
#include <string_view>
|
||||
|
||||
@@ -26,10 +32,57 @@ void TextTitleSelectState::update(void)
|
||||
{
|
||||
m_titleSelectMenu.update(AppState::has_focus());
|
||||
|
||||
if (input::button_pressed(HidNpadButton_Y))
|
||||
// Both title selection states work too differently for this stuff to be shared IMO.
|
||||
if (input::button_pressed(HidNpadButton_A))
|
||||
{
|
||||
config::add_remove_favorite(m_user->get_application_id_at(m_titleSelectMenu.get_selected()));
|
||||
TextTitleSelectState::refresh();
|
||||
// Grab selected.
|
||||
int selected = m_titleSelectMenu.get_selected();
|
||||
|
||||
// Grab what we need to continue.
|
||||
uint64_t applicationID = m_user->get_application_id_at(selected);
|
||||
FsSaveDataInfo *saveInfo = m_user->get_save_info_by_id(applicationID);
|
||||
data::TitleInfo *titleInfo = data::get_title_info_by_id(m_user->get_application_id_at(selected));
|
||||
|
||||
// Output path.
|
||||
fslib::Path targetPath = config::get_working_directory() / titleInfo->get_path_safe_title();
|
||||
|
||||
if ((fslib::directory_exists(targetPath) || fslib::create_directory(targetPath)) &&
|
||||
fslib::open_save_data_with_save_info(fs::DEFAULT_SAVE_MOUNT, *saveInfo))
|
||||
{
|
||||
JKSV::push_state(std::make_shared<BackupMenuState>(m_user,
|
||||
titleInfo,
|
||||
static_cast<FsSaveDataType>(saveInfo->save_data_type)));
|
||||
}
|
||||
else
|
||||
{
|
||||
logger::log(fslib::get_error_string());
|
||||
}
|
||||
}
|
||||
else if (input::button_pressed(HidNpadButton_X))
|
||||
{
|
||||
int selected = m_titleSelectMenu.get_selected();
|
||||
|
||||
uint64_t applicationID = m_user->get_application_id_at(selected);
|
||||
data::TitleInfo *titleInfo = data::get_title_info_by_id(applicationID);
|
||||
|
||||
JKSV::push_state(std::make_shared<TitleOptionState>(m_user, titleInfo, this));
|
||||
}
|
||||
else if (input::button_pressed(HidNpadButton_Y))
|
||||
{
|
||||
uint64_t applicationID = m_user->get_application_id_at(m_titleSelectMenu.get_selected());
|
||||
|
||||
config::add_remove_favorite(applicationID);
|
||||
|
||||
// We need to resort all users, not just this one.
|
||||
data::UserList list;
|
||||
data::get_users(list);
|
||||
for (data::User *user : list)
|
||||
{
|
||||
user->sort_data();
|
||||
}
|
||||
|
||||
// Let the main menu state take care of this.
|
||||
MainMenuState::refresh_view_states();
|
||||
}
|
||||
else if (input::button_pressed(HidNpadButton_B))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user