#include namespace Replay { // Must be a multiple of REPLAY_BUFFER_CHUNK_SIZE #define REPLAY_BUFFER_SIZE 200704 static uint8 *sp_buffer=NULL; // Allocates the big buffer for storing replays. Never gets deallocated. (Currently) void AllocateBuffer() { if (sp_buffer) { return; } sp_buffer=(uint8*)Mem::Malloc(REPLAY_BUFFER_SIZE); Dbg_MsgAssert(sp_buffer,("Could not allocate replay buffer")); } void DeallocateBuffer() { if (sp_buffer) { Mem::Free(sp_buffer); sp_buffer=NULL; } } uint32 GetBufferSize() { return REPLAY_BUFFER_SIZE; } bool BufferAllocated() { if (sp_buffer) { return true; } return false; } // Reads numBytes out of the buffer starting at offset bufferOffset, into p_dest. // Asserts if there are not enough source bytes. void ReadFromBuffer(uint8 *p_dest, int bufferOffset, int numBytes) { Dbg_MsgAssert(sp_buffer,("Replay buffer has not been allocated")); Dbg_MsgAssert(p_dest,("NULL p_dest sent to Replay::Read()")); Dbg_MsgAssert(bufferOffset>=0 && bufferOffset=0 && bufferOffset=0 && bufferOffset