Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1043 SCUMM: Font data in old SCUMM games

closed-accepted
None
5
2008-11-14
2008-11-13
No

The recent discussion in scummvm-devel about the size of the ScummVM binary reminded me that we have a few kilobytes of hard-coded font data for Zak and Maniac Mansion. Would it help if this was reduced?

This patch replaces most of the fonts with tables that simply describe how they differ from the English Zak font.

Discussion

  • Patch against current SVN

     
    Attachments
  • Program to create the new font data tables

     
  • File Added: make-charset-fontdata.c

     
  • Max Horn
    Max Horn
    2008-11-13

    Sounds like a very nice thing. Have you tested whether it makes a positive difference in reality? I.e. compile scummvm once with and once without it (ideally both times with -Os or -O2 enabled), and compare the size of the stripped binaries.

     
  • I didn't yesterday, because it was getting a bit late.

    Without patch, all engines enabled:

    Opt. Before After Before - After

    -O2 8467668 8463572 4096
    -Os 6202344 6197952 4392

    Which seems pretty reasonable. The patch replaces 5 KB of old font data with 356 bytes of new font data. The largest theoretical saving would be 4764 bytes, but of course it also adds some code to re-construct the font data from the new tables.

    (It may be possible to shave a bit off the Russian charset, too. There seems to be 60+ characters in it that are blank.)

    Incidentally, compiling with -O2 turned up some warnings I hadn't seen before:

    engines/igor/igor.cpp: In member function ‘void Igor::IgorEngine::drawInventory(int, int)’:
    engines/igor/igor.cpp:1308: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true

    ./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway(int, bool)’:
    ./engines/saga/animation.h:173: error: array subscript is above array bounds
    ./engines/saga/animation.h:173: error: array subscript is above array bounds

    The Igor warning looks justified to me, but I don't have the game. I haven't checked what causes the SAGA one yet.

     
  • Oops, I meant to remove the "Without patch, all engines enabled:" line before submitting the comment. :-)

     
  • Max Horn
    Max Horn
    2008-11-14

    Please commit this then, sounds like good work.

    As for the warnings, the one in SAGA sounds like a real bug. Please file a report for that resp. mail to scummvm-devel about it, as you see fit. If it turns out not to be a bug, I'll happily take the complaints, if not, you can take the credit for reporting it ;).

     
  • Ok. I should probably change the name of the tool to include "scumm" somewhere first, though.

    I've discovered what part of the SAGA problem is, but one warning still eludes me.

     
    • assigned_to: nobody --> eriktorbjorn
    • status: open --> closed-accepted