Stop the search index silently hiding games - #21
Open
lepht wants to merge 1 commit into
Open
Conversation
This was referenced Aug 11, 2026
lepht
force-pushed
the
fix/search-index-cap
branch
from
August 12, 2026 00:41
c7033f6 to
d44a140
Compare
lepht
force-pushed
the
fix/search-index-cap
branch
from
August 12, 2026 01:25
d44a140 to
a0f2fcf
Compare
lepht
force-pushed
the
fix/search-index-cap
branch
from
August 12, 2026 03:42
a0f2fcf to
131616b
Compare
SEARCH_INDEX_MAX was 8192, with a comment claiming a card with more roms than that is not a search problem. It is: a full set for a couple of systems gets there, and past the ceiling games simply stopped being findable with nothing said about it. Worse, the check sat inside the per-directory readdir loop, so truncation followed directory order - whole systems at the tail of the walk vanished wholesale, and which ones moved around as the card was written to. Verified on a 34066 rom card: a game in the last directory readdir returned was on the card and returned no results. Raise the ceiling to 32768. An entry measures ~200 bytes of heap (measured with mallinfo2 over a 6020 entry index), so that is ~6.5MB, held only while the menu is up - nextui exits before a game launches, so the index cannot take memory from an emulator. Then make hitting it visible rather than silent: - the walk stops at the top level once full, instead of reopening every remaining system just to bail out of it again - the match count reads "32746+", so it is a floor and not a total - an empty result off a capped index says "some games are not indexed", which is the one case where a bare "No matches" would be a lie
lepht
force-pushed
the
fix/search-index-cap
branch
from
August 12, 2026 05:04
131616b to
1332aa4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2, kept separate so the feature and this correctness fix can be reviewed apart. Based on
feat/rom-search, since that's where the search code lives.The bug
SEARCH_INDEX_MAXwas 8192, carrying a comment I wrote claiming that "a card with more roms than this is not a search problem." That's wrong — a full set for a couple of systems reaches it — and past the ceiling games simply stopped being findable, with nothing said about it anywhere in the UI.It failed worse than dropping a random slice. The cap check sat inside the per-directory
readdirloop, so truncation followed directory walk order: whole systems at the tail vanished wholesale rather than a scattered sample.readdirorder isn't alphabetical or stable, so which systems disappeared could change when the card was written to.Reproduced on a 34,066-ROM card: planted a uniquely-named game in the last directory
readdirreturned, and searching for it gave zero results while the file sat on the card.The fix
Raise the ceiling to 32768. An indexed entry measures ~200 bytes of heap — measured with
mallinfo2around the build over a 6,020-entry index,1205328 bytes = 200.2 bytes/entry— so the new ceiling is worth ~6.5 MB. That memory is held only while the menu is up:queueNext()writes the command to/tmp/nextand setsquit = 1, and the launcher shell loop runs the emulator only after nextui.elf has exited, so the index can't take memory from a game. The ceiling is really a brake on how long the first search waits for the card, not on memory.Then make hitting it visible instead of silent:
32746+— a floor, not a total.No matches / some games are not indexed, which is the one case where a bare "No matches" would be a lie.Testing
Desktop build driven headless under Xvfb, four cases by screenshot:
0+32746+40The truncation log line fires exactly once on the capped card and never on the normal one, so behaviour is unchanged for ordinary libraries.
Still open
The first-search walk cost is unmeasured on hardware. On this x86 host it's 9.5–17 ms warm and 32 ms cold at ~6k games, but the walk is I/O-bound and a microSD is a different machine entirely. If it turns out slow enough to be felt, the answer is feedback during the build rather than a smaller ceiling — filed separately rather than guessed at here.