kodi
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KODI::RETRO::CLinearMemoryStream Class Referenceabstract
Inheritance diagram for KODI::RETRO::CLinearMemoryStream:
Inheritance graph
[legend]
Collaboration diagram for KODI::RETRO::CLinearMemoryStream:
Collaboration graph
[legend]

Public Member Functions

void Init (size_t frameSize, uint64_t maxFrameCount) override
 Initialize memory stream. More...
 
void Reset () override
 Free any resources used by this stream.
 
size_t FrameSize () const override
 Return the frame size passed to Init()
 
uint64_t MaxFrameCount () const override
 Return the current max frame count.
 
void SetMaxFrameCount (uint64_t maxFrameCount) override
 Update the max frame count. More...
 
uint8_t * BeginFrame () override
 
void SubmitFrame () override
 Indicate that a frame of size FrameSize() has been written to the location returned from BeginFrame()
 
const uint8_t * CurrentFrame () const override
 Get a pointer to the current frame. More...
 
uint64_t FutureFramesAvailable () const override
 Return the number of frames ahead of the current frame. More...
 
uint64_t AdvanceFrames (uint64_t frameCount) override
 Seek ahead the specified number of frames. More...
 
uint64_t PastFramesAvailable () const override=0
 Return the number of frames behind the current frame.
 
uint64_t RewindFrames (uint64_t frameCount) override=0
 Seek backwards the specified number of frames. More...
 
uint64_t GetFrameCounter () const override
 Get the total number of frames played until the current frame. More...
 
void SetFrameCounter (uint64_t frameCount) override
 Set the total number of frames played until the current frame. More...
 

Protected Member Functions

virtual void SubmitFrameInternal ()=0
 
virtual void CullPastFrames (uint64_t frameCount)=0
 
uint64_t BufferSize () const
 

Protected Attributes

size_t m_paddedFrameSize
 
uint64_t m_maxFrames
 
std::unique_ptr< uint32_t[]> m_currentFrame
 Simple double-buffering. More...
 
std::unique_ptr< uint32_t[]> m_nextFrame
 
bool m_bHasCurrentFrame
 
bool m_bHasNextFrame
 
uint64_t m_currentFrameHistory
 

Member Function Documentation

◆ AdvanceFrames()

uint64_t KODI::RETRO::CLinearMemoryStream::AdvanceFrames ( uint64_t  frameCount)
inlineoverridevirtual

Seek ahead the specified number of frames.

Returns
The number of frames advanced

Implements KODI::RETRO::IMemoryStream.

◆ BeginFrame()

uint8_t * CLinearMemoryStream::BeginFrame ( )
overridevirtual

\ brief Get a pointer to which FrameSize() bytes can be written

The buffer exposed by this function is passed to the game client, which fills it with a serialization of its current state.

Implements KODI::RETRO::IMemoryStream.

◆ CurrentFrame()

const uint8_t * CLinearMemoryStream::CurrentFrame ( ) const
overridevirtual

Get a pointer to the current frame.

This function must have no side effects. The pointer is valid until the stream is modified.

Returns
A buffer of size FrameSize(), or nullptr if the stream is empty

Implements KODI::RETRO::IMemoryStream.

◆ FutureFramesAvailable()

uint64_t KODI::RETRO::CLinearMemoryStream::FutureFramesAvailable ( ) const
inlineoverridevirtual

Return the number of frames ahead of the current frame.

If the stream supports forward seeking, frames that are passed over during a "rewind" operation can be recovered again.

Implements KODI::RETRO::IMemoryStream.

◆ GetFrameCounter()

uint64_t KODI::RETRO::CLinearMemoryStream::GetFrameCounter ( ) const
inlineoverridevirtual

Get the total number of frames played until the current frame.

Returns
The history of the current frame, or 0 for unknown

Implements KODI::RETRO::IMemoryStream.

◆ Init()

void CLinearMemoryStream::Init ( size_t  frameSize,
uint64_t  maxFrameCount 
)
overridevirtual

Initialize memory stream.

Parameters
frameSizeThe size of the serialized memory state
maxFrameCountThe maximum number of frames this stream can hold

Implements KODI::RETRO::IMemoryStream.

◆ RewindFrames()

uint64_t KODI::RETRO::CLinearMemoryStream::RewindFrames ( uint64_t  frameCount)
overridepure virtual

Seek backwards the specified number of frames.

Returns
The number of frames rewound

Implements KODI::RETRO::IMemoryStream.

Implemented in KODI::RETRO::CDeltaPairMemoryStream.

◆ SetFrameCounter()

void KODI::RETRO::CLinearMemoryStream::SetFrameCounter ( uint64_t  frameCount)
inlineoverridevirtual

Set the total number of frames played until the current frame.

Parameters
frameCountThe history of the current frame

Implements KODI::RETRO::IMemoryStream.

◆ SetMaxFrameCount()

void CLinearMemoryStream::SetMaxFrameCount ( uint64_t  maxFrameCount)
overridevirtual

Update the max frame count.

Old frames may be deleted if the max frame count is reduced.

Implements KODI::RETRO::IMemoryStream.

Member Data Documentation

◆ m_currentFrame

std::unique_ptr<uint32_t[]> KODI::RETRO::CLinearMemoryStream::m_currentFrame
protected

Simple double-buffering.

After XORing the two states, the next becomes the current, and the current becomes a buffer for the next call to CGameClient::Serialize().


The documentation for this class was generated from the following files: