diff --git a/Makefile b/Makefile index 2b794e4..c530ee2 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ INCLUDES := include ./Libraries/FsLib/Switch/FsLib/include ./Libraries/SDLLib/SD EXEFS_SRC := exefs_src APP_TITLE := JKSV APP_AUTHOR := JK -APP_VERSION := 10.09.2025 +APP_VERSION := 10.10.2025 ROMFS := romfs ICON := icon.jpg diff --git a/include/appstates/MainMenuState.hpp b/include/appstates/MainMenuState.hpp index ae5eb52..b2d9364 100644 --- a/include/appstates/MainMenuState.hpp +++ b/include/appstates/MainMenuState.hpp @@ -104,9 +104,6 @@ class MainMenuState final : public BaseState /// @brief Silently checks for an update in the background. void check_for_update(); - /// @brief Plays the little boot sound. - void play_boot_sound(); - /// @brief Pushes the target state to the vector. void push_target_state(); diff --git a/include/builddate.hpp b/include/builddate.hpp index 63aaee9..5aac9cd 100644 --- a/include/builddate.hpp +++ b/include/builddate.hpp @@ -3,6 +3,6 @@ namespace builddate { inline constexpr int MONTH = 10; - inline constexpr int DAY = 9; + inline constexpr int DAY = 10; inline constexpr int YEAR = 2025; } diff --git a/include/ui/Menu.hpp b/include/ui/Menu.hpp index 3674dda..7c0983b 100644 --- a/include/ui/Menu.hpp +++ b/include/ui/Menu.hpp @@ -71,6 +71,9 @@ namespace ui /// @brief Returns if the menu has no options. bool is_empty() const noexcept; + /// @brief Plays the cursor sound effect since it can be conditional. + void play_sound() noexcept; + /// @brief Resets the menu and returns it to an empty, default state. void reset(bool full = true); @@ -140,7 +143,7 @@ namespace ui void initialize_ui_elements(); /// @brief Ensures the menu cursor sound is loaded. - void initialize_cursor_sound(); + void initialize_sounds(); /// @brief Updates the text scroll for the currently highlighted option. void update_scroll_text(); diff --git a/include/ui/TitleView.hpp b/include/ui/TitleView.hpp index 5fda390..af2164c 100644 --- a/include/ui/TitleView.hpp +++ b/include/ui/TitleView.hpp @@ -46,6 +46,9 @@ namespace ui /// @brief Resets the view to its default, empty state. void reset(); + /// @brief Plays the cursor sound. + void play_sound() noexcept; + private: /// @brief Pointer to user passed. data::User *m_user{}; diff --git a/romfs/Sound/PopMessage.wav b/romfs/Sound/PopMessage.wav index 36b8be9..1adfc16 100644 Binary files a/romfs/Sound/PopMessage.wav and b/romfs/Sound/PopMessage.wav differ diff --git a/romfs/Textures/Frame.png b/romfs/Textures/Frame.png index 74b6862..5d7dc00 100644 Binary files a/romfs/Textures/Frame.png and b/romfs/Textures/Frame.png differ diff --git a/source/appstates/BackupMenuState.cpp b/source/appstates/BackupMenuState.cpp index 2eba56f..009759d 100644 --- a/source/appstates/BackupMenuState.cpp +++ b/source/appstates/BackupMenuState.cpp @@ -193,7 +193,7 @@ void BackupMenuState::save_data_check() void BackupMenuState::initialize_remote_storage() { remote::Storage *remote = remote::get_remote_storage(); - if (error::is_null(remote)) { return; } + if (!remote) { return; } const bool supportsUtf8 = remote->supports_utf8(); const std::string_view remoteTitle = supportsUtf8 ? m_titleInfo->get_title() : m_titleInfo->get_path_safe_title(); diff --git a/source/appstates/MainMenuState.cpp b/source/appstates/MainMenuState.cpp index 4d7bc17..a0c077c 100644 --- a/source/appstates/MainMenuState.cpp +++ b/source/appstates/MainMenuState.cpp @@ -35,7 +35,6 @@ MainMenuState::MainMenuState() MainMenuState::initialize_view_states(); MainMenuState::initialize_data_struct(); MainMenuState::check_for_update(); - MainMenuState::play_boot_sound(); } void MainMenuState::update() @@ -137,15 +136,6 @@ void MainMenuState::initialize_data_struct() void MainMenuState::check_for_update() { sys::threadpool::push_job(tasks::update::check_for_update, m_dataStruct); } -void MainMenuState::play_boot_sound() -{ - // static constexpr std::string_view BOOT_NAME = "BootSound"; - // static constexpr const char *BOOT_PATH = "romfs:/Sound/Boot.wav"; - - // sdl::SharedSound bootSound = sdl::SoundManager::load(BOOT_NAME, BOOT_PATH); - // bootSound->play(); -} - void MainMenuState::push_target_state() { const int popTicks = ui::PopMessageManager::DEFAULT_TICKS; @@ -169,6 +159,7 @@ void MainMenuState::push_target_state() auto &target = sm_states[selected]; target->reactivate(); StateManager::push_state(target); + m_mainMenu->play_sound(); } void MainMenuState::create_user_options() diff --git a/source/appstates/TitleSelectState.cpp b/source/appstates/TitleSelectState.cpp index dbc5e47..54489d9 100644 --- a/source/appstates/TitleSelectState.cpp +++ b/source/appstates/TitleSelectState.cpp @@ -81,6 +81,7 @@ void TitleSelectState::create_backup_menu() auto backupMenu = std::make_shared(m_user, titleInfo, saveInfo); StateManager::push_state(backupMenu); + m_titleView->play_sound(); } void TitleSelectState::create_title_option_menu() diff --git a/source/tasks/backup.cpp b/source/tasks/backup.cpp index ed254c0..3e80043 100644 --- a/source/tasks/backup.cpp +++ b/source/tasks/backup.cpp @@ -481,13 +481,9 @@ static void auto_backup(sys::ProgressTask *task, BackupMenuState::TaskData taskD remote::Storage *remote = remote::get_remote_storage(); data::User *user = taskData->user; data::TitleInfo *titleInfo = taskData->titleInfo; + const FsSaveDataInfo *saveInfo = taskData->saveInfo; fslib::Path &target = taskData->path; - BackupMenuState *spawningState = taskData->spawningState; - if (error::is_null(user) || error::is_null(titleInfo)) { return; } - - const uint64_t applicationID = titleInfo->get_application_id(); - const FsSaveDataInfo *saveInfo = user->get_save_info_by_id(applicationID); - if (error::is_null(saveInfo)) { return; } + if (error::is_null(user) || error::is_null(titleInfo) || error::is_null(saveInfo)) { return; } { fs::ScopedSaveMount testMount{fs::DEFAULT_SAVE_MOUNT, saveInfo, false}; @@ -504,18 +500,13 @@ static void auto_backup(sys::ProgressTask *task, BackupMenuState::TaskData taskD std::string backupName = stringutil::get_formatted_string("AUTO - %s - %s", safeNickname, dateString.c_str()); if (zip) { backupName += STRING_ZIP_EXT; } - auto tempData = std::make_shared(); - tempData->task = task; - tempData->user = user; - tempData->titleInfo = titleInfo; - tempData->spawningState = spawningState; - tempData->killTask = false; + taskData->killTask = false; if (autoUpload && remote) { - tempData->remoteName = std::move(backupName); + taskData->remoteName = std::move(backupName); - tasks::backup::create_new_backup_remote(tempData); + tasks::backup::create_new_backup_remote(taskData); } else { @@ -525,22 +516,25 @@ static void auto_backup(sys::ProgressTask *task, BackupMenuState::TaskData taskD fslib::Path autoTarget{target.sub_path(lastSlash) / backupName}; - tempData->path = std::move(autoTarget); + // This is used to move and store the path before using the local auto path. + fslib::Path storePath = std::move(taskData->path); + // Swap em. + taskData->path = std::move(autoTarget); - tasks::backup::create_new_backup_local(tempData); + tasks::backup::create_new_backup_local(taskData); + + // Swap em back. + taskData->path = std::move(storePath); } } static bool read_and_process_meta(const fslib::Path &targetDir, BackupMenuState::TaskData taskData, sys::ProgressTask *task) { - data::User *user = taskData->user; - data::TitleInfo *titleInfo = taskData->titleInfo; + data::User *user = taskData->user; + data::TitleInfo *titleInfo = taskData->titleInfo; + const FsSaveDataInfo *saveInfo = taskData->saveInfo; if (error::is_null(task)) { return false; } - else if (error::is_null(user) || error::is_null(titleInfo)) { return false; } - - const uint64_t applicationID = titleInfo->get_application_id(); - const FsSaveDataInfo *saveInfo = user->get_save_info_by_id(applicationID); - if (error::is_null(saveInfo)) { return false; } + else if (error::is_null(user) || error::is_null(titleInfo) || error::is_null(saveInfo)) { return false; } const int popTicks = ui::PopMessageManager::DEFAULT_TICKS; { diff --git a/source/ui/Menu.cpp b/source/ui/Menu.cpp index e39381b..a929368 100644 --- a/source/ui/Menu.cpp +++ b/source/ui/Menu.cpp @@ -20,7 +20,7 @@ ui::Menu::Menu(int x, int y, int width, int fontSize, int renderTargetHeight) Menu::initialize_transition(); Menu::initialize_option_target(); Menu::initialize_ui_elements(); - Menu::initialize_cursor_sound(); + Menu::initialize_sounds(); } void ui::Menu::update(bool hasFocus) @@ -114,6 +114,8 @@ void ui::Menu::reset(bool full) bool ui::Menu::is_empty() const noexcept { return m_options.empty(); } +void ui::Menu::play_sound() noexcept { sm_cursor->play(); } + void ui::Menu::calculate_alignments() noexcept { m_optionHeight = std::floor(static_cast(m_fontSize) * 1.8f); @@ -156,7 +158,7 @@ void ui::Menu::initialize_ui_elements() false); } -void ui::Menu::initialize_cursor_sound() +void ui::Menu::initialize_sounds() { static constexpr std::string_view CURSOR_NAME = "MenuCursor"; static constexpr const char *CURSOR_PATH = "romfs:/Sound/MenuCursor.wav"; @@ -194,7 +196,7 @@ void ui::Menu::handle_input() if (m_selected < 0) { m_selected = 0; } else if (m_selected >= optionsSize) { m_selected = optionsSize - 1; } - if (m_selected != previousSelected) { sm_cursor->play(); } + if (m_selected != previousSelected) { Menu::play_sound(); } } void ui::Menu::update_scrolling() diff --git a/source/ui/TitleView.cpp b/source/ui/TitleView.cpp index f0a2bca..e8f41bf 100644 --- a/source/ui/TitleView.cpp +++ b/source/ui/TitleView.cpp @@ -112,6 +112,8 @@ void ui::TitleView::reset() for (ui::TitleTile ¤tTile : m_titleTiles) { currentTile.reset(); } } +void ui::TitleView::play_sound() noexcept { sm_cursor->play(); } + void ui::TitleView::initialize_static_members() { static constexpr std::string_view CURSOR_NAME = "MenuCursor";