All checks were successful
Build NRO / build (push) Successful in 1m48s
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.
44 lines
1.3 KiB
C++
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;
|
|
};
|