This repository has been archived on 2026-06-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PatchExtractor/source/extractor.hpp
niklascfw 2cf3db2097
All checks were successful
Build NRO / build (push) Successful in 1m48s
Add Borealis GUI for patch extraction on Switch.
Replace the console UI with a Borealis-based flow, bundle ROMFS assets and
borealis as a submodule, and apply small upstream patches at build time.
Self-delete runs after romfsExit on quit so the NRO can be removed like the
old console build.
2026-05-28 22:22:44 +02:00

44 lines
1.3 KiB
C++

#pragma once
#include <minizip/unzip.h>
#include <string>
class PatchExtractor {
public:
static constexpr const char* PATCHES_ZIP = "sdmc:/SaltySD/plugins/FPSLocker/patches.zip";
static constexpr const char* EXTRACT_DIR = "sdmc:/SaltySD/plugins/FPSLocker/";
static constexpr const char* SELF_NRO = "sdmc:/switch/PatchExtractor.nro";
bool open();
void close();
/** Process one zip entry. Returns false when finished or on fatal error. */
bool step();
bool isOpen() const { return zip != nullptr; }
unsigned long getTotal() const { return total; }
unsigned long getExtracted() const { return extracted; }
unsigned long getSkipped() const { return skipped; }
int getProgressPercent() const;
const std::string& getCurrentFile() const { return currentFile; }
bool isFinished() const { return finished; }
bool cleanup();
bool cleanupOk() const { return cleanupOk_; }
/** Call after the UI has shut down; releases romfs so the NRO file can be unlinked. */
static void tryDeleteSelfOnExit();
private:
static int mkdirs(const char* path);
unzFile zip = nullptr;
unsigned long total = 0;
unsigned long extracted = 0;
unsigned long skipped = 0;
int err = UNZ_OK;
bool finished = false;
bool cleanupOk_ = true;
std::string currentFile;
};