[Scummvm-devel] [PATCH] let the user sort it's configured games

Max Horn max at quendi.de
Thu Feb 12 08:09:00 CET 2004


Am 12.02.2004 um 12:56 schrieb Gregor Jasny:

> Hi,
>
> this patch lets the user sort it's games diplayed in the menu.

Please always submit patches via our patch tracker! There is a link to 
it on e.g. our web site.

The idea of adding sorting the launcher is probably not bad 
(personally, I don't see the purpose, nor would I use it, but I think 
we might even have a feature request for it, so... <shrug> :-)

>  The changes
> are:
> * Change domain names to 6 digit long strings.
> * Store the gameid in the gameid key
>
> This have several advantages:
> * No more domain name collisions if a gameid is already there.

There never was such a problem. The launcher always used an alternate 
target name if the "default" target name is already in use.

> * Good base for sorting ;)

Disadvantage:
* no more intuitive target names which are very useful when starting 
games from the CLI.

When I develop ScummVM, I often do things like:

  ./scummvm -x4 monkey2

I wouldn't want to do it as

./scummvm -x4 002152

I am a mathematician, but that doesn't mean I want to learn target IDs 
by heart for several dozen games :-).

Sorted targets don't require using non-human-understandable target 
names. You could simply introduce a new config key, like "sortid=1234" 
for the very same purpose. Or simply add a global config key which has 
as value a list of the targets, in the order they are sorted 
("sortorder=monkey, monkeyvga, atlanis-german"). That would actually be 
cleaner than assigning arbitrary numbers to targets.


>
> TODO:
> * Collect some feedback!

I am opposed to changing the target names. It'd complicate my life a 
lot.

> * Find a position for the Up/Down buttons
> * Add a combobox for all gameids in edit widget
> * Review other backends
>
> The patch is divided in two seperate ones:
>
> 1. scumm-menu-core patch:
> map:
> * added int size() function

That hints at a misue... [looks at the patch]. Indeed, the only place 
you use this is for numGameDomains(), which in turn is used to find a 
new "sort ID". It then still has to scan for a "free" sort ID -- which 
already hints at a problem here: a new entry may indeed not be added in 
the last position.

Another reason why I don't like (ab)using the target names for sorting. 
:-)


> config-manager:
> * check that domains can only consists of [A-Za-z0-9]

That's not right. At the very least, it's [-_A-Za-z0-9] (trivial to 
fix, I'd assume, w/o checking the code).

> * getInt() check for conversion error
> * added swapDomains(dom1, dom2): swap the contents of this two domain 
> (needed
> for up/down)

Another reason why I don't like (ab)using the target names for sorting. 
:-)

> * added int numGameDomains(): return the number of known game Domains
>
> ListWidget:
> * added setSelection(int item): NEEDS REVIEW!
>
You mean "setSelected()" ? Looks OK after a brief glance at it :-).


> 2. scumm-menu-updown patch:
> gamedetector:
> * print out as "Target GameID Description" (e.g. 000001 atlantis Indy4)

Ugh. The sort IDs (which I am against :-) should at the very least be 
hidden as much as possible from the user. They are a nasty 
implementation detail, no reason to force it on the poor user :-)

> launcher:
> * move and rename old domain lineEdit field to "Game Id"
> * add up/down Button
> * add funtions for up/down
> * store the last selection in [scummvm]->lastselectedgame and reselect 
> on
> scummvm reload
That last thing sounds nice, but is really something completely 
independent from the rest of this patch, so you may consider submitting 
it as a separate patch.

>
> Please give some feedback!
Done :-)


Cheers,

Max





More information about the Scummvm-devel mailing list