FCAPalette 1.5 for Siemens-SX1
Author: fca00000 , fca00000-at-yahoo-dot-es
Date: 2006.01.07
Date: 2006.01.22 v1.2
Date: 2006.03.24 v1.5
Date: 2006.05.07 v1.7
License: GPL

This is a small application that loads a colour palette for mobiles SX1.
You need the patch called FCAPalette.sxp and FCAMem.sxp

It is almost the same as FCAMem.sis because it reads and writes the memory.
The whole process works this way:
In original file palette.dll there is a routine called
DefaultColor256Util
which takes an integer as a parameter.
Then it returns an address for that particular PaletteID, from 1 to 4
The address is hardcoded, because the palette.dll is in ROM, therefore always the same address.
For version 14, these addresses are:
palette1: 0x50296728
palette2: 0x50297B28
palette3: 0x50298F28
palette4: 0x5029A328

The patch changes the address for palette4 from 0x5029A328 to 0x58073004
Also changes the routine to allow using palette5 at 0x58074404 and palette6 at 0x58075804.
I have choosen that address because it is in RAM, and no other process uses it.

Now we need a program that writes the palette4 from c: drive into that address.
This is what FCAPalette.app does
On start, opens file c:\palette4.dll
Then skips the first 0x3D18-0x1400*3 bytes, which belongs to palette1.
Now copies the remanent bytes (0x1400*3) into 0x58073004
To do this, it uses patch FCAMem v0.3
And exits.

When the user chooses palette4-6 (Magenta-???) the address points to our new data.

There is a problem, though. When the mobile is switched on, the program FCAPalette hasn't been executed, and
the memory from 0x58073004 contains initialized data.
The solution is to start FCAPalette as soon as possible.
The program EzBoot is used for this purpose.
In short, it allows loading programs when phone starts.
I include a modified version: time to start is 1 second.
More information about EzBoot in www.newlc.com/article.php3?id_article=152
Thanks to Eric Bustarret for this great utility, and for making the source code available. People like him make the world better.

v1.7
Another application FCAPaletteExe.EXE (in folder FCAPaletteExe) does the same as FCAPalette.app, but can be
launched from Starter_ARM.rsc , therefore it will be loaded before the splashscreen shows.
This fixes the problem that colours in splashscreen are messed up.
But you need to modify Starter_ARM.rsc to also launch FCAPaletteExe.EXE .
This idea was suggested by KF and MacKam in sx1.pl and I suggest you to visit their forum to get new versions.
Thanks a lot to -=Zorn=- for his tutorial on building EXE files.


Any feedback is welcome.

******************************
End of FCAPalette.txt
