Been so busy over the last couple months I have never had a chance to make a real start on my GSOC project work, but I’ve managed to find a few moments this weekend to start looking over things and write my first blog post.
Getting Started
So I started by checking out the trunk code from the ScummVM Subversion repository and getting it to compile on my linux pc. Once I had installed the few dependencies, this was a breeze. Once I had it compiled I thought I would try it out, as I had dug out an old copy of Monkey Island 2 I had lying around. Seemed to be very easy to get the game installed and ready to play. In terms of the game, everything seemed to work flawlessly – very impressive!
Source Code Investigation
After tearing myself away from Monkey Island I thought I would start looking through the ScummVM source code to familiarise with its structure, so that I could start planning how my code will integrate with the whole system. I knew this would be one of the most challenging parts of the initial phase of my summer of code, but Joost gave me some great advice on where I should start looking.
OSystem Interface
The first thing I looking into was the OSystem interface. This interface encapsulates all the backends of ScummVM. I learnt that each sub class of this interface providing the implementation of sound, graphics and user input that allows all the different game engines to work on a specific platform.
PSP Port
To get a better idea of the sort of code that went into a specific implementation I looked into the code for the PSP port – specifically the OSystem_PSP class. Inside this class amongst other things there was code to update the screen and code to translate PSP buttons presses into ScummVM events. The PSP port also had a OSystem_PSP_GU class that was derived from the OSystem_PSP class. This derived class seemed to be where the virtual keyboard for the PSP was implemented. Understanding this code seemed to be the perfect first step for me. The virtual keyboard implementation had two main parts: graphical display and event management. The graphical display implementation could be summarised as:
- 4 keyboard images (letters, symbols and shift versions of these two) were loaded from compressed hard-coded data
- if the keyboard was to be displayed (SELECT button toggles it) then one of these images would be written to the screen depending on the current keyboard mode
As for event management:
- simple button presses to change the keyboards mode / turn it on and off
- code to translate x,y position of mouse into a selected key
- code to inject the appropriate key pressed event for the selected key when the X button was pressed.
Summary
This initial investigation of the source code was very inciteful and got me thinking about many aspects of my project. There were of course a lot of questions that immediately came to mind, such as:
- Why does the PSP port have two OSystem classes? Is the OSystem_PSP_GU class (and therefore the virtual keyboard) sometimes not used?
- Why are the keyboard images loaded from hard-coded compressed data?
- Inquire about how development of PSP port was carried out – I guess a PSP emulator for the pc was used to ease development? Would be nice to see the PSP port in action so that I can see the effects of the code.
As well as resolving these questions my plan of action for the next few days will involve more research, specifically:
- find out how the event system really works – e.g. when and where is pollEvent() called from?
- leading on from this, how does the whole ScummVM system fit together? – e.g. how do back-ends and engines all fit together?
- what are the exact requirements for the virtual keyboard system – e.g will it be available from all ports? where will this fit in to existing system? etc…
Phew… didn’t think my first post would be that long! Just shows how much there is to get on with. Can’t wait until my exams are finally over, so that I can really get to work on the project.