resonance 1.0.1
Loading...
Searching...
No Matches
HxIDataChunk Class Reference

Input stream over the payload of one RIFF or Standard MIDI File chunk. More...

#include <hxidatachunk.h>

Inheritance diagram for HxIDataChunk:
Collaboration diagram for HxIDataChunk:

Public Member Functions

 HxIDataChunk (HxIListChunk *pReader)
 Open the current chunk of a reader, and lock the reader.
 HxIDataChunk (HxStream *pSource)
 Read a chunk header at a stream's read position and open that chunk.
 ~HxIDataChunk () override
 Unlock the reader, if any, and free the header.
void SetMarker (int nOffset, int nWhence) override
 Move the read position within the payload.
int GetMarker () override
 Report the read position within the payload.
int Size () override
 Report the payload size from the chunk header.
HxStream & ReadData (void *pDest, int nSize) override
 Move up to nSize bytes of the payload into pDest.
HxStream * UnderlyingStream () override
 Report the stream the payload lies in.
Public Member Functions inherited from HxStream
virtual ~HxStream ()
 Close the stream.
virtual HxStream & Write (const void *pSrc, int nSize)
 Move nSize bytes out of pSrc.
HxStream & ReadNum (void *pDest, int nSize)
 Move nSize bytes into pDest, reversing their order when the stream swaps bytes.
HxStream & WriteNum (const void *pSrc, int nSize)
 Move nSize bytes out of pSrc, reversing their order when the stream swaps bytes.
HxStream & ReadStr (char *pszDest, int nDestSize)
 Read a string with a variable-length size prefix into a fixed buffer.
HxStream & ReadString (HxStr &str)
 Read a string with a variable-length size prefix into an HxStr.
HxStream * GetRootStream ()
 Follow UnderlyingStream() from this stream until a stream reports none, and report that stream.

Additional Inherited Members

Public Attributes inherited from HxStream
int mSwapBytes
 Non-zero when multi-byte values on the stream are in the opposite byte order.
Static Public Attributes inherited from HxStream
static const int goodbit
 Status value of a stream with nothing wrong.
static const int kStatusEnd
 Status value of a stream whose read position arrived at the end of its data.
static const int failbit
 Status bit a seek outside a chunk's bounds would set.
static const int badbit
 Second status bit GetMarker() and SetMarker() of HxIDataChunk test.
Protected Member Functions inherited from HxStream
 HxStream ()
 Construct a stream with a zeroed state.
Protected Attributes inherited from HxStream
int mStatus
int mFatalOnEnd

Detailed Description

Input stream over the payload of one RIFF or Standard MIDI File chunk.

It derives from HxStream. Its vtable is at 0x007d3ed8. Offsets and sizes are relative to the payload. The payload lies in another stream between mStart and mEnd. Both constructors set mFatalOnEnd and copy HxStream::mSwapBytes from that stream.

SetMarker() sets HxStream::failbit for an offset outside the payload and then overwrites the status with HxStream::goodbit on every path. GetMarker() and SetMarker() still test the range flag.

Constructor & Destructor Documentation

◆ HxIDataChunk() [1/2]

HxIDataChunk::HxIDataChunk ( HxIListChunk * pReader)
explicit

Open the current chunk of a reader, and lock the reader.

The header is a heap copy of the reader's current header, and the payload starts at the source stream's read position.

Parameters
pReaderThe reader positioned on the chunk.
Ghidra address:
NTSC-U/C: 0x00145908
Ghidra address:
PAL: 0x00146420

◆ HxIDataChunk() [2/2]

HxIDataChunk::HxIDataChunk ( HxStream * pSource)
explicit

Read a chunk header at a stream's read position and open that chunk.

Parameters
pSourceThe stream positioned on the chunk header. The chunk does not take ownership.
Ghidra address:
NTSC-U/C: 0x00145a10
Ghidra address:
PAL: 0x00146528

◆ ~HxIDataChunk()

HxIDataChunk::~HxIDataChunk ( )
override

Unlock the reader, if any, and free the header.

Ghidra address:
NTSC-U/C: 0x00146080
Ghidra address:
PAL: 0x00146b98

Member Function Documentation

◆ SetMarker()

void HxIDataChunk::SetMarker ( int nOffset,
int nWhence )
overridevirtual

Move the read position within the payload.

Does nothing while HxStream::failbit or HxStream::badbit is set.

Parameters
nOffsetThe signed distance to move.
nWhenceThe origin, one of the HxStreamSeekOrigin values.
Ghidra address:
NTSC-U/C: 0x00145b20
Ghidra address:
PAL: 0x00146638

Reimplemented from HxStream.

◆ GetMarker()

int HxIDataChunk::GetMarker ( )
overridevirtual

Report the read position within the payload.

Returns
The position from the start of the payload, or -1 while HxStream::failbit or HxStream::badbit is set.
Ghidra address:
NTSC-U/C: 0x001460f0
Ghidra address:
PAL: 0x00146c08

Reimplemented from HxStream.

◆ Size()

int HxIDataChunk::Size ( )
overridevirtual

Report the payload size from the chunk header.

Returns
The size in bytes.
Ghidra address:
NTSC-U/C: 0x00145fc0
Ghidra address:
PAL: 0x00146ad8

Reimplemented from HxStream.

◆ ReadData()

HxStream & HxIDataChunk::ReadData ( void * pDest,
int nSize )
overridevirtual

Move up to nSize bytes of the payload into pDest.

Does nothing unless the status is HxStream::goodbit. A read that would cross the end of the payload moves only the bytes before it and sets HxStream::kStatusEnd.

Parameters
pDestThe destination buffer.
nSizeThe number of bytes to move.
Returns
This stream.
Ghidra address:
NTSC-U/C: 0x00146160
Ghidra address:
PAL: 0x00146c78

Reimplemented from HxStream.

◆ UnderlyingStream()

HxStream * HxIDataChunk::UnderlyingStream ( )
overridevirtual

Report the stream the payload lies in.

Returns
The source stream.
Ghidra address:
NTSC-U/C: 0x00145fd8
Ghidra address:
PAL: 0x00146af0

Reimplemented from HxStream.


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