Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RwStream
[Streaming]


Data Structures

struct   RwChunkHeaderInfo
struct   RwMemory
struct   RwStream
struct   RwStreamCustom
union   RwStreamFile
struct   RwStreamMemory
union   RwStreamUnion

Enumerations

enum   RwCorePluginID {
  rwID_NAOBJECT = 0x00, rwID_STRUCT = 0x01, rwID_STRING = 0x02, rwID_EXTENSION = 0x03,
  rwID_CAMERA = 0x05, rwID_TEXTURE = 0x06, rwID_MATERIAL = 0x07, rwID_MATLIST = 0x08,
  rwID_ATOMICSECT = 0x09, rwID_PLANESECT = 0x0A, rwID_WORLD = 0x0B, rwID_SPLINE = 0x0C,
  rwID_MATRIX = 0x0D, rwID_FRAMELIST = 0x0E, rwID_GEOMETRY = 0x0F, rwID_CLUMP = 0x10,
  rwID_LIGHT = 0x12, rwID_UNICODESTRING = 0x13, rwID_ATOMIC = 0x14, rwID_TEXTURENATIVE = 0x15,
  rwID_TEXDICTIONARY = 0x16, rwID_ANIMDATABASE = 0x17, rwID_IMAGE = 0x18, rwID_SKINANIMATION = 0x19,
  rwID_GEOMETRYLIST = 0x1A, rwID_HANIMANIMATION = 0x1B, rwID_TEAM = 0x1C, rwID_CROWD = 0x1D,
  rwID_DMORPHANIMATION = 0x1E, rwID_RIGHTTORENDER = 0x1f, rwID_MTEFFECTNATIVE = 0x20, rwID_MTEFFECTDICT = 0x21,
  rwID_TEAMDICTIONARY = 0x22, rwID_PITEXDICTIONARY = 0x23, rwID_TOC = 0x24, rwID_PRTSTDGLOBALDATA = 0x25,
  rwID_ALTPIPE = 0x26, rwID_PIPEDS = 0x27, rwID_PATCHMESH = 0x28, rwID_COREPLUGINIDMAX = 0x29,
  rwCOREPLUGINIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}
enum   RwStreamType {
  rwNASTREAM = 0, rwSTREAMFILE, rwSTREAMFILENAME, rwSTREAMMEMORY,
  rwSTREAMCUSTOM, rwSTREAMTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}
enum   RwStreamAccessType {
  rwNASTREAMACCESS = 0, rwSTREAMREAD, rwSTREAMWRITE, rwSTREAMAPPEND,
  rwSTREAMACCESSTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}

Functions

RwBool  RwStreamFindChunk (RwStream *stream, RwUInt32 type, RwUInt32 *lengthOut, RwUInt32 *versionOut)
RwStream RwStreamWriteReal (RwStream *stream, const RwReal *reals, RwUInt32 numBytes)
RwStream RwStreamWriteInt32 (RwStream *stream, const RwInt32 *ints, RwUInt32 numBytes)
RwStream RwStreamWriteInt16 (RwStream *stream, const RwInt16 *ints, RwUInt32 numBytes)
RwStream RwStreamReadInt16 (RwStream *stream, RwInt16 *ints, RwUInt32 numBytes)
RwStream RwStreamReadReal (RwStream *stream, RwReal *reals, RwUInt32 numBytes)
RwStream RwStreamReadInt32 (RwStream *stream, RwInt32 *ints, RwUInt32 numBytes)
RwStream RwStreamReadChunkHeaderInfo (RwStream *stream, RwChunkHeaderInfo *chunkHeaderInfo)
RwStream RwStreamWriteChunkHeader (RwStream *stream, RwInt32 type, RwInt32 size)
void  RwStreamSetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
RwUInt32  RwStreamRead (RwStream *stream, void *buffer, RwUInt32 length)
RwStream RwStreamWrite (RwStream *stream, void const *buffer, RwUInt32 length)
RwStream RwStreamSkip (RwStream *stream, RwUInt32 offset)
RwBool  RwStreamClose (RwStream *stream, void *pData)
RwStream RwStreamOpen (RwStreamType type, RwStreamAccessType accessType, const void *pData)

Detailed Description

Stream

RwStream Overview

Requirements

Overview

Represents a RenderWare Binary Stream.

RenderWare has only one primary file format: the RenderWare Binary Stream. Serializable objects can be read from and written to these streams. The resulting data files are generally platform-neutral. (An exception to this is RwTexDictionary, which is platform-dependent.)

Serializable objects have dedicated RenderWare Binary Stream read/write functions in their respective APIs. The RwStream API itself is used by these functions to perform the low-level work. Developers can also use these functions to interrogate RenderWare Binary Streams and learn their contents.

Developers should note that major version updates to RenderWare may require re-exporting and/or rebuilding of data as the RenderWare Binary Stream system includes a versioning system to prevent RenderWare from attempting to load incomplete data structures.


Enumeration Type Documentation

enum RwCorePluginID
 

RwCorePluginID

A chunk is a block of binary stream data containing objects. These objects are referenced using object IDs which are listed below. Before an object stream is read, a chunk needs to be obtained containing the object ID. These IDs are used with the function RwStreamFindChunk.

To write a chunk into a stream RwStreamWriteChunkHeader is used with one of the following object IDs.

Note:
Rt2d and Rt2dAnim (inc. Maestro) use different object IDs. These are listed in Rt2d Object IDs and Rt2dAnim Object IDs.
See also:
RwStreamFindChunk , RwStreamWriteChunkHeader
Enumeration values:
rwID_CAMERA  RwCamera chunk. See RwCameraStreamRead
rwID_TEXTURE  RwTexture chunk. See RwTextureStreamRead
rwID_MATERIAL  RpMaterial chunk. See RpMaterialStreamRead.
rwID_WORLD  RpWorld chunk. See RpWorldStreamRead.
rwID_SPLINE  RpSpline chunk. See RpSplineStreamRead
rwID_MATRIX  RwMatrix chunk. See RwMatrixStreamRead
rwID_GEOMETRY  RpGeometry chunk. See RpGeometryStreamRead.
rwID_CLUMP  RpClump chunk. See RpClumpStreamRead.
rwID_LIGHT  RpLight chunk. See RpLightStreamRead.
rwID_ATOMIC  RpAtomic chunk. See RpAtomicStreamRead
rwID_TEXDICTIONARY  RwTexDictionary - platform specific texture dictionary. See RwTexDictionaryStreamRead.
rwID_IMAGE  RwImage chunk. See RwImageStreamRead
rwID_HANIMANIMATION  RtAnimAnimation chunk. See RtAnimAnimationStreamRead.
rwID_TEAM  RpTeam chunk. See RpTeamStreamRead
rwID_DMORPHANIMATION  RpDMorphAnimation - delta morph animation chunk. See RpDMorphAnimationStreamRead
rwID_TEAMDICTIONARY  RpTeamDictionary chunk. See RpTeamDictionaryStreamRead
rwID_PITEXDICTIONARY  RwTexDictionary - platform independent texture dictionary. See RtPITexDictionaryStreamRead.
rwID_TOC  RtTOC chunk. See RtTOCStreamRead
rwID_PRTSTDGLOBALDATA  RpPrtStdEmitterClass, RpPrtStdParticleClass and RpPrtStdPropertyTable chunks. See RpPrtStdEClassStreamRead, RpPrtStdPClassStreamRead RpPrtStdPropTabStreamRead and RpPrtStdGlobalDataStreamRead
rwID_PATCHMESH  RpPatchMesh chunk. See RpPatchMeshStreamRead
enum RwStreamAccessType
 

RwStreamAccessType This type represents the options available for accessing a stream when it is opened. See API section RwStream

Enumeration values:
rwNASTREAMACCESS  Invalid stream access
rwSTREAMREAD  Read
rwSTREAMWRITE  Write
rwSTREAMAPPEND  Append
enum RwStreamType
 

RwStreamType This type represents the different types of stream that can be used. See API section RwStream

Enumeration values:
rwNASTREAM  Invalid stream type
rwSTREAMFILE  File
rwSTREAMFILENAME  File name
rwSTREAMMEMORY  Memory
rwSTREAMCUSTOM  Custom

Function Documentation

RwBool RwStreamClose RwStream   stream,
void *    pData
 

RwStreamClose is used to close the specified binary stream. For streams of type rwSTREAMMEMORY the stream specific argument should point to a RwMemory structure that will receive the position and size of the memory block used by the stream. For other stream types set the argument to NULL.

Parameters:
stream  Pointer to the currently opened stream.
pData  Pointer to the stream specific data
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwStreamOpen , RwStreamRead , RwStreamWrite , RwStreamSkip
RwBool RwStreamFindChunk RwStream   stream,
RwUInt32    type,
RwUInt32   lengthOut,
RwUInt32   versionOut
 

RwStreamFindChunk is used to scan through the specified stream looking for the first occurrence of a chunk of the given type. This function can be used in conjunction with the appropriate stream read function to load objects and data from RenderWare binary files.

This function will produce warning messages if old binary files are streamed in. Depending on the binary file's version stamp, it may be still be read successfully or fail. It is recommended that all old binary files be updated to newer versions, by re-exporting, if the warning messages appears.

Parameters:
stream  Pointer to the stream to scan through.
type  A RwUInt32 value equal to the chunk's identifier listed in RwCorePluginID:
lengthOut  Pointer to a RwUInt32 value that will receive the length in bytes of the chunk data if it is found. Set to NULL if not required.
versionOut  Pointer to a RwUInt32 value that will receive the version of the chunk data if it is found. Set to NULL if not required. See RwEngineGetVersion.
Returns:
Returns TRUE if the chunk was found or FALSE if not or if there is an error.
See also:
RwCameraStreamRead , RpClumpStreamRead , RpGeometryStreamRead , RpLightStreamRead , RpMaterialStreamRead , RwMatrixStreamRead , RwTextureStreamRead , RpWorldStreamRead , RwStreamWriteChunkHeader , RwCorePluginID
RwStream* RwStreamOpen RwStreamType    type,
RwStreamAccessType    accessType,
const void *    pData
 

RwStreamOpen is used to open and initialize a new binary stream according to the specified stream type and access mode.

Parameters:
type  Type of stream to open. Stream types currently supported are:
  • rwSTREAMFILE The stream is to a disk file that has been set up by the user. The access mode must correspond to the one used when the the file was first opened. The type specific argument should be set to the file's pointer (FILE *).
  • rwSTREAMFILENAME The stream is to a disk file specified by name. The type specific argument should be set to a string containing the file's name.
  • rwSTREAMMEMORY The stream is to a chunk of memory. If the access type is rwSTREAMAPPEND then the chunk of memory must have been created using RwMalloc as RenderWare may subsequently try to use RwRealloc to gain more memory. The type specific argument should be a pointer to the memory chunk ( RwMemory *) giving the position and size of the chunk to use.
accessType  Access mode of stream:
  • rwSTREAMREAD Opens a stream for reading only. This corresponds to using fopen with "rb" access mode.
  • rwSTREAMWRITE Opens a stream for writing only. This corresponds to using fopen with "wb" access mode.If the stream is of type rwSTREAMFILE or rwSTREAMFILENAME the file size will be reduced to zero when the stream is opened.
  • rwSTREAMAPPEND Opens a stream for appending to. This corresponds to using fopen with "ab" access mode.
pData  Stream type specific data.
Returns:
Returns a pointer to the new stream if successful or NULL if there is an error.
See also:
RwStreamClose , RwStreamRead , RwStreamWrite , RwStreamSkip
RwUInt32 RwStreamRead RwStream   stream,
void *    buffer,
RwUInt32    length
 

RwStreamRead is used to read a number of bytes from the specified stream into the given data buffer. This function can only be used on a stream that has been opened for reading using the rwSTREAMREAD flag.

Parameters:
stream  Pointer to the stream to read data from.
buffer  Pointer to the buffer that will receive data from stream.
length  A RwUInt32 value equal to the number of bytes to read from the stream.
Returns:
Returns the number of bytes read, this may be less than the number reqested if an error or the end of file is encountered
See also:
RwStreamWrite , RwStreamReadInt32 , RwStreamReadReal , RwStreamOpen
RwStream* RwStreamReadChunkHeaderInfo RwStream   stream,
RwChunkHeaderInfo   chunkHeaderInfo
 

RwStreamReadChunkHeaderInfo reads the Chunk Header information and stores it in the structure provided.

Parameters:
stream  Pointer to stream to extract information from
chunkHeaderInfo  Pointer to storage for chunkHeaderInfo datatype.
Returns:
Pointer to the stream if successful; NULL if an error occurred
See also:
RwStreamOpen , RwStreamRead
RwStream* RwStreamReadInt16 RwStream   stream,
RwInt16   ints,
RwUInt32    numBytes
 

RwStreamReadInt16 is used to read an array of RwInt16 data values from the specified stream. The data is read from the stream in and converted automatically to little-endian or big-endian representation, as appropriate for the platform. (RenderWare Streams use little-endian format internally.)

Parameters:
stream  Pointer to the stream to read from.
ints  Pointer to an array of RwInt16 values that will receive the data from the stream.
numBytes  A RwInt32 value equal to the size of the array in bytes. (Use the sizeof operator to ensure portability.)
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamWriteInt16 , RwStreamWriteReal , RwStreamReadReal , RwStreamWrite , RwStreamRead
RwStream* RwStreamReadInt32 RwStream   stream,
RwInt32   ints,
RwUInt32    numBytes
 

RwStreamReadInt32 is used to read an array of RwInt32 data values from the specified stream. The data is read from the stream in and converted automatically to little-endian or big-endian representation, as appropriate for the platform. (RenderWare Streams use little-endian format internally.)

Parameters:
stream  Pointer to the stream to read from.
ints  Pointer to an array of RwInt32 values that will receive the data from the stream.
numBytes  A RwInt32 value equal to the size of the array in bytes. (Use the sizeof operator to ensure portability.)
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamWriteInt32 , RwStreamWriteReal , RwStreamReadReal , RwStreamWrite , RwStreamRead
RwStream* RwStreamReadReal RwStream   stream,
RwReal   reals,
RwUInt32    numBytes
 

RwStreamReadReal is used to read an array of RwReal data values from the specified stream. The data is read from the stream and converted automatically to little-endian or big-endian format as appropriate for the platform. (RenderWare Streams use little-endian format internally.)

Parameters:
stream  Pointer to the stream to read from.
reals  Pointer to an array of RwReal values that will receive the data from the stream.
numBytes  A RwInt32 value equal to the size of the array in bytes. (Use the sizeof operator to ensure portability.)
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamWriteReal , RwStreamWriteInt32 , RwStreamReadInt32 , RwStreamWrite , RwStreamRead
void RwStreamSetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RwStreamSetFreeListCreateParams allows the developer to specify how many RwStream s to preallocate space for. Call before RwEngineInit.

Parameters:
blockSize  number of entries per freelist block.
numBlocksToPrealloc  number of blocks to allocate on RwFreeListCreateAndPreallocateSpace.
See also:
RwFreeList
RwStream* RwStreamSkip RwStream   stream,
RwUInt32    offset
 

RwStreamSkip is used to skip the specified number of bytes in the given stream. This function can only be used on a stream opened for reading and after calling RwStreamSkip subsequent reads will begin from the new position within the stream.

Parameters:
stream  Pointer to the stream.
offset  A RwUInt32 value equal to the number of bytes to move.
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamOpen , RwStreamClose , RwStreamRead , RwStreamWrite , RwStreamFindChunk
RwStream* RwStreamWrite RwStream   stream,
void const *    buffer,
RwUInt32    length
 

RwStreamWrite is used to write a number of bytes to the specified stream from the given data buffer. This function can only be used on a stream which has been opened for writing or appending using the rwSTREAMWRITE or rwSTREAMAPPEND flags, respectively.

Parameters:
stream  Pointer to the stream to write data to.
buffer  Pointer to the buffer that contains the data.
length  A RwUInt32 value equal to the number of bytes to write to stream.
Returns:
Returns pointer to the stream if successful or NULL if there is error.
See also:
RwStreamRead , RwStreamWriteInt32 , RwStreamWriteReal , RwStreamOpen
RwStream* RwStreamWriteChunkHeader RwStream   stream,
RwInt32    type,
RwInt32    size
 

RwStreamWriteChunkHeader is used to write a chunk header to the specified stream. This function would typically be used by an application wishing to write application specific data to a file.

The chunk identifier is a 32 bit value which identifies the type of data to be written in a universally unique way. The three highest order bytes (24 most significant bits) should be the developers ID. The developers ID is the number that is used by that developer as a username to log on to the RenderWare developers website. The low-order byte (8 least significant bits) is used for each custom chunk type, and are allocated by the individual developer. If more than 256 custom data types are required then Criterion would then supply you with further developers IDs.

RwStreamWriteChunkHeader is currently implemented as a macro.

Parameters:
stream  Pointer to the stream to write chunk header to.
type  A RwInt32 value equal to the chunk's identifier cast to an RwInt32 type.
size  A RwInt32 value equal to the size of the chunk data.
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamFindChunk , RwStreamWriteReal , RwStreamWriteInt32 , RwStreamReadInt32 , RwStreamWrite , RwStreamRead , RwCorePluginID
RwStream* RwStreamWriteInt16 RwStream   stream,
const RwInt16   ints,
RwUInt32    numBytes
 

RwStreamWriteInt16 is used to write the given array of RwInt16 data values to the specified stream. For compatibility across multiple platforms, the data is automatically converted to little-endian format if necessary. This process is reversed upon reading the stream data so no platform-specific conversion is needed.

Parameters:
stream  Pointer to the stream to write to.
ints  Pointer to array of RwInt16 data values.
numBytes  A RwInt32 value equal to the size of the array in bytes. (Use the sizeof operator to ensure portability.)
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamReadInt16 , RwStreamWriteReal , RwStreamReadReal , RwStreamWrite , RwStreamRead
RwStream* RwStreamWriteInt32 RwStream   stream,
const RwInt32   ints,
RwUInt32    numBytes
 

RwStreamWriteInt32 is used to write the given array of RwInt32 data values to the specified stream. For compatibility across multiple platforms, the data is automatically converted to little-endian format if necessary. This process is reversed upon reading the stream data so no platform-specific conversion is needed.

Parameters:
stream  Pointer to the stream to write to.
ints  Pointer to array of RwInt32 data values.
numBytes  A RwInt32 value equal to the size of the array in bytes. (Use the sizeof operator to ensure portability.)
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamReadInt32 , RwStreamWriteReal , RwStreamReadReal , RwStreamWrite , RwStreamRead
RwStream* RwStreamWriteReal RwStream   stream,
const RwReal   reals,
RwUInt32    numBytes
 

RwStreamWriteReal is used to write the given array of RwReal data values to the specified stream. For compatibility across multiple platforms, the data is automatically converted to little-endian format if necessary. This process is reversed upon reading the stream data so no platform-specific conversion work is needed.

Parameters:
stream  Pointer to the stream to write to.
reals  Pointer to array of RwReal data values.
numBytes  A RwInt32 value equal to the size of the array in bytes. (Use the sizeof operator to ensure portability.)
Returns:
Returns pointer to the stream if successful or NULL if there is an error.
See also:
RwStreamReadReal , RwStreamWriteInt32 , RwStreamReadInt32 , RwStreamWrite , RwStreamRead

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:14 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)