Remove all references to NSWDB.

Other changes include:

* config: remove ConfigChecksumLookupMethod enum.
* config: remove "gamecard/checksum_lookup_method" integer field.
* config: add "gamecard/lookup_checksum" boolean field.
* config: update default configuration file.
* defines: remove all NSWDB macros.

* GameCardImageDumpTask: update class to reflect the changes made to the configuration interface.

* GameCardImageDumpOptionsFrame: update class to reflect the changes made to the configuration interface.

* OptionsTab: remove OptionsTabUpdateFileDialog class.
* OptionsTab: remove "Update NSWDB XML" element.

* i18n: update localization files to reflect the rest of the changes.
This commit is contained in:
Pablo Curiel 2024-05-02 15:38:39 +02:00
parent daacdde44f
commit 7dc0f76224
15 changed files with 34 additions and 138 deletions

View File

@ -63,36 +63,40 @@ jobs:
cd "$GITHUB_WORKSPACE/nxdumptool"
./build.sh --noconfirm
- name: Build nxdumptool-rewrite GUI binary
- name: Build nxdumptool-rewrite UI binary
working-directory: nxdumptool
run: |
make -j8
- uses: actions/upload-artifact@v4
- name: Upload nxdumptool-rewrite PoC NRO artifact
uses: actions/upload-artifact@v4
with:
name: nxdt_rw_poc-${{ env.nxdt_commit }}.nro
path: nxdumptool/code_templates/tmp/nxdt_rw_poc.nro
if-no-files-found: error
- uses: actions/upload-artifact@v4
- name: Upload nxdumptool-rewrite PoC ELF artifact
uses: actions/upload-artifact@v4
with:
name: nxdt_rw_poc-${{ env.nxdt_commit }}.elf
path: nxdumptool/code_templates/tmp/nxdt_rw_poc.elf
if-no-files-found: error
- uses: actions/upload-artifact@v4
- name: Upload nxdumptool-rewrite UI NRO artifact
uses: actions/upload-artifact@v4
with:
name: nxdumptool-rewrite-${{ env.nxdt_commit }}-WIP_UI.nro
path: nxdumptool/nxdumptool.nro
if-no-files-found: error
- uses: actions/upload-artifact@v4
- name: Upload nxdumptool-rewrite UI ELF artifact
uses: actions/upload-artifact@v4
with:
name: nxdumptool-rewrite-${{ env.nxdt_commit }}-WIP_UI.elf
path: nxdumptool/nxdumptool.elf
if-no-files-found: error
- name: Upload artifact to prerelease
- name: Upload nxdumptool-rewrite PoC artifacts to pre-release
uses: ncipollo/release-action@v1
with:
# Only update attachments on "rewrite-prerelease" tag.

View File

@ -36,13 +36,6 @@ typedef enum {
ConfigOutputStorage_Count = 2 ///< Total values supported by this enum.
} ConfigOutputStorage;
typedef enum {
ConfigChecksumLookupMethod_None = 0,
ConfigChecksumLookupMethod_NSWDB = 1,
ConfigChecksumLookupMethod_NoIntro = 2,
ConfigChecksumLookupMethod_Count = 3 ///< Total values supported by this enum.
} ConfigChecksumLookupMethod;
/// Initializes the configuration interface.
bool configInitialize(void);

View File

@ -129,10 +129,6 @@
#define GITHUB_API_RELEASE_URL GITHUB_API_URL "/repos/" GITHUB_REPOSITORY "/releases/latest"
#define NSWDB_XML_URL "http://nswdb.com/xml.php"
#define NSWDB_XML_NAME "NSWreleases.xml"
#define NSWDB_XML_PATH APP_BASE_PATH NSWDB_XML_NAME
#define BOREALIS_URL "https://github.com/natinusala/borealis"
#define LIBUSBHSFS_URL "https://github.com/DarkMatterCore/libusbhsfs"
#define FATFS_URL "http://elm-chan.org/fsw/ff/00index_e.html"

View File

@ -34,12 +34,11 @@ namespace nxdt::tasks
typedef std::optional<std::string> GameCardDumpTaskError;
/* Generates an image dump out of the inserted gamecard. */
class GameCardImageDumpTask: public DataTransferTask<GameCardDumpTaskError, std::string, bool, bool, bool, bool, int>
class GameCardImageDumpTask: public DataTransferTask<GameCardDumpTaskError, std::string, bool, bool, bool, bool, bool>
{
private:
std::mutex task_mtx;
bool calculate_checksum = false;
int checksum_lookup_method = ConfigChecksumLookupMethod_None;
bool calculate_checksum = false, lookup_checksum = false;
u32 gc_img_crc = 0, full_gc_img_crc = 0;
protected:
@ -49,7 +48,7 @@ namespace nxdt::tasks
/* Runs in the background thread. */
GameCardDumpTaskError DoInBackground(const std::string& output_path, const bool& prepend_key_area, const bool& keep_certificate, const bool& trim_dump,
const bool& calculate_checksum, const int& checksum_lookup_method) override final;
const bool& calculate_checksum, const bool& lookup_checksum) override final;
public:
GameCardImageDumpTask() = default;

View File

@ -38,7 +38,7 @@ namespace nxdt::views
brls::ToggleListItem *keep_certificate = nullptr;
brls::ToggleListItem *trim_dump = nullptr;
brls::ToggleListItem *calculate_checksum = nullptr;
brls::SelectListItem *checksum_lookup_method = nullptr;
brls::ToggleListItem *lookup_checksum = nullptr;
public:
GameCardImageDumpOptionsFrame(RootView *root_view, std::string raw_filename);

View File

@ -31,18 +31,6 @@
namespace nxdt::views
{
/* Update file dialog. */
class OptionsTabUpdateFileDialog: public brls::Dialog
{
private:
DataTransferProgressDisplay *update_progress = nullptr;
nxdt::tasks::DownloadFileTask download_task;
std::string success_str;
public:
OptionsTabUpdateFileDialog(std::string path, std::string url, bool force_https, std::string success_str);
};
/* Update application frame. */
class OptionsTabUpdateApplicationFrame: public brls::StagedAppletFrame
{

View File

@ -7,7 +7,7 @@
"keep_certificate": false,
"trim_dump": false,
"calculate_checksum": true,
"checksum_lookup_method": 1,
"lookup_checksum": true,
"write_raw_hfs_partition": false
},
"nsp": {

View File

@ -22,7 +22,7 @@
"line_05": "\uE016 RattletraPM, for the awesome icon.",
"line_06": "\uE016 Whovian9369, for being a key piece throughout the whole development by providing lots of testing and cool ideas.",
"line_07": "\uE016 liamadvance, Shadów and SimonTime, for their tremendous help in understanding Nintendo Switch file and data formats.",
"line_08": "\uE016 The folks from NSWDB.COM and No-Intro.org, for being kind enough to put up public APIs to perform online checksum lookups.",
"line_08": "\uE016 The folks from No-Intro.org, for being kind enough to put up a public API to perform online checksum lookups.",
"line_09": "\uE016 The folks at the nxdumptool Discord server.",
"line_10": "\uE016 The Comfy Boyes, for always being awesome and supportive. You know who you are.",
"line_11": "\uE016 And, at last but not least, you! Thank you for using my work!"

View File

@ -34,10 +34,9 @@
"description": "Calculates one or more CRC32 checksums over the dumped data, depending on the selected configuration. Checksums are useful to verify data integrity. Enabled by default."
},
"checksum_lookup_method": {
"label": "Checksum lookup method",
"description": "If \"{0}\" is enabled, this option determines which lookup method is used to validate the calculated CRC32 checksum at the end of the dump process.\n\nIf \"{1}\" is selected, the calculated checksum will be looked up in \"{2}\", which must have been previously downloaded.\n\nIf \"{3}\" is selected, the calculated checksum will be looked up using an Internet connection and a public HTTP endpoint.",
"value_00": "None"
"lookup_checksum": {
"label": "Lookup calculated checksum",
"description": "If \"{0}\" is enabled, this option controls whether the calculated CRC32 checksum should be looked up and validated at the end of the dump process, using an Internet connection and a public HTTP endpoint provided by {1}."
}
}
},

View File

@ -18,11 +18,6 @@
"description": "Safely unmount any USB Mass Storage devices that are currently connected and mounted by {0}.\n\nIf a UMS device has more than one mounted volume, selecting a single one will unmount all volumes from that device.\n\nUMS devices are always safely unmounted at exit."
},
"update_nswdb_xml": {
"label": "Update NSWDB XML",
"description": "Retrieves the latest NSWDB XML, which can be optionally used to validate checksums from gamecard dumps. Requires an Internet connection."
},
"update_app": {
"label": "Update application",
"description": "Checks if an update is available in nxdumptool's GitHub repository. Requires an Internet connection.",
@ -45,7 +40,6 @@
"ums_device_unmount_failed": "Failed to unmount USB Mass Storage device!",
"no_internet_connection": "Internet connection unavailable. Unable to update.",
"update_failed": "Update failed! Check the logfile for more info.",
"nswdb_xml_updated": "NSWDB XML successfully updated!",
"is_nso": "The application is running as an NSO. Unable to update.",
"already_updated": "The application has already been updated. Please reload.",
"github_json_failed": "Failed to download or parse GitHub release JSON!",

View File

@ -228,7 +228,7 @@ end:
static bool configValidateJsonGameCardObject(const struct json_object *obj)
{
bool ret = false, prepend_key_area_found = false, keep_certificate_found = false, trim_dump_found = false, calculate_checksum_found = false;
bool checksum_lookup_method_found = false, write_raw_hfs_partition_found = false;
bool lookup_checksum_found = false, write_raw_hfs_partition_found = false;
if (!jsonValidateObject(obj)) goto end;
@ -238,12 +238,12 @@ static bool configValidateJsonGameCardObject(const struct json_object *obj)
CONFIG_VALIDATE_FIELD(Boolean, keep_certificate);
CONFIG_VALIDATE_FIELD(Boolean, trim_dump);
CONFIG_VALIDATE_FIELD(Boolean, calculate_checksum);
CONFIG_VALIDATE_FIELD(Integer, checksum_lookup_method, ConfigChecksumLookupMethod_None, ConfigChecksumLookupMethod_Count - 1);
CONFIG_VALIDATE_FIELD(Boolean, lookup_checksum);
CONFIG_VALIDATE_FIELD(Boolean, write_raw_hfs_partition);
goto end;
}
ret = (prepend_key_area_found && keep_certificate_found && trim_dump_found && calculate_checksum_found && checksum_lookup_method_found && write_raw_hfs_partition_found);
ret = (prepend_key_area_found && keep_certificate_found && trim_dump_found && calculate_checksum_found && lookup_checksum_found && write_raw_hfs_partition_found);
end:
return ret;

View File

@ -30,7 +30,7 @@ using namespace i18n::literals; /* For _i18n. */
namespace nxdt::tasks
{
GameCardDumpTaskError GameCardImageDumpTask::DoInBackground(const std::string& output_path, const bool& prepend_key_area, const bool& keep_certificate, const bool& trim_dump,
const bool& calculate_checksum, const int& checksum_lookup_method)
const bool& calculate_checksum, const bool& lookup_checksum)
{
std::scoped_lock lock(this->task_mtx);
@ -47,10 +47,10 @@ namespace nxdt::tasks
/* Update private variables. */
this->calculate_checksum = calculate_checksum;
this->checksum_lookup_method = checksum_lookup_method;
this->lookup_checksum = lookup_checksum;
LOG_MSG_DEBUG("Starting dump with parameters:\n- Output path: \"%s\".\n- Prepend key area: %u.\n- Keep certificate: %u.\n- Trim dump: %u.\n- Calculate checksum: %u.\n- Checksum lookup method: %d.", \
output_path.c_str(), prepend_key_area, keep_certificate, trim_dump, calculate_checksum, checksum_lookup_method);
LOG_MSG_DEBUG("Starting dump with parameters:\n- Output path: \"%s\".\n- Prepend key area: %u.\n- Keep certificate: %u.\n- Trim dump: %u.\n- Calculate checksum: %u.\n- Lookup checksum: %d.", \
output_path.c_str(), prepend_key_area, keep_certificate, trim_dump, calculate_checksum, lookup_checksum);
/* Retrieve gamecard image size. */
if ((!trim_dump && !gamecardGetTotalSize(&gc_img_size)) || (trim_dump && !gamecardGetTrimmedSize(&gc_img_size)) || !gc_img_size) return "tasks/gamecard/image/get_size_failed"_i18n;

View File

@ -25,10 +25,11 @@
namespace i18n = brls::i18n; /* For getStr(). */
using namespace i18n::literals; /* For _i18n. */
#define GAMECARD_TOGGLE_ITEM(name) \
#define GAMECARD_TOGGLE_ITEM(name, ...) \
do { \
this->name = new brls::ToggleListItem("dump_options/gamecard/image/" #name "/label"_i18n, configGetBoolean("gamecard/" #name), \
"dump_options/gamecard/image/" #name "/description"_i18n, "generic/value_enabled"_i18n, "generic/value_disabled"_i18n); \
i18n::getStr("dump_options/gamecard/image/" #name "/description", ##__VA_ARGS__), \
"generic/value_enabled"_i18n, "generic/value_disabled"_i18n); \
this->name->getClickEvent()->subscribe([](brls::View *view) { \
brls::ToggleListItem *item = static_cast<brls::ToggleListItem*>(view); \
configSetBoolean("gamecard/" #name, item->getToggleState()); \
@ -66,24 +67,8 @@ namespace nxdt::views
/* "Calculate checksum" toggle. */
GAMECARD_TOGGLE_ITEM(calculate_checksum);
/* "Checksum lookup method" dropdown. */
this->checksum_lookup_method = new brls::SelectListItem("dump_options/gamecard/image/checksum_lookup_method/label"_i18n, {
"dump_options/gamecard/image/checksum_lookup_method/value_00"_i18n,
"NSWDB",
"No-Intro"
}, configGetInteger("gamecard/checksum_lookup_method"),
i18n::getStr("dump_options/gamecard/image/checksum_lookup_method/description", "dump_options/gamecard/image/calculate_checksum/label"_i18n,
"NSWDB", NSWDB_XML_NAME, "No-Intro"));
this->checksum_lookup_method->getValueSelectedEvent()->subscribe([this](int selected) {
/* Make sure the current value isn't out of bounds. */
if (selected < ConfigChecksumLookupMethod_None || selected >= ConfigChecksumLookupMethod_Count) return;
/* Update configuration. */
configSetInteger("gamecard/checksum_lookup_method", selected);
});
this->addView(this->checksum_lookup_method);
/* "Lookup checksum" toggle. */
GAMECARD_TOGGLE_ITEM(lookup_checksum, "dump_options/gamecard/image/calculate_checksum/label"_i18n, "No-Intro");
/* Register dump button callback. */
this->RegisterButtonListener([this](brls::View *view) {
@ -92,7 +77,7 @@ namespace nxdt::views
bool keep_certificate_val = this->keep_certificate->getToggleState();
bool trim_dump_val = this->trim_dump->getToggleState();
bool calculate_checksum_val = this->calculate_checksum->getToggleState();
int checksum_lookup_method_val = static_cast<int>(this->checksum_lookup_method->getSelectedValue());
bool lookup_checksum_val = this->lookup_checksum->getToggleState();
/* Generate file extension. */
std::string extension = fmt::format(" [{}][{}][{}].xci", prepend_key_area_val ? "KA" : "NKA", keep_certificate_val ? "C" : "NC", trim_dump_val ? "T" : "NT");
@ -103,7 +88,7 @@ namespace nxdt::views
/* Display task frame. */
brls::Application::pushView(new GameCardImageDumpTaskFrame(output_path, prepend_key_area_val, keep_certificate_val, trim_dump_val, calculate_checksum_val,
checksum_lookup_method_val), brls::ViewAnimation::SLIDE_LEFT, false);
lookup_checksum_val), brls::ViewAnimation::SLIDE_LEFT, false);
});
}

View File

@ -29,50 +29,6 @@ using namespace i18n::literals; /* For _i18n. */
namespace nxdt::views
{
OptionsTabUpdateFileDialog::OptionsTabUpdateFileDialog(std::string path, std::string url, bool force_https, std::string success_str) : brls::Dialog(), success_str(success_str)
{
/* Set content view. */
this->update_progress = new DataTransferProgressDisplay();
this->setContentView(this->update_progress);
/* Add cancel button. */
this->addButton("generic/cancel"_i18n, [&](brls::View* view) {
/* Cancel download task. */
this->download_task.Cancel();
/* Close dialog. */
this->close();
});
/* Disable cancelling with B button. */
this->setCancelable(false);
/* Subscribe to the download task. */
this->download_task.RegisterListener([&](const nxdt::tasks::DataTransferProgress& progress) {
/* Return immediately if the download task was cancelled. */
if (this->download_task.IsCancelled()) return;
/* Update progress. */
this->update_progress->SetProgress(progress);
/* Check if the download task has finished. */
if (this->download_task.IsFinished())
{
/* Stop spinner. */
this->update_progress->willDisappear();
/* Update button label. */
this->setButtonText(0, "generic/close"_i18n);
/* Display notification. */
brls::Application::notify(this->download_task.GetResult() ? this->success_str : "options_tab/notifications/update_failed"_i18n);
}
});
/* Start download task. */
this->download_task.Execute(path, url, force_https);
}
OptionsTabUpdateApplicationFrame::OptionsTabUpdateApplicationFrame() : brls::StagedAppletFrame(false)
{
/* Set UI properties. */
@ -382,24 +338,6 @@ namespace nxdt::views
this->addView(unmount_ums_device);
/* Update NSWDB XML. */
brls::ListItem *update_nswdb_xml = new brls::ListItem("options_tab/update_nswdb_xml/label"_i18n, "options_tab/update_nswdb_xml/description"_i18n);
update_nswdb_xml->getClickEvent()->subscribe([this](brls::View* view) {
if (!this->root_view->IsInternetConnectionAvailable())
{
/* Display a notification if no Internet connection is available. */
this->DisplayNotification("options_tab/notifications/no_internet_connection"_i18n);
return;
}
/* Open update dialog. */
OptionsTabUpdateFileDialog *dialog = new OptionsTabUpdateFileDialog(NSWDB_XML_PATH, NSWDB_XML_URL, false, "options_tab/notifications/nswdb_xml_updated"_i18n);
dialog->open(false);
});
this->addView(update_nswdb_xml);
/* Update application. */
brls::ListItem *update_app = new brls::ListItem("options_tab/update_app/label"_i18n, "options_tab/update_app/description"_i18n);

View File

@ -12,7 +12,7 @@ todo:
usb: improve cancel mechanism
others: check todo with grep
others: dump verification via nswdb / no-intro
others: dump verification via no-intro
others: fatfs browser for emmc partitions
reminder: