@4bitlabs/sci0
v6.2.1
Published
Library for decoding and parsing assets from Sierra On-line's SCI-engine.
Readme
@4bitlabs/sci0
Library for decoding and parsing assets from Sierra On-line's SCI-engine.
Documentation
Full documentation for the library can be found here.
Supported SCI0 resource types
| Type | Extract | Parse/Render | Write | | ------ | :-----: | :----------: | :---: | | View | ✅ | ✅ | ❌ | | Pic | ✅ | ✅ | ❌ | | Script | ✅ | ❌ | ❌ | | Text | ✅ | ✅ | ❌ | | Sound | ✅ | ❌ | ❌ | | Memory | ✅ | ❌ | ❌ | | Vocab | ✅ | ❌ | ❌ | | Font | ✅ | ✅ | ❌ | | Cursor | ✅ | ✅ | ❌ | | Patch | ✅ | ❌ | ❌ |
Parse RESOURCE.MAP file
import { readFile } from 'fs/promises';
import { parseAllMappings } from '@4bitlabs/sci0';
const resourceMap = await readFile('path/to/RESOURCE.MAP');
const [mapping] = parseAllMappings(resourceMap);Working ResourceMap Entires
import { Resource } from '@4bitlabs/sci0';
// finding by type
const firstPic = mapping.find((it) => Resource.getTypeStr(it.id) === 'Pic');
// ...or by specific resource number.
const num11 = mapping.find((it) => Resource.getNumber(it.id) === 11);Getting the actual data
import { parseHeaderWithPayload, decompress } from '@4bitlabs/sci0';
// Get the resource file that contains this asset, and its offset where the header starts.
const { file, offset } = mapping.find(
(it) => getResourceTypeStr(it.id) === 'Pic',
);
const resource = await readFile(
`path/to/RESOURCE.${file.toString().padStart(3, '0')}}`,
);
// Parse the asset header and payload
const [header, compressed] = parseHeaderWithPayload(resource, offset);
// Decompress the asset data
const data = decompress('sci0', header.compression, compressed);VIEW Resource
Example:
todo
