replace almost all uses of shared_ptr with unique_ptr.

This commit is contained in:
ITotalJustice
2025-06-23 20:02:04 +01:00
parent aa724e12ba
commit 2ff2923d39
37 changed files with 446 additions and 442 deletions

View File

@@ -376,16 +376,16 @@ Menu::Menu(u32 flags) : MenuBase{"GameCard"_i18n, flags} {
if (m_option_index == 0) {
if (!App::GetInstallEnable()) {
App::Push(std::make_shared<ui::OptionBox>(
App::Push(std::make_unique<ui::OptionBox>(
"Install disabled...\n"
"Please enable installing via the install options."_i18n,
"OK"_i18n
));
} else {
log_write("[GC] doing install A\n");
App::Push(std::make_shared<ui::ProgressBox>(m_icon, "Installing "_i18n, m_entries[m_entry_index].lang_entry.name, [this](auto pbox) -> Result {
auto source = std::make_shared<GcSource>(m_entries[m_entry_index], m_fs.get());
return yati::InstallFromCollections(pbox, source, source->m_collections, source->m_config);
App::Push(std::make_unique<ui::ProgressBox>(m_icon, "Installing "_i18n, m_entries[m_entry_index].lang_entry.name, [this](auto pbox) -> Result {
auto source = std::make_unique<GcSource>(m_entries[m_entry_index], m_fs.get());
return yati::InstallFromCollections(pbox, source.get(), source->m_collections, source->m_config);
}, [this](Result rc){
App::PushErrorBox(rc, "Gc install failed!"_i18n);
@@ -395,11 +395,11 @@ Menu::Menu(u32 flags) : MenuBase{"GameCard"_i18n, flags} {
}));
}
} else {
auto options = std::make_shared<Sidebar>("Select content to dump"_i18n, Sidebar::Side::RIGHT);
ON_SCOPE_EXIT(App::Push(options));
auto options = std::make_unique<Sidebar>("Select content to dump"_i18n, Sidebar::Side::RIGHT);
ON_SCOPE_EXIT(App::Push(std::move(options)));
const auto add = [&](const std::string& name, u32 flags){
options->Add(std::make_shared<SidebarEntryCallback>(name, [this, flags](){
options->Add(std::make_unique<SidebarEntryCallback>(name, [this, flags](){
DumpGames(flags);
m_dirty = true;
}, true));
@@ -419,14 +419,14 @@ Menu::Menu(u32 flags) : MenuBase{"GameCard"_i18n, flags} {
SetPop();
}}),
std::make_pair(Button::X, Action{"Options"_i18n, [this](){
auto options = std::make_shared<Sidebar>("Game Options"_i18n, Sidebar::Side::RIGHT);
ON_SCOPE_EXIT(App::Push(options));
auto options = std::make_unique<Sidebar>("Game Options"_i18n, Sidebar::Side::RIGHT);
ON_SCOPE_EXIT(App::Push(std::move(options)));
options->Add(std::make_shared<SidebarEntryCallback>("Install options"_i18n, [this](){
options->Add(std::make_unique<SidebarEntryCallback>("Install options"_i18n, [this](){
App::DisplayInstallOptions(false);
}));
options->Add(std::make_shared<SidebarEntryCallback>("Dump options"_i18n, [this](){
options->Add(std::make_unique<SidebarEntryCallback>("Dump options"_i18n, [this](){
App::DisplayDumpOptions(false);
}));
}})
@@ -982,7 +982,7 @@ Result Menu::DumpGames(u32 flags) {
// if trimmed and the user wants to dump the full xci, error.
if ((flags & DumpFileFlag_XCI) && is_trimmed && App::GetApp()->m_dump_trim_xci.Get()) {
App::Push(std::make_shared<ui::OptionBox>(
App::Push(std::make_unique<ui::OptionBox>(
"WARNING: GameCard is already trimmed!"_i18n,
"Back"_i18n, "Continue"_i18n, 0, [&](auto op_index){
if (op_index && *op_index) {