Opened 15 years ago

Closed 15 years ago

Last modified 5 years ago

#8938 closed patch

SCUMM: Font data in old SCUMM games

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game:

Description

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.

Ticket imported from: #2278665. Ticket imported from: patches/1043.

Attachments (2)

scumm-fontdata.diff (37.1 KB ) - added by eriktorbjorn 15 years ago.
Patch against current SVN
make-charset-fontdata.c (40.2 KB ) - added by eriktorbjorn 15 years ago.
Program to create the new font data tables

Download all attachments as: .zip

Change History (10)

by eriktorbjorn, 15 years ago

Attachment: scumm-fontdata.diff added

Patch against current SVN

by eriktorbjorn, 15 years ago

Attachment: make-charset-fontdata.c added

Program to create the new font data tables

comment:1 by eriktorbjorn, 15 years ago

File Added: make-charset-fontdata.c

comment:2 by fingolfin, 15 years ago

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.

comment:3 by eriktorbjorn, 15 years ago

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.

comment:4 by eriktorbjorn, 15 years ago

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

comment:5 by fingolfin, 15 years ago

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 ;).

comment:6 by eriktorbjorn, 15 years ago

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.

comment:7 by eriktorbjorn, 15 years ago

Owner: set to eriktorbjorn
Status: newclosed

comment:8 by digitall, 5 years ago

Component: Engine: SCUMM
Note: See TracTickets for help on using tickets.