Commit Graph

12927 Commits

Author SHA1 Message Date
David Korth
19e50372da [librptexture] ICO: For Win1.x icons with both DIB and DDB, show both in the icon directory.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
The DDB is usually half the size of the DIB.

NOTE: The DDB, which comes after the DIB, is missing the format WORD.
The header is otherwise the same format.

Rename vv_icons to v_icons, since it's not a vector of vectors.
2025-06-17 20:09:41 -04:00
David Korth
37dcb72e6b CMakeLists.txt: Use .99 versions for CMake VERSION_GREATER checks. 2025-06-16 21:44:24 -04:00
David Korth
2613201bb3 NEWS.md: Mention the 'abgr' swizzle issue on little-endian systems. 2025-06-16 19:46:40 -04:00
David Korth
aeb568dda3 [librptexture] rp_image::swizzle(): Fix the 'rgba' check.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
Need to byteswap it on little-endian. Otherwise, it'll end up catching
'abgr' instead.

Also, add a big-endian check on Neon, since it's possible for ARM to
operate in big-endian mode.
2025-06-16 19:33:16 -04:00
David Korth
a138b123e3 [librptexture] qoi.h: Swap R/B in qoi_encode() and qoi_decode().
This eliminates the need to call rp_image::swizzle() in
QoiPrivate::loadImage().

qoi.h now expects images to be in the same ARGB32 format
as the rest of rom-properties.

NOTE: Only adjusting what's read from or written to bytes[],
not the internal pixel buffers.
2025-06-16 19:32:30 -04:00
David Korth
4badcf4bfb [libromdata/tests] ImageDecoderTest: Add two Qoi test images.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
- argb-reference.qoi: Qoi version of argb-reference.png
- rgb-reference.qoi: Qoi version of rgb-reference.png
2025-06-16 01:06:17 -04:00
David Korth
b0d5e05cce [librptexture] qoi.h: Revert the qoi_decode() change.
A new test I added failed with the qoi_decode() change. Reverting it
fixes the test, even with the qoi_read_32() optimization still in place.
2025-06-16 01:05:40 -04:00
David Korth
523de9913c [librptexture] qoi.h: Optimize 32-bit reads and writes.
...for the basic read/write functions and qoi_decode().

qoi_encode() isn't being used at the moment, so I'm not going to try
to optimize it.

TODO: Verify that the memcpy()'s don't break on big-endian.
2025-06-16 00:57:49 -04:00
David Korth
f0ee7bee10 [librptexture] Qoi: qoi.h has the R and B channels swapped compared to what rp_image expects.
This was broken since support for Qoi was added in v2.5. Not sure why
I didn't notice it until now...

Affects: v2.4 - v2.5
2025-06-16 00:51:54 -04:00
David Korth
c3643b9244 [libpng] Update: v1.6.48 -> v1.6.49
Includes the APNG patch.
2025-06-15 14:25:09 -04:00
David Korth
72b628d8ba [win32] RP_ShellPropSheetExt_Private::initListData(): Use nearest-neighbor for integer upscaling. 2025-06-15 11:35:55 -04:00
David Korth
933b3d2f4e NEWS.md: Mention KF5/KF6 RFT_LISTDATA image quality improvements. 2025-06-15 11:25:53 -04:00
David Korth
eee8b83f9a [kde] ListDataModel::updateIconPixmaps(): Improve icon scaling on Qt5 and Qt6.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
Instead of scaling larger icons down, set a device pixel ratio. For the
usual case of iconSize = (32, 32), on a 200% display, the actual physical
icon size is (64, 64). Xbox 360 achievement icons are 64x64, so this will
show the full icon on a 200% display instead of scaling down to 32x32,
then scaling back up to 64x64.

For icons smaller than 32x32, the icon is scaled up using integer factors
to the next highest integer multiple that's >= 32x32, then the device
pixel ratio is set.

NOTE: GTK+ doesn't seem to have the same issue.

TODO: Verify Win32, especially with icon directories.
2025-06-15 11:17:42 -04:00
David Korth
b19f128903 [librptexture] ICOPrivate::~ICOPrivate(): Use dir.is_res instead of isResource().
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
Removed isResource().
2025-06-13 18:35:18 -04:00
David Korth
73eb28c4ee [librptexture] ICO: Show the icon directory with all the icon variants.
For standalone Win3.x icons and cursors only.

Color depth and format are shown, including if it's PNG format.

ICOPrivate::loadImage(): Remove caching stuff, since it's handled
by ICO::loadInternalImage().
2025-06-13 18:30:09 -04:00
David Korth
e5c512ca92 [rp-download] SetFileOriginInfo_win32.cpp: Load NTDLL.DLL function pointers using GetProcAddress().
AppVeyor's MSVC 2015 image doesn't have ntdll.lib for some reason.
2025-06-13 18:14:49 -04:00
David Korth
1da1c39c18 [librptexture] ICO: Remove pIconHeader.
Use dir.bestIcon_idx as an index into d->iconBitmapHeaders[] instead.
2025-06-13 18:13:16 -04:00
David Korth
da852e5d50 [librptexture] ICOPrivate::loadIconDirectory_Win3(): Missed an le32_to_cpu(). 2025-06-13 18:08:02 -04:00
David Korth
f157be4a97 [rp-download] SetFileOriginInfo_win32.cpp: Use NTDLL to write the Alternate Data Stream with just the file handle.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
Note that we have to use NtWriteFile(). Using WriteFile() results in
ERROR_BAD_COMMAND.

If the ADS write fails, it will be deleted with NtDeleteFile().

NOTE: Unicode only! ANSI builds won't write the ADS anymore.
ANSI builds (if they even work at all) should only be used on
Win9x, which doesn't support ADS anyway.

TODO: Convert NTSTATUS to POSIX error codes?
2025-06-12 23:33:56 -04:00
David Korth
a19815f744 [librptexture] ICO: Remove imageResType() in favor of dir.rt and dir.is_res.
This simplifies the code a bit more and removes some function calls.

dir.rt is the individual bitmap resource type: RT_ICON, RT_CURSOR
dir.is_res is true for .exe/.dll resources, and false for .ico/.cur files.
2025-06-12 22:00:05 -04:00
David Korth
a5554fd244 [librptexture] ICO: Remove pBestIcon from the icodir structs. Use an index instead.
This simplifies things a bit.
2025-06-12 21:42:18 -04:00
David Korth
0c512deed6 [librptexture] ICO: Rework the private loadImage_*() functions (except Win1) to take a bitmap image index.
This will allow us to show a list of all the bitmaps in a given icon.

NOTE: loadInternalImage() ensures that d->img_icon is set to the "best"
icon; that is, icon index "-1". The loadImage_*() functions won't use
d->img_icon themselves, so if the "best" icon is manually selected
using positive indexes, it won't be cached.
2025-06-12 21:31:09 -04:00
David Korth
704a5eead5 [librptexture] ICOPrivate::loadImage_WinVista_PNG(): Use res.pBestIcon->nID instead of res.id.
res.id may have accidentally worked because it was set to -1, but it's
the ID of the RT_GROUP_ICON, not the RT_ICON.
2025-06-12 21:11:41 -04:00
David Korth
783d384b04 [libromdata] EXE: Add .mui and .mun to the file extensions list.
.mui is a resource DLL used for localization.

.mun is used in Windows 10 1903+ (or possibly slightly earlier) for
icons in C:\Windows\SystemResources\ , instead of storing icons in
e.g. notepad.exe.
2025-06-12 21:07:21 -04:00
David Korth
9ca7daf9c8 [libromdata] EXE: No application icon if it's not NE/PE or not an executable.
Also, add d->file.reset() to more error paths in the constructor.
2025-06-12 21:06:01 -04:00
David Korth
c31919826b [libromdata] IsoPartitionPrivate::getDirectory(): Fix an inverted comment. 2025-06-12 20:58:57 -04:00
David Korth
bf2d3af7c3 [gettext.win32] Updated to gettext-0.25.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
Compiled with:
- i386:  gcc-15.1.0, MinGW-w64 12.0.0
- amd64: gcc-15.1.0, MinGW-w64 12.0.0

The file sizes have grown a bit. In particular, xgettext.exe grew from
1,529,344 bytes to 8,492,544 bytes. This might be related to various
gnulib updates, since libgnuintl-8.dll has a bunch of new exports
compared to 0.24.
2025-06-11 22:30:05 -04:00
David Korth
e2eede76f7 Merge branch 'feature/IsoPartition-readdir'
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
Includes:
- IsoPartition::readdir()
- ISO-9660 Joliet support
- ICO parser (for Win1.x and Win3.x)
- EXE thumbnailing (for Win1.x, Win3.x, and Win32/Win64)
- ISO thumbnailing via AUTORUN.INF
2025-06-09 23:48:08 -04:00
David Korth
e12bb51b47 [librptexture] ICOPrivate::loadImage_Win3(): Move the bitmap size check up a bit.
Some checks failed
Codecov / run (push) Has been cancelled
2025-06-09 21:05:24 -04:00
David Korth
417825cd6f [librptexture] ICO: Handle Win3.x 1bpp (monochrome) icons.
Tested by converting Win2.x BANG.ICO to Win3.x format.

ICOPrivate::loadImage_Win1():
- Note that the mask is *before* the icon.

ImageDecoder::fromLinearMono_WinIcon():
- Take separate pointers for the icon and mask data. Win3.x icons are
  typically stored upside-down, so this lets us handle that outside
  of the decoder function. This also means the image data size does
  not have to be 2x. Note that `img_siz == mask_siz` must be true.
2025-06-09 20:21:25 -04:00
David Korth
da94256a37 [xdg] mime.no-thumbnail.types: Add Windows icon/cursor MIME types.
FIXME: KDE isn't showing the ROM Properties tab on .ico files,
but Thunar and Nautilus show it just fine...
2025-06-09 20:00:09 -04:00
David Korth
222f2456fd [librptexture] ICOPrivate::loadImage_Win3(): Minor adjustment to the assertion message. 2025-06-09 19:45:04 -04:00
David Korth
11da731ef7 [librptexture] ICOPrivate::loadImage_Win3(): Add assertions for unsupported icon formats.
TODO: Need a test icon for Win3.x monochrome icons.
2025-06-09 19:43:51 -04:00
David Korth
a4efadbc56 NEWS.md: Mention issues #170 and #232. 2025-06-09 19:28:52 -04:00
David Korth
0e1a5ce237 [libromdata] ISO::loadFieldData(): Show the AUTORUN.INF fields in a new tab.
The fields are displayed as-is.

Changed autorun_inf from unordered_map<> to map<> for alphabetical sorting.
TODO: Preserve the original sort order?

TODO: Store the original key case?
2025-06-09 19:26:40 -04:00
David Korth
d557b607c2 [[libromdata] ISO: Only load the "[autorun]" section for now.
TODO: Read more sections later.
2025-06-09 19:21:47 -04:00
David Korth
1897ac198f [libromdata] ISO: Load the entire AUTORUN.INF for display purposes.
It's not displayed yet, but it's loaded.

The section names are concatenated with the key names, e.g.:
"autorun|icon"

IsoPartition::open(): Set m_lastError = ENOENT if the file isn't found.
2025-06-09 19:18:31 -04:00
David Korth
5083161c23 [librptexture] ICO: Fix regression that broke Win3.x icons; remove unneeded assert().
ICOPrivate::loadIconDirectory_Win3():
- rt == res.type *only* for Win1.x. For Win3.x, res.type is RT_GROUP_ICON
  or RT_GROUP_CURSOR. For Win1.x, it's RT_ICON or RT_CURSOR.

This fixes a regression from commit 22da0c2e21.
([libromdata] EXE: Load icons from Windows 1.x/2.x executables.)
2025-06-09 18:50:44 -04:00
David Korth
22da0c2e21 [libromdata] EXE: Load icons from Windows 1.x/2.x executables.
Windows 1.x/2.x does not have RT_GROUP_ICON. For NE executables,
check for RT_GROUP_ICON, and use it if found. Otherwise, check for
RT_ICON and use that if found.

IResourceReader: Add a function has_resource_type() to check if the
executable has any resources of the specified type.

[librptexture] ICO: Handle RT_ICON and RT_CURSOR as Windows 1.x/2.x.
TODO: Check the header to verify?
2025-06-09 18:37:47 -04:00
David Korth
8f762b7c78 ICOPrivate::ICOPrivate(): Return if the type is unrecognized.
Otherwise, dir.res will be allocated, with unpredictable results.
2025-06-09 18:30:01 -04:00
David Korth
acdf3544e1 [libromdata] NEResourceReader::lookup_resource_ID(): OR the type with 0x8000.
With Win16, the high bit needs to be set for ordinal resources.
Otherwise, it's a named resource, which we don't support right now.

Thumbnailing still worked because we were using the code path for
the "first" icon using NEResourceReader::open(), which had the
`| 0x8000` bit already.
2025-06-09 18:24:34 -04:00
David Korth
bb2e0b5e87 [kde] AchQtDBus::notifyFunc(): Fix the Qt4 build.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
2025-06-09 18:13:47 -04:00
David Korth
65a3855b98 [libromdata] NEResourceReaderPrivate::loadResTbl(): Fix an off-by-one error that broke reading resources from SkiFree 1.0.
SkiFree doesn't have any named resources, so its resource table ends
immediately after rscEndTypes. The off-by-one prevented us from
recognizing the presence of rscEndTypes.

SKI.EXE can now be thumbnailed.
2025-06-09 18:11:03 -04:00
David Korth
847342306a [libromdata] NEResourceReaderPrivate::loadResTbl(): Allow string names for now.
Some Windows 3.1 programs, e.g. CALC.EXE, have RT_GROUP_ICONs that use
string names. We need to allow this in order to thumbnail CALC.EXE.
2025-06-09 18:08:50 -04:00
David Korth
3fdd98929d [libromdata] IsoPartition: Update the "\x00" and "\x01" comments. 2025-06-08 16:10:11 -04:00
David Korth
41765be492 NEWS.md: Mention the ISO and Windows icon changes. 2025-06-08 15:53:24 -04:00
David Korth
4342ce8a1b [libromdata] ISO, IsoPartition: Simplify the Joliet escape sequence parser a bit. 2025-06-08 15:29:25 -04:00
David Korth
6e7d57282f [libromdata] ISO: Show the Joliet level.
Some checks are pending
Codecov / run (push) Waiting to run
I was considering exporting this from IsoPartition, but the IsoPartition
isn't accessible at this point. We're reading all of the volume
descriptors in checkVolumeDescriptors() anyway, so that sets a local
version of jolietSVDType, which is then checked in loadFieldData().
2025-06-08 15:00:39 -04:00
David Korth
3f1f92b18a [libromdata] IsoPartition: Add basic support for Joliet directories.
If a Supplementary Volume Descriptor is present, check for the Joliet
UCS-2 escape sequences. If found, use the SVD root directory.

Filenames in the SVD root directory are encoded in UCS-2 (big-endian).
The filename length is in bytes, not code points.

NOTE: Currently using a very cheap hack to convert UCS-2 to cp1252,
or more accurately, ISO-8859-1. It's good enough for our purposes
for now. (specifically, getting the icon from AUTORUN.INF.)

TODO: Better character set conversion.
2025-06-08 14:46:56 -04:00
David Korth
a5d22511e0 [libromdata] IsoPartition::readdir(): If there's no more non-zero bytes, return nullptr.
Otherwise, an empty IFst::DirEnt is returned.
2025-06-08 14:44:49 -04:00