diff --git a/sphaira/source/utils/devoptab_nsp.cpp b/sphaira/source/utils/devoptab_nsp.cpp index 4c84bd3..f245efa 100644 --- a/sphaira/source/utils/devoptab_nsp.cpp +++ b/sphaira/source/utils/devoptab_nsp.cpp @@ -235,19 +235,18 @@ Result MountNsp(fs::Fs* fs, const fs::FsPath& path, fs::FsPath& out_path) { } } - // create new entry. - auto& entry = g_entries.emplace_back(); - auto source = std::make_unique(fs, path); - // R_TRY(yati::container::Xci(source.get()).ReadAll()); yati::container::Nsp nsp{source.get()}; - R_TRY(nsp.GetCollections(entry.device.collections)); + yati::container::Collections collections; + R_TRY(nsp.GetCollections(collections)); + auto& entry = g_entries.emplace_back(); entry.path = path; entry.devoptab = DEVOPTAB; entry.devoptab.name = entry.name; entry.devoptab.deviceData = &entry.device; entry.device.source = std::move(source); + entry.device.collections = collections; std::snprintf(entry.name, sizeof(entry.name), "nsp_%u", g_mount_idx); std::snprintf(entry.mount, sizeof(entry.mount), "nsp_%u:/", g_mount_idx); diff --git a/sphaira/source/utils/devoptab_save.cpp b/sphaira/source/utils/devoptab_save.cpp index e8fab99..f4ec46a 100644 --- a/sphaira/source/utils/devoptab_save.cpp +++ b/sphaira/source/utils/devoptab_save.cpp @@ -321,16 +321,14 @@ Result MountFromSavePath(u64 id, fs::FsPath& out_path) { log_write("[SAVE] OPEN SUCCESS %s\n", path); - // create new entry. auto& entry = g_entries.emplace_back(); - std::snprintf(entry.name, sizeof(entry.name), "%016lx", id); - entry.id = id; entry.device.ctx = ctx; entry.device.file_table = &ctx->save_filesystem_core.file_table; entry.devoptab = DEVOPTAB; entry.devoptab.name = entry.name; entry.devoptab.deviceData = &entry.device; + std::snprintf(entry.name, sizeof(entry.name), "%016lx", id); R_UNLESS(AddDevice(&entry.devoptab) >= 0, 0x1); log_write("[SAVE] DEVICE SUCCESS %s %s\n", path, entry.name); diff --git a/sphaira/source/utils/devoptab_xci.cpp b/sphaira/source/utils/devoptab_xci.cpp index 9e6978e..408be89 100644 --- a/sphaira/source/utils/devoptab_xci.cpp +++ b/sphaira/source/utils/devoptab_xci.cpp @@ -255,18 +255,18 @@ Result MountXci(fs::Fs* fs, const fs::FsPath& path, fs::FsPath& out_path) { } } - // create new entry. - auto& entry = g_entries.emplace_back(); - auto source = std::make_unique(fs, path); yati::container::Xci xci{source.get()}; - R_TRY(xci.GetPartitions(entry.device.partitions)); + yati::container::Xci::Partitions partitions; + R_TRY(xci.GetPartitions(partitions)); + auto& entry = g_entries.emplace_back(); entry.path = path; entry.devoptab = DEVOPTAB; entry.devoptab.name = entry.name; entry.devoptab.deviceData = &entry.device; entry.device.source = std::move(source); + entry.device.partitions = partitions; std::snprintf(entry.name, sizeof(entry.name), "xci_%u", g_mount_idx); std::snprintf(entry.mount, sizeof(entry.mount), "xci_%u:/", g_mount_idx); diff --git a/sphaira/source/utils/devoptab_zip.cpp b/sphaira/source/utils/devoptab_zip.cpp index dbbd99d..43a8cad 100644 --- a/sphaira/source/utils/devoptab_zip.cpp +++ b/sphaira/source/utils/devoptab_zip.cpp @@ -707,7 +707,6 @@ Result MountZip(fs::Fs* fs, const fs::FsPath& path, fs::FsPath& out_path) { } // create new entry. - auto& entry = g_entries.emplace_back(); auto source = std::make_unique(fs, path); s64 size; @@ -723,6 +722,7 @@ Result MountZip(fs::Fs* fs, const fs::FsPath& path, fs::FsPath& out_path) { DirectoryEntry root; Parse(table_entries, root); + auto& entry = g_entries.emplace_back(); entry.path = path; entry.devoptab = DEVOPTAB; entry.devoptab.name = entry.name;