Rename the .desktop file to com.gerbilsoft.qrvthtool.desktop.
TODO: Maybe com.gerbilsoft.rvthtool.qrvthtool.desktop? Not that
I'd be making a GTK+ UI frontend anytime soon...
It takes around 2-3 seconds to open for me for some reason.
Also cleaned up some stuff with native separators. librvth expects
filenames to use native separators, but QFileDialog does not.
It's not as important when extracting from an RVT-H Reader as it is
when importing *to* an RVT-H Reader. This should improve performance
by a bit in some cases.
This is basically the same as O_SYNC, though we have up to a 1 MB buffer
that gets written to disk at once.
I tried with 32 MB flushing at first, but it just resulted in the
progress bar going up in 32 MB increments with freezes due to the
32 MB hitting the I/O cache first.
RefFile::flush(): Call fsync() on Linux and FlushFileBuffers() on Windows
to ensure the file is actually flushed to disk. fflush() only clears the
stdio buffers.
TODO: Use Win32 and/or POSIX I/O directly? I tried this with open(),
lseek(), read(), write(), etc., but it wasn't able to read the ticket/TMD
signatures for some reason. This solution should be good enough for now.
Not sure why this happens...
TODO: Rewrite RefFile to use raw I/O instead of stdio, then use O_DIRECT
with 512-byte aligned buffers and maybe O_SYNC again.
TODO: Occurs after importing *or* extracting. We should limit it
to only update after importing.
Added some convenience functions to get the selected bank entry,
either as a bank number or as a bank entry.
Otherwise, the actions don't get enabled/disabled properly.
Among other things, the "Close" action remains enabled on startup with
no device loaded, and remains enabled after closing a device in some
cases.
QT_WRAP_CPP is somehow being detected as a "command", even though
it's not a valid function. Use a version check instead.
This fixes QT_WRAP_*() issues on Xubuntu 16.04, which has Qt 5.5.1.
On Wayland systems, the window icon is obtained from the .desktop file,
so we need to call QGuiApplication::setDesktopFileName().
QRvtHToolWindow.cpp: Update the Mac proxy icon comment.
- Moved init() into the private class constructor.
- Moved actLanguageSysDefault creation from retranslateSystemDefault()
to the private class constructor.
- Use fseeko()/ftello() instead of fseek()/ftell().
- Explicitly check memcmp() != 0.
- Reorganized a few structs to use less memory.
- Save pointers instead of calling functions repeatedly.
- Remove NULL checks for delete.
MessageWidget::paintEvent(): Reduce the scope of painter so it's only
constructed when it's needed.
QRvtHToolWindow::openRvtH(): Properly delete rvth_tmp instead of deleting
d->rvth again, which may result in a double-free.
QRvtHToolWindow::on_actionOpenDevice_triggered(): delete selectdeviceDialog
when we're done using it.
SelectDeviceDialog.hpp, DeviceQueryData(): Initialize size in the zero-arg
constructor.
libwiicrypto/cert.c, cert_fakesign_ticket(): Use size_t for signing_offset.
Use off64_t where necessary.
config.libc.h is now force-included in every translation unit.
FIXME: Some things are truncating 64-bit file sizes to uint32_t...
The RP_GIT_* strings are made up of multiple strings themselves, so MSVC
gets confused.
From the AppVeyor build:
src\nusresign\main.c(135): error C2308: concatenating mismatched strings [C:\projects\rvthtool\build\src\nusresign\nusresign.vcxproj]
Concatenating wide "NUS Resigner v1.1.1+
Copyright (c) 2018-2022 by David Korth.
git: " with narrow "(no branch)"
This lets us consolidate sets of fputs() and printf()-style functions
into a single printf(), which reduces code size. Note that it will
definitely increase the size on Windows due to more UTF-16 strings.
- Converted some more printf()-style functions to fputs()-style.
gcc does this automatically if possible, but MSVC does not.
- Updated copyright years.
[nusresign] main.c: Remove a few extra leading spaces in print_help().
[nusresign] resign-nus.cpp:
- Removed a line of debugging code.
- Ticket type change from Disc to Installable should be on stdout,
not stderr.
TODO: There's a few more functions that need TCHAR conversions, but they
require changing more code elsewhere.
Code size differences: (64-bit Gentoo Linux, gcc-12.1.0, release build, no LTO)
[NOTE: Windows builds will increase due to more TCHAR usage.]
text data bss dec hex filename
3151 160 0 3311 cef main.c.o [wadresign, before]
3132 160 0 3292 cdc main.c.o [wadresign, after]
-19 0 0 -19 -13 Difference
text data bss dec hex filename
6581 0 0 6581 19b5 print-info.c.o [wadresign, before]
6146 0 0 6146 1802 print-info.c.o [wadresign, after]
-435 0 0 -435 -1b3 Difference
text data bss dec hex filename
14164 8 0 14172 375c resign-wad.cpp.o [wadresign, before]
11888 8 0 11896 2e78 resign-wad.cpp.o [wadresign, after]
-2276 0 0 -2276 -8e4 Difference
text data bss dec hex filename
2561 96 0 2657 a61 main.c.o [nusresign, before]
2526 96 0 2622 a3e main.c.o [nusresign, after]
-35 0 0 -35 -23 Difference
text data bss dec hex filename
8787 8 0 8795 225b print-info.cpp.o [nusresign, before]
8574 8 0 8582 2186 print-info.cpp.o [nusresign, after]
-213 0 0 -213 -d5 Difference
text data bss dec hex filename
5374 8 0 5382 1506 resign-nus.cpp.o [nusresign, before]
5341 8 0 5349 14e5 resign-nus.cpp.o [nusresign, after]
-33 0 0 -33 -21 Difference
This lets the query interface know if the device is accessible.
NOTE: Currently only implemented on Linux/udev.
[rvthtool] query.c: On Linux, print the device accessibility.
If not accessible, the access() error will be displayed.
TODO: qrvthtool; Windows support.
Listen for device notifications. If we get a notification that a disk
device was added or removed, refresh the entire list. This isn't as
nice as the udev method, since that one only adds or removes the
specific device, but it works for now.
TODO: Make the Windows one a listener by creating a hidden window?
- Don't cache the QLocale.
- Iterate through q->children() to hide all the widgets instead of
hard-coding them.
- QEvent::LocaleChange should retranslate the UI instead of just
caching the locale.
markUiBusy(), markUiNotBusy(): Call QCoreApplication::processEvents()
to make sure the mouse cursor actually gets set, since opening the
RVT-H Reader is a blocking operation.