SPR
CreatedFiles are saved in little-endian.
The format is as follows (showing the version 0x201, differences between versions are noted in the description):
Label | Bytes | Type | Description |
---|---|---|---|
signature | 2 | char | 'SP' |
version | 2 | uint16 | 0x201, 0x200, 0x101, 0x100 |
nPalImages | 2 | uint16 | The number of Palette Images in this SPR file. |
nRGBAImages | 2 | uint16 | The number of True Color Images in this SPR file. Version 0x200+. |
<palImages> | variable | PaletteImage | times * nPalImages read PaletteImage part below. |
<rgbaImages> | variable | RGBAImage | times * nRGBAImages read RGBAImage part below. Version 0x200+. |
palette | 1024 | 4*256*ubyte | Palette data contains 256 colors. 4 ubyte * 256 with colors in the order RGB followed by a null byte. The null byte is not the alpha value. |
PaletteImage ¶
Label | Bytes | Type | Description |
---|---|---|---|
width | 2 | uint16 | The width of the image. |
height | 2 | uint16 | The height of the image. |
encodedSize | 2 | uint16 | The size of the RLE encoded image data. Version 0x201+. |
<imageData> | encodedSize | encodedSize*ubyte | Each pixel is an index to the palette. Only the background color (aka the palette index with value 0) is RLE encoded. That means after the zero byte a second byte follows that indicates how often the background is repeated. For versions below 0x201 the image data is not RLE encoded and each pixel is simply an index to the palette data. |
RGBAImage ¶
Label | Bytes | Type | Description |
---|---|---|---|
width | 2 | uint16 | The width of the image. Version 0x200+. |
height | 2 | uint16 | The height of the image. Version 0x200+. |
<imageData> | width*height*4 | width*height*4 ubyte | Pixel data in the form ABGR. Version 0x200+. |
Links & Sources ¶
From my research years back most of the info comes from "deufeufeu" around 2003. Who shared info about the SPR and ACT file format. His work has been archived by Gratia Huang on his website: http://mist.in/gratia/ro/spr/deufeufeu_files/ (Archive). Later on I've been fortunate to have been gotten a hold of the source code of a chinese game called DHXJ (东方仙境). Special thanks to the ASB community for that. This game is based on the pre-renewal RO client but without knowing what kind of modifications have been made the info it provides should be looked at critically.
- http://mist.in/gratia/ro/spr/SprFileFormat.html (Archive) (2007? Great visualisation of the file structure)
- http://rolaboratory.ximosoft.com/file-format/spr (Archive) (2005-2009)
- https://gitlab.com/open-ragnarok/open-ragnarok/-/blob/master/roint/spr.cc (2009)
- DHXJ (东方仙境) (Source Code, 2013. Game that used the RO code as a basis)