Ok done. The game selection dialog now displays the 5 most played games at the top (in the header, which is now separated more clearly from the main dialog), sorted by play time. The number of times a game is loaded and how much time it's played are tracked (watching the game intro behind the menu is not considered playing time !), and it's tracked even if you close the window without using the quit command.
All this is saved in a new file "stats" in the savedata directory, the contents is ascii but it's not supposed to be edited by the user. Games stats are stored by the short name of the game, which means that if a game is renamed for its short name the stats are lost (it happens almost never in raine anyway).
Neocd games are not supported, only arcade games (well neocd games are not even loaded from this dialog so it would be quite a problem, and they don't have a real short name), the picture behind the game selection dialog is not updated when selecting one of this favorite games in the header because it's not worth the effort and it would make some duplicate code, and I don't like that. 5 only for now, because the header doesn't handle any scrolling bar and can't scroll its content, it should be enough for a start anyway.
I'll test this a little more, but it seems good now (fixed some bugs related to the header display at the same time).