Some ports modularized, some left

I have done some progress modularizing the SDL based ports. Posix and Mac OS X ports have been refactored and are working well, and I have also committed modularized versions of Symbian and Samsung TV ports. However, these last 2 ports still need some testing (I have send a message to mail list asking for help).

Now, I am working with the WinCE port, a task I have started some time ago. I plan having finished the WinCE port by today (or in worst case tomorrow), as well as the Linuxmoto port. And for monday, I should have modularized the Gp2xwiz port, the last one in my list (By now, I will work on porting other ports after finishing with OpenGL).

On monday or tuesday, I plan working on documentation after finishing with all SDL based ports, and also doing some general cleanup of code. This will leave me with 2 days of delay for starting my next task, creating an OpenGL Graphics Manager. However, 2 days are not a great deal.

Now, ports

I have to apologize, as I have not been really productive last week. I hope to be more active this week and make a  good progress on the project.

Last week I have made some fixes and tweaks to the ModularBackend code, and I have fixed all the problems with some code in the new SDL Managers that was having problems after modularization, principally because it was needed to access some protected variables or methods that were now in other manager class.

I have also created a new port for Windows, in backends/platfrom/win32. It is a subclass from the SDL backend, but it contains some code specific to Windows. I will be doing next the same for Posix and Mac OSX systems.

I have also been working on applying the new ModularBackend design to other ports, like WinCE and Symbian. However, I can’t compile those ports and test them and working “blind” is not really nice. I am still double checking the modifications and working on the new WinCE and Symbian Managers, so these commits will need to wait a bit.

This week, I plan first to complete the Posix and Mac OSX ports, which will be similar to the Win32 one. Then, I will continue with the WinCE and Symbian ports as well as all other SDL based ports.

I would like to work on modularizing non-SDL ports, but for next week I should be starting with the OpenGL Graphics Manager. So, non-SDL ports will need to wait until all other milestones are finished, and if I have left time I will be working on them.

Refactoring of SDL Backend

I think I have finished the first milestone, the design of the new backend system. This is reflected in the ModularBackend class, the new abstract classes (AudioCDManager, MutexManager, GraphicsManager), and the default and null classes (DefaultAudioCDManager,  NullGraphicsManager, NullMutexManager). I may still need to tweak some things, but the design is pretty clear now.

I’ll now continue with the SDL refactoring, which is going good. All SDL Managers have been implemented by now, but I still have lots of work to do.

Now, I have to fix some code that is commented out since modularization, and I’ve to revise sdl code in general but specially the events and graphics managers.

Then, I’ll implement new OSystem_SDL subclasses for Windows, Posix/Unix systems and Mac OSX.

Finally, I’ll start creating the documentation for the changes I’ve made.

Radical changes on design

After some feedback from Max/Fingolfin in the devel mail list, my old inheritance based design of subsystems resulted to be not that good. Instead, Max Horn suggested that I should work with the actual structure of Managers.

Until now, I’ve moved the sdl graphics and mutex code to their new Managers class, and I’ve ScummVM working with these changes. However, the code still needs lots of revision, and I still have to do the same with events, timer and audio.

There are some problems I still need to fix, like where to place shared code between the subsystems or how is the better way for the managers to interact with each other.

So, this new week work plans are:

  • Finish the sdl managers (audio, timer, events)
  • Clean the actual code, and fix some actual code issues
  • And start with the real sdl backend refactoring, as until now I’ve just started working on it and haven’t made much except from diving the actual code

Weekend and Plans

This last weekend I fought to some linker errors in MSVC 2010. It almost gave me a headache, as I was trying to solve the errors for hours without many results. The solution today was simply changing to MSVC 2008 where all works well until now. I still don’t understand what is the problem with 2010 version, I’ll try compiling last changes in other ides than that MSVC later.

Regarding the sdl backend code to subsystems separation I’ve started to do, I’ve Timer, Mutex, Audio and File ready and also Events, but if I commit it now it will break the system as I’ve modified the already existent events.cpp. Now I’m finishing with Graphics sdl subsystem.

Now, the main problem is solving how the subsystems will comunicate with each other. For example, the graphics subsystem needs to know where the cursor is, for showing it on screen. But the cursor coords are stored and modified in the events subsystem. So I need to create a way for both of them to share data.

My current ideas for solving this issue are:

  • Creating a new function in OSystem_SDL class that will send to each subsystem a msg. Then, each subsystem would interpret the msg if they need.
  • Adding the shared data/functions as public in the virtual subsystems, and then calling/reading them from the different subsystems.
  • Having the shared data/functions in OSystem_SDL.

I’m still thinking what the best option is, and if there are other better solutions to this.