diff options
| author | rdenno <rhysdenno@gmail.com> | 2026-11-02 09:26:01 -0500 |
|---|---|---|
| committer | rdenno <rhysdenno@gmail.com> | 2026-11-02 09:26:01 -0500 |
| commit | 2786bdf580e41bf0ba6e2a6452db73c4f5b97ed2 (patch) | |
| tree | 2c59cf5d66b869af52f338f3dea6e679e590f7bb /src/yuzu_cmd/yuzu.cpp | |
| parent | 7ac108e2571d7cb39585c58994524131dd9d8c22 (diff) | |
| parent | c0cb3325e22756edb65c87d33ef298349ade0ad3 (diff) | |
Merge branch 'nx2-experimental' into fix/hw-shader-lowering
nx2-experimental lowers partial-mask TXD as well (Splatoon Raiders).
Keep its RZ second destination and this branch's odd register for a
lone third channel; take its wider F2I mode check with the .H1 source.
Assisted-by: Claude Opus 5.5 (conflict resolution)
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 4d71a29993..bc4002d8af 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -12,7 +12,9 @@ #include <cstdlib> #include <chrono> #include <cstdio> +#include <csignal> #include <cstring> +#include <filesystem> #include <iostream> #include <memory> #include <mutex> @@ -36,6 +38,7 @@ #include "core/core_timing.h" #include "core/cpu_manager.h" #include "core/crypto/key_manager.h" +#include "core/file_sys/nup_writer.h" #include "core/file_sys/registered_cache.h" #include "core/file_sys/vfs/vfs_real.h" #include "core/hle/service/am/applet_manager.h" @@ -248,6 +251,49 @@ struct SdlState { std::unique_ptr<EmuWindow_SDL3> emu_window; }; +static std::atomic_bool pack_nup_cancel{false}; + +// eden-cli --pack-nup <dump> [<out.nup>]; the output defaults to <dump>.nup next to the dump. +static bool PackNup(const std::string& source, const std::string& output) { + const auto to_path = [](const std::string& utf8) { + return std::filesystem::path{std::u8string{utf8.begin(), utf8.end()}}; + }; + const auto dump_root = to_path(source); + const auto archive = + output.empty() ? FileSys::Nup::DefaultArchivePath(dump_root) : to_path(output); + std::signal(SIGINT, [](int) { pack_nup_cancel = true; }); + + const auto start = std::chrono::steady_clock::now(); + auto last_report = start; + std::string error; + const auto result = FileSys::Nup::PackDump( + dump_root, archive, {}, + [&](const FileSys::Nup::PackProgress& p) { + const auto now = std::chrono::steady_clock::now(); + if (now - last_report < std::chrono::seconds(1) && p.files_done != p.files_total) { + return; + } + last_report = now; + fmt::print(stderr, "\r{} / {} MiB, {} / {} files", p.bytes_done >> 20, + p.bytes_total >> 20, p.files_done, p.files_total); + }, + &pack_nup_cancel, &error); + const auto seconds = + std::chrono::duration<double>(std::chrono::steady_clock::now() - start).count(); + fmt::print(stderr, "\n"); + switch (result) { + case FileSys::Nup::PackResult::Success: + fmt::print(stderr, "Wrote {} in {:.1f} s\n", archive.string(), seconds); + return true; + case FileSys::Nup::PackResult::Cancelled: + fmt::print(stderr, "Cancelled\n"); + return false; + default: + fmt::print(stderr, "Packing failed: {}\n", error); + return false; + } +} + extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { #ifdef _WIN32 SetUnhandledExceptionFilter(WriteCrashDump); @@ -298,6 +344,10 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { Core::ApplyLaunchParams(lp); + if (lp.pack_nup_source) { + return PackNup(*lp.pack_nup_source, lp.filepath) ? SDL_APP_SUCCESS : SDL_APP_FAILURE; + } + if (lp.filepath.empty()) { LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); return SDL_APP_FAILURE; |
