BINSIZE.BIN

From OHRRPGCE-Wiki
Jump to navigation Jump to search

BINSIZE.BIN stores the record size in bytes for other lumps which are sequences of fixed-size binary records, so that future versions of the OHRRPGCE can resize lumps without breaking backwards compatability. This lump wasn't implemented until serendipity (2006), but slowly more and more lumps are converted to store their record sizes here (only as needed).

About Formal Specs

Offset Data Meaning Default
(backwards compatibility)
0 INT Length of record in ATTACK.BIN N/A
1 INT Length of each record in STF 64
2 INT Length of each record in SONGDATA.BIN N/A
3 INT Length of each record in SFXDATA.BIN N/A
4 INT Length of each record in MAP lump 40
5 INT Length of each record in MENUS.BIN N/A
6 INT Length of each record in MENUITEM.BIN N/A
7 INT Length of each record in UICOLORS.BIN N/A
8 INT Length of each record in SAY 400
9 INT Length of each record in .N## 30
10 INT Length of each record in .DT0 636
11 INT Length of each record in .DT1 320
12 INT Length of each record in .ITM 200

Any binary record lumps that are added in the future will likely also have their record size stored in BINSIZE.BIN. Current lumps can be extended by modifying the lump reading/writing routines to check BINSIZE.BIN.

Default[edit]

Older RPG files may not have all these values set. If a record size is not present, use the Default record size.

Programming Interface[edit]

Four functions are provided for accessing binsize information

getbinsize()   returns the current size in BYTES of the records in the specific binary file you are working with
curbinsize()   returns the correct size in BYTES for of the records for the version of the OHRRPGCE you are running
defbinsize()   returns the default size in BYTES to use for getbinsize() when no BINSIZE data is available at all
dimbinsize()   returns the upper bound for the array (of INTs) you will be loading the record into