The Unfinished Business (TODOs)

The TODO list that is longer than the list of goals in my project application

Code related fixes / improvements [Highest priority]

These are all the things which either I left unfixed or picked the suboptimal solution because I wasn’t willing to spend more time on the problem, or the problem involved messing with the existing code too much, or I just spotted a bug way too late.

Most of these will require some context from and some understanding of the code. I have written here the relevant locations in the code, and there are comments in the code pointing to these errors. But if anybody is willing to fix these and some of the code is poorly documented or ambiguous, they can freely approach the Discord channel of ScummVM and tag me @avdx , or write to my email aashwin.vaish@research.iiit.ac.in .

  1. GroupedListWidget::sortGroups() at groupedlist.cpp:163 This line keeps pushing back _listColors.front() to the _listColors, which not only breaks if _listColors is empty (not sure if it could reach this state, though), but also just keeps increasing the size without bound.
  2. Add BMP support to the loadSurfaceFromFile() at grid.cpp:289 – Currently BMP support is completely missing, because no icons are in BMP format.
    2 (a). Refactor the loadSurfaceFromFile() and ThemeEngine::addBitmap() code because a lot if it is similar.
  3. Add ability to load icons from all types .svg, .bmp, and .png for any purpose – Currently the GridWidget::reloadThumbnails(), GridWidget::loadPlatformIcons() and GridWidget::loadFlagIcons() are hardcoded to load game icons and platform icons in .PNG, and the flag icons in .SVG.
    3 (a). Once the above is accomplished, it should be trivial to outfactor the loadPlatformIcons() and loadFlagIcons() [related to 2(a)], and possible to also outfactor reloadThumbnails() as well.
  4. Improve the performance on scrolling – There is noticeable jitter when scrolling the grid. It is very apparent when one compares the scenario of scrolling when screen has lots of grid items on screen at once, versus when only a few of them are, like a sparse group layout.
    This needs to be looked into. Will a different draw() method work? Do we need to do away with GridItemWidget::drawWidget() and do the batch drawing within GridWidget::drawWidget()? It may be better to first render all we need to a single GraphicsSurface, and then render that to the screen? Whatever the case may be, this is one of the highest priority TODO.
  5. Consider margin and padding for grid item widgets – Currently, the margin and padding are very poorly defined for a grid item widget. Typically, the margin and padding are considered properties of an item. But in the code, the “margin” for grid items is defined within GridWidget, and the padding is non-existent. A possible solution to this is to define margin and padding within GridItemWidget class.
  6. Find a different solution to drawing selection borders – Currently, in order to display a selection border around hovered / selected elements and to remove the selection border, a “cover up” rectangle has to be drawn to “overwrite” the selection border, and then the entire item has to be redrawn on top of this rectangle. There is a FIXME describing this in GridItemWidget::drawWidget() at grid.cpp:99. Ideally, we should only have to draw the border, maybe this can tie in with the batch rendering approach of (4).
    Also some observation – If we try and render the grid on a gradient background, like in ResidualVM theme, the coverup rectangle and the background color around the title text, is very significantly visible as it is a solid color. Another reason to fix this.
  7. Edit mode feature of grouped list widget – GroupedListWidget is derived from ListWidget, which features an Edit mode. Due to time limitations, I wasn’t able to test this mode for GroupedListWidget. My hunch is that it doesn’t work, and currently Edit Mode must not be used with GroupedListWidget. This is not very troubling since nothing really uses grouped list in the ScummVM code except the new launcher, which sets the edit mode to off. But nevertheless, this feature should be explicitly disabled within GroupedListWidget.
  8. Numbering mode feature of grouped list widget – GroupedListWidget also derives the Numbering mode from ListWidget, but it isn’t equipped to number the elements in groups. The way it could work is that the groups are labelled “1”, “2”, “3”, … and the items within it could be “1.1”,”1.2″,”1.3″, … and there may be two parameters selecting the major and minor index numbering types.
  9. Remove linear traversal after binary search in scroll logic – In GridWidget::calcVisibleEntries() in grid.cpp:516, there is a linear traversal to get the first item in the row, as the binary search returns the last item in the row. This can be removed and replaced with a static calculation because the width of the grid items are fixed.
  10. Avoid unnecessary steps – There are a few instances in code where reflowLayout() is called even when only certain subset of steps is necessary, which can be refactored into a function. These instances are in GridWidget::setEntryList(), GridWidget::toggleGroup()

Essential Features related TODOs [Medium Priority]

These are either addition of much required features, or fixing or redesigning or refinement of some implemented feature. It is difficult to pinpoint a single relevant function or code line, so that is not mentioned.

  1. Sort entries beginning with an article correctly – Currently, the sorting of entries under the “First Letter” grouping method does not work correctly when the title begins with an article. So for instance, “The Beast Within”, “The Dark Crystal” are classified under “T…” instead of “B…” and “D…” respectively. This needs to be fixed.
  2. Add a distinction between EGA and VGA entries – Some games which have EGA and VGA versions are stored as different game entries, but the difference is reflected in the title in the list view as additional info within parenthesis. But in the grid view, we currently strip the title of this extra info using pattern matching, so the EGA/VGA distinction is lost. Add some way to bring this info back.
  3. Group the game variants of the same title under one entry – Let’s say that the user has installed the DOS and the Amiga versions of the game, then these two will appear as two distinct entries in the grid, same when different localized versions of the game are installed (where the games only contain one language), these version will all be their separate entry. For example, if one installs all the (5) localizations of “Lure of the Temptress” game from the ScummVM downloads page, they will end up with 10 separate entries in their grid, 2 (VGA + EGA) for each of the 5 languages (English + Spanish + French + German + Italian). So there can be a grouping system and a switching system to manage these, and this functionality can be added to the existing Options menu.
  4. Add more layout variables – Despite my best efforts to expose all grid layout parameters to the theme, there are still several parameters which are hardcoded, and should come from the theme. Here I mention a few of them, but there may be more:
    3 (a). The maximum number of lines allowed to display the title (Currently hardcoded to 2).
    3 (b). Layout of the icon tray should come from the theme.
    3 (c). Background color of the group headers (Currently is the same as the list selected item highlight color).
  5. Complete the iconset – While the game logos will be a much longer task, the platform and language icons are exhaustive, and running the application will notify in the command line which icons are missing. These need to be added.
    4 (a). Particularly in language, all flags are in place, but EN_ANY requires a special icon in which the US and UK flags are diagonally joined. But the .SVG from Wikimedia (https://commons.wikimedia.org/wiki/File:English_language.svg) does not render properly in the application. This either requires a new flag or a look at the SVGBitmap class.
    4 (b). In case the icon is missing, it should be better to draw a placeholder text in its place simply saying either the language code, or platform code.
    4 (c). Speaking of placeholders, there needs to be a consideration for putting a placeholder icon for engine, in case the game icon is missing. For example, display an AGI icon if KQ3 icon is missing.
  6. Icon Layout on the Grid Item – Currently the platform and language icons are displayed within a fixed size rectangle which comes from the theme files. However, some platform icons are rectangular, and don’t have any official square logos, which means they are harder to read when fitted to a square (since they will get scaled down to fit). So let’s say we try scaling the icon only to the desired height, with the width only limited by the thumbnail width. If the icons are scaled by height, the width of the icon may be too wide, and cover the entire bottom of the thumbnail. Another possible solution is creating “unofficial”, but “recognizable” square icons.
    Anyways, this is a design problem more than a programming problem.
  7. Distribute the icon set – There are much more knowledgeable people in the community regarding this, but my current understanding is that there needs to be a “Default” icon pack supplied with the application that contains platforms + language + only a few games icons, and a “Full” version with high quality platform and flag icons, and all of the games icons.
  8. Test on non-desktop systems – Self explanatory, nothing except PC (Linux + Windows + Mac) builds have been tested.
  9. Non-modal dialogs – Popups which do not block the input to the lower dialog. The icon tray should be one. There is noticeable jittering and seldom graphical glitches that can occur, when opening and closing the tray.
  10. Add quick select to grid view – Similar principle to how it works in the List view, start typing keys to go to the game whose title has that prefix.
  11. Save grouping and grid status to the config – Save variables like the last grouping method to the config. Additionally save and retrieve the last selected game from the scummvm.ini config file, and scroll to it in the beginning in the grid view.
  12. Dealing with <default> – Sometimes games don’t specify which platform or language they are for in the scummvm.ini config file. Which means that the grid cannot display platform / language icon, and fails to group when grouping on platform / language.
  13. None in GroupedListWidget is just ListWidget – In “None” grouping, currently a “All” group is created in which all of the elements are put. But there might be a separate rendering method, where in “None” grouping method, no groups are shown, only the entries, and it looks and behaves like ListWidget in case of list view, and a more compact Grid in grid view.

Ideas for some future work

These are potential ideas that have come up in discussion over on Discord, but the ideas are not fully fleshed out in design yet or have much more prerequisite work than the other TODOs. I encourage further discussion on these, and it would be great to see them in the application.

  1. Icons on group headers – It could be good if there was an icon as a prefix to the group header, so for example, if sorting by “Language” the icon would be the flag, “Platform” would be the platform icon, “Engine” would be the engine icon (mentioned in 4 (c) in the last section), “Publisher” could have the company logo, “Series” could feature custom icons and so on.
  2. Update metadata and icons from the Internet from within the app – There could be a downloader within the application which can fetch and auto update the metadata (used for sorting) and the icons from the Internet.
  3. Upgrade the list view to a table view – There can be addition to the current list view, where the view is constructed of columns of various fields.
  4. Asynchronous loading of thumbnails – The thumbnails can be loaded separately from the grid scrolling. Although the images aren’t super high resolution, and only a few of the supported devices are slow enough to lag in this regard. Maybe useful if the thumbnails are streamed from the Internet in the future? But that’s probably not going to happen. I am not sure if this is quite a good TODO or not ?, but I would like this feature.
  5. Abstract, general purpose Grid – The GridItemWidget class was made when there was only one kind of grid item, the game entries. After the grid was made to support variable height elements, and the group headers were also displayed using GridItemWidget, one flag isHeader was added. But what if this could be abstracted and the rendering method could be made more extensible to support more types of elements. Perhaps so that this GridWidget could replace the one in Save/Load dialog? Again, not a very fleshed-out idea, but something to think about.
  6. Animations – There is an animation class in the GUI code that is sitting unused. It may be used to add some flair to the transitions like collapsing expanding groups, opening tray, etc.

This list of tasks is larger than even what I proposed in my project application document, and definitely a lot more items will come up with time and more review of the code, bug reports and feature requests.

This is the end to the TODO list, for now.

Leave a comment

Your email address will not be published. Required fields are marked *