From acdf3544e19ef6d94e140c5d59bfc9b708677893 Mon Sep 17 00:00:00 2001 From: David Korth Date: Mon, 9 Jun 2025 18:24:34 -0400 Subject: [PATCH] [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. --- src/libromdata/disc/NEResourceReader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libromdata/disc/NEResourceReader.cpp b/src/libromdata/disc/NEResourceReader.cpp index c689fd840..914e8f661 100644 --- a/src/libromdata/disc/NEResourceReader.cpp +++ b/src/libromdata/disc/NEResourceReader.cpp @@ -816,8 +816,12 @@ int NEResourceReader::lookup_resource_ID(int type, int index) return -EINVAL; } + // NOTE: Type and resource IDs have the high bit set for integers. + // We're only supporting integer IDs, so set the high bits here. + type |= 0x8000; + // Get the resource directory for this type. - RP_D(NEResourceReader); + RP_D(const NEResourceReader); auto iter_find = d->res_types.find(type); if (iter_find == d->res_types.end()) { // Not found.