Random order does not use whole playlist when lots of mods (8000+) on list
sauhir opened this issue · comments
When I add e.g. 8000 mods into the playlist the shuffle never goes past roughly the halfway point in the playlist.
I tried clicking next song for a long time to see if it wasn't just bad luck with the random generator, but it does seem to be a bug.
It seems that the bug is on this line: https://github.com/koobo/HippoPlayer/blob/master/puu016.s#L5682
The random generator output is capped to 0xfff, for some reason, it should be capped to 8192 instead.
Related to this, there's a bookkeeping function to keep track of which files have been played. There's a table that can contain 8192 entries, taking a whole lot of 1024 bytes of memory.
- bookkeeping table: https://github.com/koobo/HippoPlayer/blob/master/puu016.s#L968
- limit check: https://github.com/koobo/HippoPlayer/blob/master/puu016.s#L5546
- another check: https://github.com/koobo/HippoPlayer/blob/master/puu016.s#L9103
I've now gloriously removed the random problems and upped the limit to 32766 modules :-)