It ensures that GMenu2X can restart after a SDL program segfaulted or crashed.
It also allow GMenu2X to exit without clearing the screen, so that the "loading" screen appears
until the launched binary starts using the framebuffer.
writeSkinConfig() had a very naughty bug when RGBA values were written
to config file unpadded. This lead to a problem that, for example,
0x00000080 was written as 0x00080 in config file (Somehow gmenu2x
reads and re-saves config on selection). This, in turn, led
to problem when reading skin config file in strtorgba function,
because it parses the color string in token of two symbols
(substr(0,2) and etc).
This eliminates the build-time dependency on SDL_image and the run-time
dependencies on all libraries used by SDL_image except SDL and libpng.
In addition we now let libpng convert to ARGB format while decoding the
image, rather than letting SDL convert the surface afterwards.
A bug in SDL_ConvertSurface() leaves the per-surface alpha undefined when
converting from RGBA to RGBA. This can cause problems if the surface is
later converted to a format without an alpha channel, such as the display
format.
Instead of having the copy constructor convert to display format, the new
copy constructor preserves the pixel format and a separate method was
introduced to convert surfaces to display format.
The code was made more robust as well: it should no longer crash if the
wallpaper cannot be loaded.
I cheated a bit by declaring ASFont as friend, but all other outside
access now happens via methods.
I removed the "saveScreenshot" method since the code calling it is
commented out and I never heard anyone complain about missing this
feature.
If loading fails, the factory method returns NULL, while previously the
constructor would create a Surface object with a NULL "raw" field.
However, since most of the methods dereference "raw" without checking,
such a Surface would likely crash the application when used.
Use real double buffering instead.
I checked the SDL code and if the hardware cannot provide double buffering
it will use a shadow surface to ensure that a frame is not displayed until
it has been fully painted.
Also disable mouse cursor before opening the output surface. The reason it
was disabled after the surface was opened is that SDL on GP2X has a bug.
However, this means the cursor is visible for a short time during startup
which looks ugly.
The unnecessary alpha channel might harm performance but is not a big deal.
However, the fact that the alpha flag (bool) is somehow automatically
converted by C++ into a skin name (string) causes the entire screen to
stay black.
The black screen was fixed by removing the alpha flag.
For optimum blitting performance, the wallpaper surface is then converted
to the pixel format of the frame buffer.
Bug was introduced in 52c89d6005.
Before this commit loadPNG() could return any surface format and the caller
was responsible for converting it to the desired format. However, in practice
all callers want a surface with an alpha channel and SDL only supports that
with 32bpp surfaces, so RGBA or a permutation thereof. So I changed the
contract for loadPNG() so it is required to return an RGBA surface, and
removed the conversion code in the callers.
The next step is to replace IMG_Load() by a function that calls libpng
directly and loads a fixed 32bpp pixel format. That way, we can drop the
SDL_image dependency and avoid unnecessary pixel format conversions.
Renamed methods that draw a single line from write() to writeLine().
There is now only one write() method left: the public method.
Pass surface to draw on as wrapped Surface instead of SDL_Surface.
At the end of the call chain we still use SDL directly though.
Removed all methods that are never called.
Made methods that are only called by Surface itself private.
One ugly thing remaining is outside access to the "raw" field.
It takes as its parameter the name of the targeted platform.
Currently, those are nanonote, dingux, pandora, gp2x and pc.
The makefiles will install the data accordingly to the platform specs
(e.g. install the 800x480 skins for the pandora platform).
On the "platform" sub-folder are located one folder for each platform gmenu2x supports.
The "translations" folder is now the same for all platforms.
The "skins" sub-folder contains directories which names defines the screen resolution of the contained skins (e.g. "320x240").
There is no point in precalculating something so cheap to recalculate.
Also, the majority of uses was to compensate for passing the wrong alignment argument.