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?
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.
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.)
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?
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.
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.
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().
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.
This fixes a Windows build regression from commit 9994c2df94.
([libromdata] RomDataFactory: Explicitly prevent ".ico" and ".cur" from being thumbnailed on Windows.)
This function takes a zero-based index and returns a resource ID for
the given resource type if it's within range. Otherwise, it returns
a negative POSIX error code.
[libromdata] PEResourceReader, NEResourceReader: Implement it.
[libromdata] EXE: Use lookup_resource_ID for positive icon indexes.
This fixes thumbnailing for discs whose AUTORUN.INF specify a
positive, non-zero icon index.
TODO: Older discs may have truncated ISO-9660 filenames. Need to
parse Joliet file systems, maybe...
The icon index can be:
- 0: First icon
- >0: Zero-based icon index
- <0: Resource ID
EXE: New function loadSpecificIcon() to load an icon given an index.
For iconindex == 0, the icon is cached in d->img_icon.
TODO: Implement a function in IResourceReader to look up a resource ID
from the zero-based index.
Uses the first icon in the first available language.
New function loadResourceReader() which ensures rsrcReader is loaded.
[librptexture] ICO: Fix resource loading issues:
- Use the correct resource file pointer, not this->file.
- Add IconRes_Win3 and CursorRes_Win3 cases where appropriate.
- Ensure d->iconType doesn't get overwritten after it's set by the
ICOPrivate constructor for resources.
FIXME: VBoxWindowsAdditions.exe's PNG icon loads fine, but the 128x128
"regular" icon is corrupted.
Also add a note saying EXE shouldn't be registered for thumbnailing,
either.
This will still allow using `rpcli`, and for subclasses to use
EXE to thumbnail e.g. ISO images.
NOT TESTED; need to add it to the EXE class to test it.
(.ico files still work as they did before.)
Added a constructor that takes an IResourceReaderPtr and the
type/id/lang of the icon. Type should be RT_GROUP_ICON or
RT_GROUP_CURSOR. These are all saved in icodir_res.
The dir union is now initialized in the ICOPrivate constructors,
and is only reset in the ICOPrivate destructor.
loadImage_Win3(): Use a new IRpFilePtr for the icon data.
- For .ico, it's a copy of this->file.
- For Windows executables, it's opened from the IResourceReader.
- Starting address is the icon bitmap address for .ico and
0 for IResourceReader.
In file included from src/libromdata/stdafx.h:63,
from src/libromdata/Media/ISO.cpp:10:
src/libromdata/Media/ISO.cpp: In member function ‘virtual uint32_t LibRomData::ISO::imgpf(LibRpBase::RomData::ImageType) const’:
src/libromdata/../common.h:93:45: warning: unused variable ‘d’ [-Wunused-variable]
93 | # define RP_D(klass) klass##Private *const d = static_cast<klass##Private*>(d_ptr)
| ^
src/libromdata/Media/ISO.cpp:984:9: note: in expansion of macro ‘RP_D’
984 | RP_D(const ISO);
| ^~~~
This is a bit cleaner than the casting method, though it is a bit messy
at points.
isResource(): Returns true if it's an icon from a resource.
(Currently not set at all...)
reset_dir_union(): Clear the directory union. Called in ICOPrivate's
destructor and various error paths.
TODO: Add resource loading. May need to move IResourceReader from
libromdata to librpbase.
ICONDIR and GRPICONDIR are basically the same, but ICONDIRENTRY and
GRPICONDIRENTRY have different sizes. Use an rp::uvector<uint8_t>
and casting to handle this.
Still only supports .ico files for now.
Limitations:
- Only supports .ico, not .exe.
- The filename must match the ISO-9660 filename. Some older Win9x
discs use a long filename in AUTORUN.INF that's only listed as
such in the Joliet extension.
Removed some debugging code from the IsoPartition readdir()
implementation testing from earlier.
fromLinearCI4() doesn't support Host_xRGB32, and we're filling
in the alpha channel ourselves.
TODO: Add Host_xRGB32 support to fromLinearCI4()?
fromLinearCI8() supports it...
This fixes a regression from commit de802835f7.
([librptexture] ICO: Handle 8-bit color icons.)
First, the image size is checked. If either width or height are larger
than the previously-selected image, this image is picked. Otherwise,
if the size is identical (both width and height), and bitcount is
higher, then the image is selected.
TODO: Better non-square icon handling? (Use "largest area"?)
- Forgot to move convimg to img when converting from CI8 to ARGB32.
- Make sure sBIT is updated with alpha=1. Otherwise, RpPng::save()
will tell libpng that there's no alpha, so the resulting PNG image
saved using `rpcli -x3` won't be transparent.
iconHeader is now saved in the private class instead of being loaded
in loadImage_Win3().
The dimensions are now set correctly when an icon's "best" image is
in PNG format.
ico_structs.h: Add PNG chunks.
NOTE: BI_BITFIELDS is not supported right now. (Is that even used for
32-bit ARGB, or is it for 16/24 only?)
Fix mask handling for 48x48 icons by aligning stride to 32-bit.
For these icons, an extra transparent color is added.
The image is flipped *after* the mask is applied because the mask is
also upside-down.
TODO:
- Set sBIT.
- Apply the icon mask for CI8 and higher-color icons. (CI8 will need to
be converted to ARGB32.)
This seems to place the mask image at the top of the image once it's
flipped, but maybe it's that it's technically two bitmaps and not
one giant bitmap.
TODO: Test it with a right-side up icon.