Commit Graph

885 Commits

Author SHA1 Message Date
David Korth
cb09464faa [qrvthtool] Switch from foreach() to range-based for loops. 2025-05-30 18:39:19 -04:00
David Korth
35505dc1ed [qrvthtool] TranslationManager: Also load qtbase_*.qm.
qtbase_*.qm has some POSIX error codes, which still need to be handled
properly in qrvthtool.
2025-05-30 18:36:18 -04:00
David Korth
8d34c3e3dd [librvth] rvth_error.c: Mark RVT-H error strings for Qt localization.
[locale] Update for these changes.

[qrvthtool] Update for localized RVT-H error strings:

- WorkerObject: Don't include the error code in the message when
  emitting finished().

- QRvtHWindow: Handle RVT-H error codes better:
  - If -ECANCELED is returned, show the message as-is, since the operation
    was cancelled.
  - If it's an RVT-H error, use QCoreApplication::translate() with the
    "RvtH|Error" context and rvth_error(err) string.
  - If it's a POSIX error, use rvth_error() anyway for now.

FIXME: Need to properly translate POSIX errors.
2025-05-30 18:35:04 -04:00
David Korth
3a0c7f6632 [qrvthtool] WorkerObject: Consolidate various error messages.
Use a '%1' placeholder for "doExtract" and "doImport", since the messages
are all the same except for the function name.

[locale] Update localizations for this change.
2025-05-30 00:02:34 -04:00
David Korth
039d225794 [locale] rvthtool_de.ts: Initial German translation.
German translation provided by crediar and Moddimation.

[qrvthtool] AboutDialog.cpp: Add German translation credits.
2025-05-29 23:36:26 -04:00
David Korth
4e769ef07c [qrvthtool] Update Oxygen icons to v6.1.0.
Includes icon optimization using optipng, advdef, and oxipng.
2025-05-29 23:23:28 -04:00
David Korth
ccb22bc8e1 [qrvthtool] FormatSize: Consolidate the size formatting code into a single file.
This consolidates the code and translations from BankEntryView and
SelectDeviceDialog,

[locale] Update localizations for this change.
2025-05-29 23:18:54 -04:00
David Korth
fafc331c26 [qrvthtool] Use process-stop for the "Cancel" button icon.
dialog-close is black in the KDE Breeze theme.
process-stop is red.

Add process-stop from KDE Oxygen.

Un-indent some stuff and add more braces.

Fix "~/." for the home directory, similar to "./." for the
application directory.
2025-05-29 23:01:34 -04:00
David Korth
e36c938ced [qrvthtool] QRvtHToolWindowPrivate::updateGrpBankListTitle(): Remove the TODO about adding an option to hide the serial number. 2025-05-26 20:26:55 -04:00
David Korth
c78ecdfa21 [qrvthtool] QRvtHToolWindow.cpp: Restore a few changes that were actually useful. 2025-05-26 19:48:22 -04:00
David Korth
be390d9258 Revert "[qrvthtool] QRvtHToolWindow.cpp: Forgot to commit this file in the maskDeviceSerialNumbers commit."
I *did* commit this file, but something screwed up when I reverted some
changes locally but didn't commit them...

This reverts commit da6fee3603.
2025-05-26 19:47:21 -04:00
David Korth
44886ecc95 [locale] Updated the translation files using lupdate.sh. 2025-05-26 19:46:21 -04:00
David Korth
da6fee3603 [qrvthtool] QRvtHToolWindow.cpp: Forgot to commit this file in the maskDeviceSerialNumbers commit.
See commit: a976decd6c
([qrvthtool] Add an option to mask the last 5 digits of the RVT-H Reader serial number.)
2025-05-26 19:45:24 -04:00
David Korth
59f5ecf497 [qrvthtool] QRvtHToolWindow.ui: Remove splitterInfo.
Leftover from mcrecover.
2025-05-26 15:32:59 -04:00
David Korth
9f3f9b3bf7 [qrvthtool] QRvtHToolWindow.ui: Shorten the toolTip/statusTip for actionMaskDeviceSerialNumbers.
TODO: Add statusTip for other menu actions?
2025-05-26 15:21:43 -04:00
David Korth
82af365205 [qrvthtool] ConfigStore::set(): Also prevent deadlocks here. 2025-05-26 15:13:37 -04:00
David Korth
a976decd6c [qrvthtool] Add an option to mask the last 5 digits of the RVT-H Reader serial number.
Useful for screenshots.

The digits are replaced with 'x'.
2025-05-26 15:13:10 -04:00
David Korth
fd77b7a024 [qrvthtool] Show the window before attempting to open the RVT-H Reader.
This noticeably reduces lag when starting qrvthtool with a device name
specified on the command line.
2025-05-26 14:55:43 -04:00
David Korth
93b442a8ed [qrvthtool] UnityLauncher::update(): FIXME: Broken on Qt6 for some reason...
It's crashing in QtDBus when built with Qt6. Not sure why.
2025-05-26 14:54:16 -04:00
David Korth
fd4a4ad0a9 [qrvthtool] ConfigStore::notifyAll(): Fix a deadlock if the config file has an invalid language tag.
The language tag is initially loaded by ConfigStore, but when notifyAll()
is called, LanguageMenu realizes it's invalid and calls ConfigStore::set()
with an empty tag, which causes a deadlock due to d->mtxSignalMaps being
locked.

To fix this, populate a single vector of methods to invoke, then unlock
the mutex and invoke the methods.
2025-05-26 14:51:27 -04:00
David Korth
8d8925ed0b [qrvthtool] QRvtHToolWindow: Make use of 'lastPath' from ConfigStore.
PathFuncs::makeRelative(): WORKAROUND: Convert "./." to ".".

QRvtHToolWindow: Handle "." as the application directory.
2025-05-26 13:59:23 -04:00
David Korth
1cf87bc6fa [qrvthtool] ConfigDefaults: Make ValidationType a uint8_t.
This doesn't reduce any struct sizes, yet...
2025-05-26 13:48:10 -04:00
David Korth
5c45800816 [qrvthtool] ConfigDefaults: Move stuff to a private class.
Add an accessor to get all setting names, which is needed by ConfigStore.

ConfigStore: Use ConfigDefaults::getAllSettingNames().
2025-05-26 13:46:01 -04:00
David Korth
3f48d275b9 [qrvthtool] ConfigStorePrivate::Validate(): Use QVariant::canConvert(QMetaType::Type) on Qt6. 2025-05-26 13:19:34 -04:00
David Korth
5e6c8b6078 [qrvthtool] ConfigStore: Convert settingsMap to std::map<>. 2025-05-26 13:16:21 -04:00
David Korth
7cb1e7f4f0 [qrvthtool] ConfigStore: Convert signalMaps to C++ STL classes.
Also make use of references instead of pointers to reduce malloc() and
dereferencing overhead.
2025-05-26 13:07:42 -04:00
David Korth
b29fb9f0b1 [qrvthtool] Initial port of ConfigStore and ConfigDefaults from mcrecover.
Currently only handles the language code. lastPath is present, but isn't
set up yet.

LanguageMenu: Skip languages with an empty name. These are placeholder
translations that don't have any actual data yet.
2025-05-26 12:44:01 -04:00
David Korth
fa966aef95 [qrvthtool] CMakeLists.txt: Enable CMAKE_AUTOMOC.
This eliminates the need to explicitly use QT_WRAP_CPP().
2025-05-26 12:16:00 -04:00
David Korth
a884372d37 appveyor.yml: Switch the Linux image from 'Ubuntu' (18.04) to 'Ubuntu2204'.
The Linux builds have been failing for a while due to an image
configuration issue, and seemingly no one at AppVeyor has noticed:

W: GPG error: https://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 32EE5355A6BC6E42
E: The repository 'https://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
2025-05-24 15:09:33 -04:00
David Korth
589856cd94 [rvthtool] mainc.: Move 'show-table' to below 'verify'.
It's a debugging command that likely won't be used often, so it shouldn't
be the second command in the list.
2025-05-22 23:55:01 -04:00
David Korth
96627e10bd [rvthtool] show-table.cpp, print_table(): Show a raw view of the entire header sector.
Not just header->unk[].

Also, print the offset at the beginning of the line and print
16 bytes per line instead of 12.
2025-05-22 23:46:03 -04:00
David Korth
f6636f3593 [rvthtool] show-table.cpp: Use _tprintf(...) instead of _ftprintf(stdout, ...). 2025-05-22 23:36:26 -04:00
David Korth
ffbecabbd4 [rvthtool] show-table.cpp, show_table(): Use a single _ftprintf() for the bank table status. 2025-05-22 23:35:44 -04:00
David Korth
c1692f55cd [rvthtool] show-table.cpp, print_table(): Improve formatting.
- Don't use '#' in the printf format specifiers. Explicitly specify
  "0x" for each one.
- Right-align the descriptions for each entry.
- Put expected on the right side of the actual values.

Before:

[/dev/nvme0n1] NHCD Bank Table:
- Status: HAS_GPT
- Table Magic (Expected Value: 0x0x4443484e): 0x00000000
- x004 (expected: 0x00000001): 0x00000000
- bank_count (expected: 0x00000008): 0x00000000
- x00C (expected: 0x00000000): 0x00000000
- x010 (expected: 0x002FF000): 0x00000000
- unk table:

After:

[/dev/nvme0n1] NHCD Bank Table:
-      Status: HAS_GPT
- Table Magic: 0x00000000 (expected: 0x4443484E, "NHCD")
-        x004: 0x00000000 (expected: 0x00000001)
-  Bank Count: 0x00000000 (expected: 0x00000008)
-        x00C: 0x00000000 (expected: 0x00000000)
-        x010: 0x00000000 (expected: 0x002FF000)
- unk table:

(Yeah, I used my laptop's NVMe SSD for testing instead of connecting the
RVT-H Reader. It takes effort to connect the RVT-H Reader...)
2025-05-22 23:32:05 -04:00
David Korth
b738376971 [locale] Updated the translation files using lupdate.sh.
Seemingly no changes since the last time I ran it, other than
line number updates...
2025-05-22 22:48:25 -04:00
David Korth
6953ed1961 [librvth] RvtH: Move another function to the private class. 2025-05-22 18:26:07 -04:00
David Korth
3e3abd3c45 Fix compile errors when building the debug 32-bit and 64-bit builds on MSVC with -DENABLE_WERROR=ON.
[qrvthtool] SelectDeviceDialog, [rvthtool] query.c:
- TODO: Switch to VersionHelpers at some point.
- For now, suppress C4996 for GetVersionEx().

[rvthtool] query.c: Likewise.

[nusresign] Cast off64_t to size_t where necessary.
2025-05-21 23:37:47 -04:00
David Korth
140ad7a6d5 Fix compile errors when building the debug build on Linux with -DENABLE_WERROR=ON.
Mostly just complaints about using strncpy(), which have been fixed
by switching to snprintf():

src/libwiicrypto/sig_tools.c: In function ‘sig_recrypt_ticket’:
src/libwiicrypto/sig_tools.c:298:9: error: ‘__builtin_strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
  298 |         strncpy(ticket->issuer, issuer, sizeof(ticket->issuer));
      |         ^

src/librvth/recrypt.cpp: In member function ‘int RvtH::recryptWiiPartitions(unsigned int, RVL_CryptoType_e, RvtH_Progress_Callback, void*, int)’:
src/librvth/recrypt.cpp:587:24: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 64 equals destination size [-Werror=stringop-truncation]
  587 |                 strncpy(tmdHeader->issuer, issuer_TMD, sizeof(tmdHeader->issuer));
      |                        ^
src/nusresign/resign-nus.cpp:358:16: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 64 equals destination size [-Werror=stringop-truncation]
  358 |         strncpy(pTicket->issuer, s_issuer_xs, sizeof(pTicket->issuer));
      |                ^
src/nusresign/resign-nus.cpp:359:16: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 64 equals destination size [-Werror=stringop-truncation]
  359 |         strncpy(pTmdHeader->rvl.issuer, s_issuer_cp, sizeof(pTmdHeader->rvl.issuer));
      |                ^
src/wadresign/resign-wad.cpp:639:16: error: ‘char* __builtin___strncpy_chk(char*, const char*, long unsigned int, long unsigned int)’ specified bound 64 equals destination size [-Werror=stringop-truncation]
  639 |         strncpy(tmdHeader->issuer, issuer_TMD, sizeof(tmdHeader->issuer));
      |                ^
2025-05-21 23:18:47 -04:00
David Korth
c989b382e4 Fix compile errors when building the debug build on Linux with -DENABLE_WERROR=ON.
Mostly just need to check the result of fread(), e.g.:

src/libwiicrypto/bin2h.c: In function ‘main’:
src/libwiicrypto/bin2h.c:66:9: error: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   66 |         fread(bin, 1, fsize, f);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
2025-05-21 23:13:16 -04:00
David Korth
6fb8daa8fb [qrvthtool] Optimize all .png images using optipng, advdef, and oxipng.
qrc_*.o size differences: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)

   text    data     bss     dec     hex filename
   8029      16       1    8046    1f6e qrc_flags.cpp.o [before]
   7513      16       1    7530    1d6a qrc_flags.cpp.o [after]
   -516       0       0    -516    -204 Difference

   text    data     bss     dec     hex filename
  95132      16       1   95149   173ad qrc_hw.cpp.o
  92098      16       1   92115   167d3 qrc_hw.cpp.o
  -3034       0       0   -3034    -bda Difference

   text    data     bss     dec     hex filename
  87257      16       1   87274   154ea qrc_oxygen.cpp.o
  84901      16       1   84918   14bb6 qrc_oxygen.cpp.o
  -2356       0       0   -2356    -934 Difference
2025-05-21 23:06:38 -04:00
David Korth
fafc35430f Update Win32 .rc file copyright notices for 2025. 2025-05-21 21:09:32 -04:00
David Korth
b4fda57d59 Update displayed copyright notices for 2025. 2025-05-21 21:08:43 -04:00
David Korth
c827cb69f4 [librvth] Note that the serial number ranges might not be accurate.
I was considering adding an "HxA" prefix, but that looks ugly.

We can't easily determine if it's HMA (wireless) or HUA (wired) through
the numeric part of the serial number, so just leave it out.
2025-05-21 21:04:35 -04:00
David Korth
d447d795ee Convert various static const and #define to constexpr. 2025-05-21 20:59:48 -04:00
David Korth
47e7dd8d7c [qrvthtool] Consolidate Win32 nativeEvent() stuff.
- Use a typedef for Qt5/Qt6 differences in both versions.
- Use consistent comments.
2025-05-21 20:46:21 -04:00
David Korth
2d8d68a3aa [rvthtool] Un-indent *all* the classes.
QRvtHToolWindow::openRvtH(): This function takes a filename using Qt
separators ('/'), *not* native separators.
2025-05-21 20:44:08 -04:00
David Korth
3114107a4b [librvth] RefFile: Remove reference-counting; use shared_ptr<> instead.
NOTE: Several functions still take RefFile* if they don't need to store
the file pointer. May change them to `const RefFilePtr&` later.

RvtHPrivate: Move the enum variables to after the STL objects.

rvth_init_BankEntry(): Needs to take `const RefFilePtr&` in order to
call Reader::open().
2025-05-21 20:12:42 -04:00
David Korth
f204ddb0a1 [librvth] RvtH::~RvtH(): Delete d_ptr.
Move the private class destruction code to RvtHPrivate::~RvtHPrivate().
2025-05-21 20:02:01 -04:00
David Korth
4395eb37a9 Switch from include guards to #pragma once.
This improves performance with some compilers, especially MSVC.

NOTE: Some include guards are left in because a few files check for them:

- secoptions_win8.h: Checks for __RVTHTOOL_LIBWIICRYPTO_WIN32_SECOPTIONS_H__.
2025-05-21 19:44:47 -04:00
David Korth
400a4ac76c [librvth] RvtH: Moved openGcm(), checkMBR(), and openHDD() to RvtHPrivate. 2025-05-21 19:28:56 -04:00