nuukiaworld
04-02-2006, 03:43 PM
I noticed that those common PPM strings that are not NokiX built-in strings are added to the PPM every time when add_ppm_strings is called, even if exactly the same texts already reside in the PPM! :-o
I made quick and dirty modifications to add_ppm_strings.rx: This version checks all previously added texts before adding a text and if it can find a text that matches competely* to the new one, the new text will not be added. – Only a new nokstr_t variable is created to point to the "old" text already present in the PPM.
* All those languages that are present in the PPM must contain the same string. Languages missing from either text are not compared. If a match is found but the "new" text contain languages that do not exist in the "old" text, they are added to the "old" text.This modification saved more than ½ kB of flash space on my phone (which has only two languages; I had 6 bytes free, now I have over 500 bytes free! :grin: ). The amount of saved flash space will be bigger if you have many languages in your PPM. The change did not create any problems with any script I use! :P
For example, several games have texts "Clear top score" and "Top score cleared!". After this change, these texts are included in the PPM only once, even if each game tries to add them there as "LOCAL" or "VAR" texts. (No changes are required to the actual scripts or _ppm files!)
BTW: add_ppm_strings may be optimized even further to use a single nokstr_t variable for all occurences of the same text. However, then the _ppm files should be able to tell if the script expects the nokstr_t variables to be in successive memory locations (e.g. when they form an array), i.e. there should be a flag that forces the creation of a new nokstr_t variable even if an old one exists... Edit: forget this, it makes everything more complicated and would save only a few additional bytes...
I made quick and dirty modifications to add_ppm_strings.rx: This version checks all previously added texts before adding a text and if it can find a text that matches competely* to the new one, the new text will not be added. – Only a new nokstr_t variable is created to point to the "old" text already present in the PPM.
* All those languages that are present in the PPM must contain the same string. Languages missing from either text are not compared. If a match is found but the "new" text contain languages that do not exist in the "old" text, they are added to the "old" text.This modification saved more than ½ kB of flash space on my phone (which has only two languages; I had 6 bytes free, now I have over 500 bytes free! :grin: ). The amount of saved flash space will be bigger if you have many languages in your PPM. The change did not create any problems with any script I use! :P
For example, several games have texts "Clear top score" and "Top score cleared!". After this change, these texts are included in the PPM only once, even if each game tries to add them there as "LOCAL" or "VAR" texts. (No changes are required to the actual scripts or _ppm files!)
BTW: add_ppm_strings may be optimized even further to use a single nokstr_t variable for all occurences of the same text. However, then the _ppm files should be able to tell if the script expects the nokstr_t variables to be in successive memory locations (e.g. when they form an array), i.e. there should be a flag that forces the creation of a new nokstr_t variable even if an old one exists... Edit: forget this, it makes everything more complicated and would save only a few additional bytes...