Difference between revisions of "User:Seldon/GSoC2007-ProjectDiary"

From ScummVM :: Wiki
Jump to navigation Jump to search
 
(34 intermediate revisions by 2 users not shown)
Line 14: Line 14:
* study the new idea of events to replace engine specific keymapping code in the backends ( [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) by Max)
* study the new idea of events to replace engine specific keymapping code in the backends ( [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) by Max)


== 2007-07-03 (Tuesday) - current backend arhitecture ==
== 2007-07-03 (Tuesday) - current backend architecture ==


Yesterday and today I went through all backend implementations (classes that extend OSystem). I gathered the information about all methods in OSystem class hierarchy and presented it the form of tables. There one can easily see all of the OSystem virtual functions, their overriding counterparts in backend implementations, as well backend specific functions. Based on this information it is easy to see what are the common methods for all backends, which of them are simply duplicated, etc.
Yesterday and today I went through all backend implementations (classes that extend OSystem). I gathered the information about all methods in OSystem class hierarchy and presented it the form of tables. There one can easily see all of the OSystem virtual functions, their overriding counterparts in backend implementations, as well backend specific functions. Based on this information it is easy to see what are the common methods for all backends, which of them are simply duplicated, etc.


Legend:
* [[User:Seldon/DreamCast Backend|DreamCast]]
{|  x:str border=0 cellpadding=0 cellspacing=0
* [[User:Seldon/DS Backend|DS]]
|-  height=18 style='height:13.5pt'
* [[User:Seldon/GP2X Backend|GP2X]]
|  height=18 style='color:green;height:13.5pt' | public method
* [[User:Seldon/GP32 Backend|GP32]]
|-  height=18 style='height:13.5pt'
* [[User:Seldon/MorphOS Backend|MorphOS]]
|  height=18 style='color:blue;height:13.5pt' | protected method
* [[User:Seldon/Palm Backend|Palm]]
|-  height=18 style='height:13.5pt'
* [[User:Seldon/PS2 Backend|PS2]]
|  height=18 style='color:maroon;height:13.5pt' | private method
* [[User:Seldon/PSP Backend|PSP]]
* [[User:Seldon/SDL Backend|SDL]]
* [[User:Seldon/X11 Backend|X11]]
 
== 2007-07-06 (Friday) - functionality ==
 
Yesterday and the day before yesterday I have finished reviewing the backends code and uploaded last of the tables in the previous post. Today I've been looking through backends from the perspective of functional features that relate to my project.
 
 
{|  x:str border=0 cellpadding=0 cellspacing=0 width=738  height=17 style='height:12.75pt' align='center' cellpadding=3 border=1
|  height=17 width=143 style='font-weight:bold;height:12.75pt;width:107pt' | Feature
|  width=374 style='font-weight:bold;width:281pt' | Backend
|  width=221 style='font-weight:bold;width:166pt' | Osystem child
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | virtual keyboard
|  | DC(softkbd.h), DS(touchkeyboard.h), wince(PanelKeyboard.h)
|  |
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | keymapper
|  |
|  | gp2x, sdl, wince, symbian, ds, palm
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | downscaler
|  | MorphOS(morphos_scaler.h), wince(CEScaler.h)
|  | DC, gp2x, palm(calc_scale), sdl
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | upscaler
|  | MorphOS(morphos_scaler.h), wince(CEScaler.h)
|  | DC, gp2x, palm(calc_scale), sdl
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | predictive input
|  | DS(wordcompletion.h)
|  | DS(addAutoComplete)
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | zoning
|  |
|  | wince, symbian
|-  height=17 style='height:12.75pt'
|  height=17 style='height:12.75pt' | splash screen
|  | gp32(gfx_splash.h)
|  |
|}
|}


== 2007-07-08 (Sunday) - key mapping ==
Now, that I've been looking through the backends implementation for a couple of days, I got a pretty good understanding of how they work. I am ready to start implementing my tasks on backends' refactoring. So, as agreed with sev, the first feature to be implemented is key mapping. Yesterday and today I was closely reviewing the current implementation of key mapping.
So, key mapping is used to convert key codes to other key codes which in turn are mapped to certain game actions. Key mapping takes place in the pollEvent functions of the backend OSystem classes. The actual device specific mapping is done through the Actions classes like CEActionsSmartphone. Currently only wince supports user key mapping dialogs.
In general key mapping is implemeted in wince, symbian, ds, and palm backends. Wince and symbian provide the best implementations.
== 2007-07-09 (Monday) - new key mapping architecture ==
Today I had a long conversation with sev on the phone. We have decided that the best idea would be to extend and implement the Max's proposal on [[Keymapping Improvements]]. Here is the plan:
* according to Max, we introduce new type of events called UserActions;
* UserActions represent engine specific actions like quit, pause, etc., and game specific actions like move left, right, jump, etc.
* each backend has its own event manager which is aware of all device buttons;
* each engine provides the event manager with all the actions it and the currently selected game needs;
* event managers are responsible for mapping the key codes to specific actions (there are default and custom/user mappings);
* the event manager's pollEvent function will now return the UserAction (it will also fill the event structure for the time being for backwards compatibility)
* UserAction class will still have the keyCode field because some engines do check key codes to do smth and some engines also require user text input;
== 2007-07-11 (Wednesday) - first patch ==
Today I have created my first backend lib patch! This patch is dealing with the new key mapping architecture. I have added
the buttons.h which similar to keyboard.h but also includes codes for mouse buttons. EventManager class has been modified, and the GenericEventManager was added to provide a base class for specific backend event managers' implementations.
== 2007-07-12 (Thursday) - -devel discussion ==
Today I have posted a new reply to [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) with a detailed description of proposed key mapping implementation.
== 2007-07-13 (Friday) - improved key mapping architecture ==
Taking into consideration Max's comments to my -devel post, I made some changes to the key mapping design. The main improvement is that we get rid of enum with all action types, replacing it with a key to key mapping. This way we don't have to change the engines' code at all, and plus we provide a nice place to integrate a virtual keyboard (see my replies to [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) -devel discussion).
== 2007-07-14 (Saturday) - coding :) ==
I've been coding all day today. As a result we have OSystem_Common, a base class for all backends' OSystem classes, which provides hooks for key mapper and virtual keyboard. I have also created a KeyMapper class which already knows how to provide a default key mapping functionality. What still needs to be done is the custom mapping (key dialogs, basically). I've also added a virtual keyboard stub, modified the DefaultEventManager and the sky engine to make use of key mapping. You can check out the patch at http://sourceforge.net/tracker/index.php?func=detail&aid=1752243&group_id=37116&atid=418822, patch v3).
== 2007-07-15 (Sunday) - refactoring ==
Max revied my code and I did some refactoring afterwards:
- removed OSystem_Common in favour for a modularised approach
- removed getAvailableKeys() in KeyMapper class
- hooked up key mapper and virtual keyboard in default event manager
== 2007-07-16 (Monday) - refactoring ==
Replaced the STL in key mapping patch with Common::List and Common::HashMap, added doxygen comments.
== 2007-07-21 (Saturday) - compilation error fix ==
I have finally fixed the compilation error in engines/sky/debug.cpp. Unfortunately I did not have the internet connection to see that it was fixed already by wjpalenstijn.
== 2007-07-24 (Tuesday) - basic key mapper dialog added ==
I have used the gui/KeysDialog.h and modified it to work with the KeyMapper implementation.
== 2007-07-28 (Saturday) - key mapper refactoring ==
I have refactored KeyMapper to better fit key mapper dialog implementation.
The new methods are:
* virtual void addActionMapping(const Common::KeyState, const Common::UserAction);
* virtual void addActionMappings(const Common::ActionList);
* virtual void clearActionMappings();
* virtual const Common::KeyState *getMappingKey(const Common::UserAction);
I have also fixed the key mapper dialog to make use of these new methods and uploaded the patch v4.1 to https://sourceforge.net/tracker/download.php?group_id=37116&atid=418822&file_id=238998&aid=1752243


== 2007-07-30 (Monday) - patch fix, key mapper dialog features, GUI ==
Today I have fixed my v4.1 patch: added required includes for the kyra engine, fixed the common/event-manager.h include and the non-virtual destructor warnings. Started implementing the mappings save and load functionality in KeyMapper class. Talked to sev regarding the key mapper dialog features. I'll post them here once he reviews my comments. I have also figured out how to modify GUI windows and their elements in themes *.ini files.


{|  x:str border=0 cellpadding=0 cellspacing=0 width=888 style='border-collapse:collapse;table-layout:fixed;width:666pt'  height=18 style='height:13.5pt'
== 2007-07-31 (Tuesday) - key mapper dialog features, edit game dialog, mappings saving/loading ==
|  height=18 width=444 style='height:13.5pt;width:333pt' | OSystem
First of all, here are is the list of features which the key mapper dialog should support:
|  width=444 style='border-left:none;width:333pt' | OSystem_Dreamcast : public OSystem
1) ability to see all current key/action mappings;
|- height=18 style='height:13.5pt'
2) possibility to completely unassign key from some particular action;
|  height=18 style='color:green;height:13.5pt' | virtual Audio::Mixer *getMixer
3) checks for the same key being assigned to different actions;
|  style='color:green;border-left:none' | Audio::Mixer *getMixer
4) there should be a way to define the engine and game actions (like in game data files, etc.);
|-  height=18 style='height:13.5pt'
5) action mapping priorities (if there is no mapping for these actions the game won't start or smth like this. The situation when actions with lower priority have mappings while the actions with higher priority don't won't be allowed.)
|  height=18 style='color:green;height:13.5pt' | virtual bool getFeatureState
6) more then one keymap (as for Indy games);
|  style='color:green;border-left:none' | bool getFeatureState
7) mappings should be displayed in two modes: action -> key(s) and key -> action (this is rather an improvement)
|-  height=18 style='height:13.5pt'
 
|  height=18 style='color:green;height:13.5pt' | virtual bool hasFeature
Today I have implemented the saving and loading of action mappings to and from the scummvm config file. I have also added the new key mapper tab to the edit game dialog with the buttons and action list. I have also thought over most of the implementation details for the above mentioned features.
|  style='color:green;border-left:none' | bool hasFeature
 
|-  height=18 style='height:13.5pt'
== 2007-08-01 (Wednesday) - working on key mapper features listed above ==
|  height=18 style='color:green;height:13.5pt' | virtual bool openCD
Today I have cleared the 2nd and 3rd point from the requirements list, in course of that work no. 7 was also partially clearedI have been actively working on No. 1 today. Item 5 is not big and will be implemented in the course of work on no. 1. With regards to no. 4, I have fixed key mappings save/load functionality to save the mappings under the specific game domains.
|  style='color:green;border-left:none' | bool openCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool pollCD
|  style='color:green;border-left:none' | bool pollCD
|- height=18 style='height:13.5pt'
|  height=18 style='color:blue;height:13.5pt' | virtual bool pollEvent
|  style='color:green;border-left:none' | bool pollEvent
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool setGraphicsMode
|  style='color:green;border-left:none' | bool setGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool showMouse
|  style='color:green;border-left:none' | bool showMouse
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Common::EventManager *getEventManager
|  style='color:green;border-left:none' |  
|- height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Common::SaveFileManager *getSavefileManager
|  style='color:green;border-left:none' | Common::SaveFileManager *getSavefileManager
|- height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Common::TimerManager *getTimerManager
|  style='color:green;border-left:none' | Common::TimerManager *getTimerManager
|-  height=18 style='height:13.5pt'
| height=18 style='color:green;height:13.5pt' | virtual const GraphicsMode *getSupportedGraphicsModes
|  style='color:green;border-left:none' | const GraphicsMode *getSupportedGraphicsModes
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Graphics::Surface *lockScreen
|  style='color:green;border-left:none' | virtual Graphics::Surface *lockScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getDefaultGraphicsMode
|  style='color:green;border-left:none' | int getDefaultGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getGraphicsMode
|  style='color:green;border-left:none' | int getGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getOutputSampleRate
|  style='color:green;border-left:none' | int getOutputSampleRate
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getScreenChangeID
|  style='color:green;border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int overlayToScreenX
|  style='color:green;border-left:none' | int overlayToScreenX
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int overlayToScreenY
|  style='color:green;border-left:none' | int overlayToScreenY
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int screenToOverlayX
|  style='color:green;border-left:none' | int screenToOverlayX
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int screenToOverlayY
|  style='color:green;border-left:none' | int screenToOverlayY
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getHeight
|  style='color:green;border-left:none' | int16 getHeight
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getOverlayHeight
|  style='color:green;border-left:none' | int16 getOverlayHeight
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getOverlayWidth
|  style='color:green;border-left:none' | int16 getOverlayWidth
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getWidth
|  style='color:green;border-left:none' | int16 getWidth
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual MutexRef createMutex
|  style='color:green;border-left:none' | MutexRef createMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual OverlayColor ARGBToColor
|  style='color:green;border-left:none' | OverlayColor ARGBToColor
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual OverlayColor RGBToColor
|  style='color:green;border-left:none' | OverlayColor RGBToColor
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual uint32 getMillis
|  style='color:green;border-left:none' | uint32 getMillis
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void beginGFXTransaction
|  style='border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void clearFocusRectangle
|  style='border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void clearOverlay
|  style='color:green;border-left:none' | void clearOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void clearScreen
|  style='color:green;border-left:none' | void clearScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void colorToARGB
|  style='color:green;border-left:none' | void colorToARGB
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void colorToRGB
|  style='color:green;border-left:none' | void colorToRGB
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void copyRectToOverlay
|  style='color:green;border-left:none' | void copyRectToOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void copyRectToScreen
|  style='color:green;border-left:none' | void copyRectToScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void delayMillis
|  style='color:green;border-left:none' | void delayMillis
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void deleteMutex
|  style='color:green;border-left:none' | void deleteMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void disableCursorPalette
|  style='color:green;border-left:none' | void disableCursorPalette
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void displayMessageOnOSD
|  style='color:green;border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void endGFXTransaction
|  style='color:green;border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void grabOverlay
|  style='color:green;border-left:none' | void grabOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void grabPalette
|  style='color:green;border-left:none' | void grabPalette
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void hideOverlay
|  style='color:green;border-left:none' | void hideOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void initBackend
|  style='color:green;border-left:none' | virtual void initBackend
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void initSize
|  style='color:green;border-left:none' | void initSize
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void lockMutex
|  style='color:green;border-left:none' | void lockMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void playCD
|  style='color:green;border-left:none' | void playCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void quit
|  style='color:green;border-left:none' | void quit
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setCursorPalette
|  style='color:green;border-left:none' | void setCursorPalette
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setFeatureState
|  style='color:green;border-left:none' | void setFeatureState
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setFocusRectangle
|  style='color:green;border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setMouseCursor
|  style='color:green;border-left:none' | void setMouseCursor
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setPalette
|  style='color:green;border-left:none' | void setPalette
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setShakePos
|  style='color:green;border-left:none' | void setShakePos
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setWindowCaption
|  style='color:green;border-left:none' | void setWindowCaption
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void showOverlay
|  style='color:green;border-left:none' | void showOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void stopCD
|  style='color:green;border-left:none' | void stopCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void unlockMutex
|  style='color:green;border-left:none' | void unlockMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void unlockScreen
|  style='color:green;border-left:none' | virtual void unlockScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void updateCD
|  style='color:green;border-left:none' | void updateCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void updateScreen
|  style='color:green;border-left:none' | void updateScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void warpMouse
|  style='color:green;border-left:none' | void warpMouse
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green;border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green;border-left:none' | void mouseToSoftKbd
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green;border-left:none' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:maroon;border-left:none' | void checkSound
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:maroon;border-left:none' | void drawMouse
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:maroon;border-left:none' | void setScaling
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:maroon;border-left:none' | Common::SaveFileManager *createSavefileManager
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green;border-left:none' |  
|}


== 2007-08-02 (Thursday) - discussion with SEV on points no. 4 and 6 from the key mapper features list, reinstalling the software ==
Today I have talked to SEV about the place where to define the engine and game actions. They will be defined in the game data files and retrieved using common/advancedDetector.cpp static void updateGameDescriptor(). The key maps storing algorithm is as follows:
* in order to save a mapping we need to store a key and an action;
* to store a key it's enough to store its keycode and the flags;
* so it's a 6 digit hexadecimal number;
* an action could also be identified by it's default key;
* so it's another 6 digit hexadecimal number;
* this approach is compact and we can save all mapping in one string, and then easily parse it, since we have the fixed length for all elements (I got the idea for it from gui/Action.h save/loadMapping functions);
* this string is then saved under [scummvm] for global mappings;
* and under say [sky] for game mappings;
* actions with identical default keys are dissalowed within single game.


{|  x:str border=0 cellpadding=0 cellspacing=0 width=888
Here are the SEV's comments regarding the key map sets (for Indiana Jones fighting, i.e.):
|  height=18 width=444 style='height:13.5pt;width:333pt' | OSystem
I recommend to show those sets on tabs in keymapper dialog: it's simple to implement and will not clobber your output. In 90% of cases there will be a single set but rest 10% belong to quite important set of games:
|  width=444 style='width:333pt' | OSystem_DS : public OSystem
* indiana jones -> fighting
|-  height=18 style='height:13.5pt'
* gobliiins -> password entry
|  height=18 style='color:green;height:13.5pt' | virtual Audio::Mixer *getMixer
There also should be way to disable all mappings temporarily, say, when user uses predictive dialog.
|  style='color:green' | virtual Audio::Mixer* getMixer
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool getFeatureState
|  style='color:green' | virtual bool getFeatureState
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool hasFeature
|  style='color:green' | virtual bool hasFeature
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool openCD
|  style='color:green' | virtual bool openCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool pollCD
|  style='color:green' | virtual bool pollCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:blue;height:13.5pt' | virtual bool pollEvent
|  style='color:green' | virtual bool pollEvent
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool setGraphicsMode
|  style='color:green' | virtual bool setGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' | bool setGraphicsMode
|  class=xl2927581 | bool setGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual bool showMouse
|  style='color:green' | virtual bool showMouse
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Common::EventManager *getEventManager
|  style='color:green' |  
|- height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Common::SaveFileManager *getSavefileManager
|  style='color:green' | virtual Common::SaveFileManager *getSavefileManager
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Common::TimerManager *getTimerManager
|  style='color:green' | virtual Common::TimerManager* getTimerManager
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual const GraphicsMode *getSupportedGraphicsModes
|  style='color:green' | virtual const GraphicsMode *getSupportedGraphicsModes
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual Graphics::Surface *lockScreen
|  style='color:green' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getDefaultGraphicsMode
|  style='color:green' | virtual int getDefaultGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getGraphicsMode
|  style='color:green' | virtual int getGraphicsMode
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getOutputSampleRate
|  style='color:green' | virtual int getOutputSampleRate
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int getScreenChangeID
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int overlayToScreenX
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int overlayToScreenY
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int screenToOverlayX
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int screenToOverlayY
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getHeight
|  style='color:green' | virtual int16 getHeight
|- height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getOverlayHeight
|  style='color:green' | virtual int16 getOverlayHeight
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getOverlayWidth
|  style='color:green' | virtual int16 getOverlayWidth
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual int16 getWidth
|  style='color:green' | virtual int16 getWidth
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual MutexRef createMutex
|  style='color:green' | virtual MutexRef createMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual OverlayColor ARGBToColor
|  style='color:green' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual OverlayColor RGBToColor
|  style='color:green' | inline virtual OverlayColor RGBToColor
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual uint32 getMillis
|  style='color:green' | virtual uint32 getMillis
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void beginGFXTransaction
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void clearFocusRectangle
|  style='color:green' | virtual void clearFocusRectangle
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void clearOverlay
|  style='color:green' | virtual void clearOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void clearScreen
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void colorToARGB
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void colorToRGB
|  style='color:green' | inline virtual void colorToRGB
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void copyRectToOverlay
|  style='color:green' | virtual void copyRectToOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void copyRectToScreen
|  style='color:green' | virtual void copyRectToScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void delayMillis
|  style='color:green' | virtual void delayMillis
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void deleteMutex
|  style='color:green' | virtual void deleteMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void disableCursorPalette
|  style='color:green' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void displayMessageOnOSD
|  style='color:green' | virtual void displayMessageOnOSD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void endGFXTransaction
|  style='color:green' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void grabOverlay
|  style='color:green' | virtual void grabOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void grabPalette
|  style='color:green' | virtual void grabPalette
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void hideOverlay
|  style='color:green' | virtual void hideOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void initBackend
|  style='color:green' | virtual void initBackend
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void initSize
|  style='color:green' | virtual void initSize
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void lockMutex
|  style='color:green' | virtual void lockMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void playCD
|  style='color:green' | virtual void playCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void quit
|  style='color:green' | virtual void quit
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setCursorPalette
|  class=xl2527581 |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setFeatureState
|  style='color:green' | virtual void setFeatureState
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setFocusRectangle
|  style='color:green' | virtual void setFocusRectangle
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setMouseCursor
|  style='color:green' | virtual void setMouseCursor
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setPalette
|  style='color:green' | virtual void setPalette
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setShakePos
|  style='color:green' | virtual void setShakePos
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void setWindowCaption
|  style='color:green' | virtual void setWindowCaption
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void showOverlay
|  style='color:green' | virtual void showOverlay
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void stopCD
|  style='color:green' | virtual void stopCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void unlockMutex
|  style='color:green' | virtual void unlockMutex
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void unlockScreen
|  style='color:green' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void updateCD
|  style='color:green' | virtual void updateCD
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void updateScreen
|  style='color:green' | virtual void updateScreen
|-  height=18 style='height:13.5pt'
|  height=18 style='color:green;height:13.5pt' | virtual void warpMouse
|  style='color:green' | virtual void warpMouse
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' |  
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | void addEvent
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | virtual void addAutoComplete
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | virtual void clearAutoComplete
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  class=xl2927581 | virtual void clearSoundCallback
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | virtual void setCharactersEntered
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | bool isEventQueueEmpty
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | static int timerHandler
|-  height=18 style='height:13.5pt'
|  height=18 style='height:13.5pt' |  
|  style='color:green' | virtual bool grabRawScreen
|}

Latest revision as of 09:04, 3 August 2007

2007-06-09 (Saturday) - analyzing current backend code

Today I am starting my Small Devices Backend project diary. Here I'll be posting all of the current progress information.

I have already ran a pocketSCUMM port on ACER n311 pocket PC. Now I am analyzing the current backend code.

2007-07-01 (Sunday) - back

I am finally back to the project after a prolonged exams period at the two Universities I am currently studying, and planning to catch with all the work on backends.

I have talked to _sev: we've successfully resolved some linker errors over the TightVNC - all that had to be done is to change the order of library paths. Funny. So, the most important tasks for right now are:

  • come up with the description of current backends implementation;
  • study the new idea of events to replace engine specific keymapping code in the backends ( [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) by Max)

2007-07-03 (Tuesday) - current backend architecture

Yesterday and today I went through all backend implementations (classes that extend OSystem). I gathered the information about all methods in OSystem class hierarchy and presented it the form of tables. There one can easily see all of the OSystem virtual functions, their overriding counterparts in backend implementations, as well backend specific functions. Based on this information it is easy to see what are the common methods for all backends, which of them are simply duplicated, etc.

2007-07-06 (Friday) - functionality

Yesterday and the day before yesterday I have finished reviewing the backends code and uploaded last of the tables in the previous post. Today I've been looking through backends from the perspective of functional features that relate to my project.


Feature Backend Osystem child
virtual keyboard DC(softkbd.h), DS(touchkeyboard.h), wince(PanelKeyboard.h)
keymapper gp2x, sdl, wince, symbian, ds, palm
downscaler MorphOS(morphos_scaler.h), wince(CEScaler.h) DC, gp2x, palm(calc_scale), sdl
upscaler MorphOS(morphos_scaler.h), wince(CEScaler.h) DC, gp2x, palm(calc_scale), sdl
predictive input DS(wordcompletion.h) DS(addAutoComplete)
zoning wince, symbian
splash screen gp32(gfx_splash.h)

2007-07-08 (Sunday) - key mapping

Now, that I've been looking through the backends implementation for a couple of days, I got a pretty good understanding of how they work. I am ready to start implementing my tasks on backends' refactoring. So, as agreed with sev, the first feature to be implemented is key mapping. Yesterday and today I was closely reviewing the current implementation of key mapping. So, key mapping is used to convert key codes to other key codes which in turn are mapped to certain game actions. Key mapping takes place in the pollEvent functions of the backend OSystem classes. The actual device specific mapping is done through the Actions classes like CEActionsSmartphone. Currently only wince supports user key mapping dialogs. In general key mapping is implemeted in wince, symbian, ds, and palm backends. Wince and symbian provide the best implementations.

2007-07-09 (Monday) - new key mapping architecture

Today I had a long conversation with sev on the phone. We have decided that the best idea would be to extend and implement the Max's proposal on Keymapping Improvements. Here is the plan:

  • according to Max, we introduce new type of events called UserActions;
  • UserActions represent engine specific actions like quit, pause, etc., and game specific actions like move left, right, jump, etc.
  • each backend has its own event manager which is aware of all device buttons;
  • each engine provides the event manager with all the actions it and the currently selected game needs;
  • event managers are responsible for mapping the key codes to specific actions (there are default and custom/user mappings);
  • the event manager's pollEvent function will now return the UserAction (it will also fill the event structure for the time being for backwards compatibility)
  • UserAction class will still have the keyCode field because some engines do check key codes to do smth and some engines also require user text input;

2007-07-11 (Wednesday) - first patch

Today I have created my first backend lib patch! This patch is dealing with the new key mapping architecture. I have added the buttons.h which similar to keyboard.h but also includes codes for mouse buttons. EventManager class has been modified, and the GenericEventManager was added to provide a base class for specific backend event managers' implementations.

2007-07-12 (Thursday) - -devel discussion

Today I have posted a new reply to [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) with a detailed description of proposed key mapping implementation.

2007-07-13 (Friday) - improved key mapping architecture

Taking into consideration Max's comments to my -devel post, I made some changes to the key mapping design. The main improvement is that we get rid of enum with all action types, replacing it with a key to key mapping. This way we don't have to change the engines' code at all, and plus we provide a nice place to integrate a virtual keyboard (see my replies to [Scummvm-devel] RFC: Flexible keymapping via new EVENT_ (post 0.10) -devel discussion).

2007-07-14 (Saturday) - coding :)

I've been coding all day today. As a result we have OSystem_Common, a base class for all backends' OSystem classes, which provides hooks for key mapper and virtual keyboard. I have also created a KeyMapper class which already knows how to provide a default key mapping functionality. What still needs to be done is the custom mapping (key dialogs, basically). I've also added a virtual keyboard stub, modified the DefaultEventManager and the sky engine to make use of key mapping. You can check out the patch at http://sourceforge.net/tracker/index.php?func=detail&aid=1752243&group_id=37116&atid=418822, patch v3).

2007-07-15 (Sunday) - refactoring

Max revied my code and I did some refactoring afterwards: - removed OSystem_Common in favour for a modularised approach - removed getAvailableKeys() in KeyMapper class - hooked up key mapper and virtual keyboard in default event manager

2007-07-16 (Monday) - refactoring

Replaced the STL in key mapping patch with Common::List and Common::HashMap, added doxygen comments.

2007-07-21 (Saturday) - compilation error fix

I have finally fixed the compilation error in engines/sky/debug.cpp. Unfortunately I did not have the internet connection to see that it was fixed already by wjpalenstijn.

2007-07-24 (Tuesday) - basic key mapper dialog added

I have used the gui/KeysDialog.h and modified it to work with the KeyMapper implementation.

2007-07-28 (Saturday) - key mapper refactoring

I have refactored KeyMapper to better fit key mapper dialog implementation. The new methods are:

  • virtual void addActionMapping(const Common::KeyState, const Common::UserAction);
  • virtual void addActionMappings(const Common::ActionList);
  • virtual void clearActionMappings();
  • virtual const Common::KeyState *getMappingKey(const Common::UserAction);

I have also fixed the key mapper dialog to make use of these new methods and uploaded the patch v4.1 to https://sourceforge.net/tracker/download.php?group_id=37116&atid=418822&file_id=238998&aid=1752243

2007-07-30 (Monday) - patch fix, key mapper dialog features, GUI

Today I have fixed my v4.1 patch: added required includes for the kyra engine, fixed the common/event-manager.h include and the non-virtual destructor warnings. Started implementing the mappings save and load functionality in KeyMapper class. Talked to sev regarding the key mapper dialog features. I'll post them here once he reviews my comments. I have also figured out how to modify GUI windows and their elements in themes *.ini files.

2007-07-31 (Tuesday) - key mapper dialog features, edit game dialog, mappings saving/loading

First of all, here are is the list of features which the key mapper dialog should support: 1) ability to see all current key/action mappings; 2) possibility to completely unassign key from some particular action; 3) checks for the same key being assigned to different actions; 4) there should be a way to define the engine and game actions (like in game data files, etc.); 5) action mapping priorities (if there is no mapping for these actions the game won't start or smth like this. The situation when actions with lower priority have mappings while the actions with higher priority don't won't be allowed.) 6) more then one keymap (as for Indy games); 7) mappings should be displayed in two modes: action -> key(s) and key -> action (this is rather an improvement)

Today I have implemented the saving and loading of action mappings to and from the scummvm config file. I have also added the new key mapper tab to the edit game dialog with the buttons and action list. I have also thought over most of the implementation details for the above mentioned features.

2007-08-01 (Wednesday) - working on key mapper features listed above

Today I have cleared the 2nd and 3rd point from the requirements list, in course of that work no. 7 was also partially cleared. I have been actively working on No. 1 today. Item 5 is not big and will be implemented in the course of work on no. 1. With regards to no. 4, I have fixed key mappings save/load functionality to save the mappings under the specific game domains.

2007-08-02 (Thursday) - discussion with SEV on points no. 4 and 6 from the key mapper features list, reinstalling the software

Today I have talked to SEV about the place where to define the engine and game actions. They will be defined in the game data files and retrieved using common/advancedDetector.cpp static void updateGameDescriptor(). The key maps storing algorithm is as follows:

  • in order to save a mapping we need to store a key and an action;
  • to store a key it's enough to store its keycode and the flags;
  • so it's a 6 digit hexadecimal number;
  • an action could also be identified by it's default key;
  • so it's another 6 digit hexadecimal number;
  • this approach is compact and we can save all mapping in one string, and then easily parse it, since we have the fixed length for all elements (I got the idea for it from gui/Action.h save/loadMapping functions);
  • this string is then saved under [scummvm] for global mappings;
  • and under say [sky] for game mappings;
  • actions with identical default keys are dissalowed within single game.

Here are the SEV's comments regarding the key map sets (for Indiana Jones fighting, i.e.): I recommend to show those sets on tabs in keymapper dialog: it's simple to implement and will not clobber your output. In 90% of cases there will be a single set but rest 10% belong to quite important set of games:

  • indiana jones -> fighting
  • gobliiins -> password entry

There also should be way to disable all mappings temporarily, say, when user uses predictive dialog.