[Scummvm-devel] Possible new backend features

Neil Millstone neil at millstone.demon.co.uk
Sat Apr 1 09:36:04 CEST 2006

Max Horn wrote:

> Hi folks,
> I am curious, is there any progress on getting the Nintendo DS port  
> "official" ? What is hindering that?
> I know that we talked about various OSystem features that are needed,  
> and I am willing to help with that, but I can't just add them in w/o  
> working directly with the people who actually *need* those features.  
> The only thing I can do at this time is to make suggestions as to how  
> to implement certain things; or I can implement things on request.
> E.g. OSystem::setFocus(Rect) -- I can add a stub for that to OSystem  
> right now, but it would be a bit poinltess w/o adding code to the  
> various engines that uses it. I believe the DS port already has such  
> "hooks", so instead of me blindly searching spots where I could  
> insert possibly appropriate (or not) calls, it would be much easier  
> if I got a patch on the patch tracker providing that (obviously a  
> patch made so that the DS port would benefit from it)...
> Are there other problems? Please tell me and I'll try to help.
> Cheers,
> Max

Hi Max,

Unfortunately, my talking actor hook isn't really production-ready.  
Currently this only works for the Scumm engine and involves the 
following change to engines/scumm/actor.cpp:

void ScummEngine::setTalkingActor(int value) {
#ifdef __DS__
    if ((value != 255)) {
        MT_setTalkPos(_actors[value]._pos.x - (camera._cur.x - 
(_screenWidth >> 1)), _actors[value]._top - (camera._cur.y - 
(_screenHeight >> 1)));

    if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform 
== Common::kPlatformNES))
        _V1TalkingActor = value;
        VAR(VAR_TALK_ACTOR) = value;

This works reasonably well, but it would be really nice if the rectangle 
passed could include the text that the character is speaking, and I 
haven't worked out how to do that. Someone with more knowledge of the 
engine could definately do a better job!  A setFocus(Rect) in OSystem 
like you suggest would be a good way of passing it to the backend.

I haven't had as much time to work on my DS port as I had originally 
hoped, but I have made a fair bit of progress.  I have added an extra 
config dialog which which I can show using the 'Select' key on the DS, 
which means I could remove the hacks to the options menus which I had 
previously put in, this works ok, but perhaps isn't the most logical 
place for it to be from the user's point of view.

I've also used ConfMan.get("gameid") to find out the id of the running 
game, removing my other hack to the main source tree.  I look the string 
up in a table to set my controls to one of four modes that I have 
internally.  I'm  not sure if this could be done a more generic way that 
would be useful to other ports, but at least it doesn't require a hack 
in the ScummVM source.  The control changes involve how the port handles 
the touch screen, so it's not really applicable to other ports (except 
perhaps Symbian or other ports that have touch screens, but I imaging 
they want to have their own way of solving these issues).

Another feature that I have realised I need quite a lot is something to 
allow deleting of savegames.  A hasFeature() call could detect whether 
the backend supports this, and then a delete() call could be added to 
Common::SaveFileManager to perform the delete.   I could have a go at 
adding this if you want, it looks like a simple change.

Another small thing is the case-sensitive file searching implemented in 
Common::fopenNoCase().  It tries to open every file with a variety of 
different modifications to how it is capitalised.  Since the DS FAT 
driver port doesn't cache the directory from the disk, and has to read 
it back each time, there is a significant cost to each of these 
unnecessary failed fopen() calls.  Could these be #defined out?  It 
would make sense as many ports run on case-insensitive filesystems 
anyway, which makes this unneccesary (eg.  Win32, Symbian, PalmOS, 
anything FAT16/32)

I think that's all the issues I have for now!

Thanks for your help,

- Neil

More information about the Scummvm-devel mailing list