Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RwPlugin
[Initialization & Resource Management]


Typedefs

typedef RwStream *(*  RwPluginDataChunkWriteCallBack )(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
typedef RwStream *(*  RwPluginDataChunkReadCallBack )(RwStream *stream, RwInt32 binaryLength, void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
typedef RwInt32(*  RwPluginDataChunkGetSizeCallBack )(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
typedef RwBool(*  RwPluginDataChunkAlwaysCallBack )(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
typedef RwBool(*  RwPluginDataChunkRightsCallBack )(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject, RwUInt32 extraData)
typedef void *(*  RwPluginObjectConstructor )(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
typedef void *(*  RwPluginObjectCopy )(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject)
typedef void *(*  RwPluginObjectDestructor )(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)

Functions

void  RwPluginRegistrySetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)

Detailed Description

Plugin management

RwPlugin Overview

Requirements

Overview

Plugin attachment API.

RwPlugin provides an API to extend a base object with additional data to provide extra functionality. All of RenderWare's plugins extends their base object using this method.

A base object is extended by registering a unique ID along with the custom data size and a set of callbacks. For example, see RwCameraRegisterPlugin and RwCameraRegisterPluginStream. This reserves memory in the base object's memory block and attaches the callbacks to be called for general object management, such as creation and destruction. The callbacks and data size are optional. A plugin does not have to reserve memory area in the base object's memory block or provide callbacks to a particular function, such as streaming, if it is not required.

All instances of the base object will have the custom data. The custom data cannot vary in size between instances of the base object because it is embedded within the base object's memory block. If the custom data can vary in size, then this must be stored in an external memory block and referenced via a pointer within the base object's memory block.


Typedef Documentation

typedef RwBool(* RwPluginDataChunkAlwaysCallBack)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginDataChunkAlwaysCallBack represents the callback registered by RwCameraSetStreamAlwaysCallBack, etc. as the function that is called after the reading of plugin stream data is finished (useful to set up plugin data for plugins that found no data in the stream, but that cannot set up the data during the RwPluginObjectConstructor callback).

Parameters:
object  Pointer to the object containing the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
Returns TRUE if successful, FALSE otherwise.
typedef RwInt32(* RwPluginDataChunkGetSizeCallBack)(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginDataChunkGetSizeCallBack represents the callback registered by RwCameraRegisterPluginStream, etc. as the function that determines the binary size of the extension data.

Parameters:
object  Pointer to the object containing the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
A RwInt32 value equal to the size in bytes of the plugin extension data.
typedef RwStream*(* RwPluginDataChunkReadCallBack)(RwStream *stream, RwInt32 binaryLength, void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginDataChunkReadCallBack represents the function registered by RwCameraRegisterPluginStream, etc. as the function that reads extension data from a binary stream.

Parameters:
stream  Pointer to the binary stream
binaryLength  A RwInt32 value equal to the binary size (in bytes) of the extension data that will be read from a binary stream.
object  Pointer to the object containing the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
Pointer to the stream
typedef RwBool(* RwPluginDataChunkRightsCallBack)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject, RwUInt32 extraData)
 

RwPluginDataChunkRightsCallBack represents the callback registered by RwCameraSetStreamRightsCallBack, etc. as the function that is called after the reading of plugin stream data is finished, and the object finalised, if and only if the object's rights id was equal to that of the plugin registering the call. For convience the extension data is passed to the callback.

Parameters:
object  Pointer to the object containing the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
extraData  An RwUInt32 writen with the plugin id.
Returns:
Returns TRUE if successful, FALSE otherwise.
typedef RwStream*(* RwPluginDataChunkWriteCallBack)(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginDataChunkWriteCallBack represents the function registered by RwCameraRegisterPluginStream, etc. as the function that writes extension data to a binary stream.

Parameters:
stream  Pointer to the binary stream
binaryLength  A RwInt32 value equal to the binary size (in bytes) of the extension data that will be written to the binary stream.
object  Pointer to the object containing the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
Pointer to the stream
typedef void*(* RwPluginObjectConstructor)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginObjectConstructor represents the callback registered by RwEngineRegisterPlugin, RwCameraRegisterPlugin, etc. as the function that initializes either the global extension data (in the case of RwEngineRegisterPlugin) or the object extension data (in all other cases). Registered by RwCameraSetStreamAlwaysCallBack, etc.

Parameters:
object  Pointer to the object (global or otherwise) that contains the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
Pointer to the object
typedef void*(* RwPluginObjectCopy)(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginObjectCopy represents the callback registered by RwCameraRegisterPlugin, etc. as the function that copies the object extension data when an object is duplicated.

Parameters:
dstObject  Pointer to the destination object that will receive the extension data.
srcObject  Pointer to the source object containing extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
Pointer to the object
typedef void*(* RwPluginObjectDestructor)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
 

RwPluginObjectDestructor represents the callback registered by RwEngineRegisterPlugin, RwCameraRegisterPlugin, etc. as the function that destroys either the global extension data (in the case of RwEngineRegisterPlugin) or the object extension data (in all other cases).

Parameters:
object  Pointer to the object (global or otherwise) containing the extension data.
offsetInObject  A RwInt32 value equal to the byte offset of the extension data in the object.
sizeInObject  A RwInt32 value equal to the size (in bytes) of the extension data.
Returns:
Pointer to the object.

Function Documentation

void RwPluginRegistrySetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RwPluginRegistrySetFreeListCreateParams allows the developer to specify how many RwPluginRegEntry 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

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