cowlark.com

[Home] [Index] [About] [Mail me]


Contents
1. Introduction
2. CHAR: Character Sets
3. AARY: Arrays and Strings
4. SCRP: Scripts
4.1. V5 opcode list
4.2. V6 opcode list
5. Glossary
6. SLOB files

SLOB files

Introduction

SLOB files are used by Skim to store intermediate data while working on SCUMM files. Each file can contain one or more SCUMM resources, plus metadata used to describe the resources to the linker and to tell the linker which other resources the SLOB file refers to.

SLOB files have the following format:

Size    Type             Description
8       chunk tag        Slob chunk tag
        chunk            SVer chunk
        chunk            Data chunk
        chunks...        fixup chunks

SVer:

Size    Type             Description
8       chunk tag        Sver chunk tag
1       byte             SCUMM major version
1       byte             SCUMM minor version
1       byte             Skim major version
1       byte             Skim minor version

Data:

Size    Type             Description
8       chunk tag        Data chunk tag
        chunk            any SCUMM chunk

Fixup chunks

There are two kind of fixup chunks. OInd is used to inform the linker that the SLOB file contains an exported resource; OFix is used to inform the linker that the SLOB file is referring to another resource, and which the linker needs to insert references to when the SLOB file is linked.

The linker refers to named resources by name and class. The name can be any short string, although the Skim compiler will have trouble if the name is not a valid C identifier. When the files are linked, the linker will choose a resource number and patch all the resources that referenced that particular named resource to use it. It is also possible to patch in an offset to a resource relative to another resource. Each resource class has its own namespace, so char largetext and scrp largetext will not conflict.

This mechanism is also used to manage word and bit variables for use in scripts.

OInd --- named resource declaration

Size    Type             Description
8       chunk tag        OInd chunk tag
2       word LE          desired resource number
        bytes...         zero-terminated path
1       byte             resource class
        bytes...         zero-terminated resource name

This chunk notifies Skim that the given resource is a named resource. The path given is relative to the Data chunk (so a path of / --- which is invalid --- refers to the Data chunk itself).

The resource type is a standard SCUMM resource class, or an extension (of which more later). The resource number should be -1 if the linker is to choose a resource number when the final link is done, or else the number can be explicitly specified. Attempting to link two SLOB files that contain the same resource name with conflicting explicit object numbers will cause an error.

A negative object number indicates that you don't care about the actual number. The linker is free to use any number to represent these, provided they're consistent, and to renumber them as required when linking together two different SLOB files.

The object name is a string containing the name of the object, which is used to distinguish dynamically numbered objects.

This is also used to keep track of other entities by use of special object types.

Value Meaning
128 Word variable
129 Bit variable

When these are used, the resource path is ignored.

OFix --- named resource fixup

Size    Type             Description
8       chunk tag        OInd chunk tag
4       quad LE          offset into destination resource
1       byte             action
1       byte             fixup type
        bytes...         zero-terminated path of destination resource
1       byte             byte C
        bytes...         zero-terminated string S1
        bytes...         zero-terminated string S2

The actual action taken is as follows:

Value Meaning
0 Do nothing.
1 Write the resource number of the named resource specified by the resource class C and name S1 into the destination resource, in the format specified by the fixup byte. S2 is ignored.
2 Write the offset of the resource specified by the path S1, relative to the path S2, into the destination resource, in the format specified by the fixup byte. If the offset is too large to fit in the specified fixup then the linker will halt with an error. C is ignored. Note that both S1 and S2 are specified relative to the SLOB's Data chunk; it is legal for S2 to be outside S1.

When action is 2, the fixup byte is interpreted as follows:

Value Meaning
0 Do nothing.
1 Write a byte.
2 Write a word LE.
3 Write a word BE.
4 Write a quad LE.
5 Write a quad BE.


All material © 2000-2002 David Given, unless where stated otherwise.
This page last updated on 2002-09-18 23:05:19.000000000 +0100 scumm/slob.ns .