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

Cursor over the chunks inside one RIFF list or Standard MIDI File. More...

#include <hxilistchunk.h>

Collaboration diagram for HxIListChunk:

Public Member Functions

 HxIListChunk (HxStream *pStream, bool bReadHeader)
 Open a reader on a stream at its read position.
 HxIListChunk (HxIListChunk *pParent)
 Open a reader on the chunks inside the current chunk of another reader, and lock it.
 ~HxIListChunk ()
 Unlock the parent reader, if any, and free the enclosing header.
void Init ()
 Compute mEnd from the enclosing header, lock the parent reader, if any, and reset.
void Reset ()
 Seek back to the first chunk and forget the current one.
HxChunkHeader * Next ()
 Advance to the next chunk and read its header.
HxChunkHeader * CurSubChunkHeader ()
 Report the current chunk header.
HxChunkHeader * Next (const HxChunkName &name)
 Advance until a chunk with the given name is current.
void Lock ()
 Mark the reader as having a nested reader or chunk open.
void Unlock ()
 Clear the mark Lock() sets.

Public Attributes

HxIListChunk * mParent
HxStream * mStream
HxChunkHeader * mHeader
int mStart
int mEnd
int mLocked
HxChunkHeader mCurrent
int mHasCurrent
int mAtStart
int mNext

Detailed Description

Cursor over the chunks inside one RIFF list or Standard MIDI File.

The class is not polymorphic and has no RTTI. Its name comes from the debugging symbols of the North American demo release. The reader walks the chunk headers between mStart and mEnd on a shared HxStream, seeking to each header in turn. Opening a nested reader or an HxIDataChunk on the current chunk locks the parent reader, and destroying the nested object unlocks it. No routine tests mLocked.

Every member is public, because HxIDataChunk and Mid::Reader read the fields directly and the image exposes no accessor.

Constructor & Destructor Documentation

◆ HxIListChunk() [1/2]

HxIListChunk::HxIListChunk ( HxStream * pStream,
bool bReadHeader )

Open a reader on a stream at its read position.

With bReadHeader set, the reader reads the chunk header at the read position and walks the chunks inside it. Otherwise the reader treats the rest of the stream as one LIST whose size is HxStream::Size() less HxStream::GetMarker().

Parameters
pStreamThe stream to read. The reader does not take ownership.
bReadHeaderRead an enclosing chunk header first.
Ghidra address:
NTSC-U/C: 0x00145c40
Ghidra address:
PAL: 0x00146758

◆ HxIListChunk() [2/2]

HxIListChunk::HxIListChunk ( HxIListChunk * pParent)
explicit

Open a reader on the chunks inside the current chunk of another reader, and lock it.

The enclosing header is a heap copy of pParent's current header.

Parameters
pParentThe reader whose current chunk is a list.
Ghidra address:
NTSC-U/C: 0x00146220
Ghidra address:
PAL: 0x00146d38

◆ ~HxIListChunk()

HxIListChunk::~HxIListChunk ( )

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

Ghidra address:
NTSC-U/C: 0x00146308
Ghidra address:
PAL: 0x00146e20

Member Function Documentation

◆ Init()

void HxIListChunk::Init ( )

Compute mEnd from the enclosing header, lock the parent reader, if any, and reset.

Ghidra address:
NTSC-U/C: 0x00146360
Ghidra address:
PAL: 0x00146e78

◆ Reset()

void HxIListChunk::Reset ( )

Seek back to the first chunk and forget the current one.

Ghidra address:
NTSC-U/C: 0x001463b0
Ghidra address:
PAL: 0x00146ec8

◆ Next() [1/2]

HxChunkHeader * HxIListChunk::Next ( )

Advance to the next chunk and read its header.

The next chunk begins after the header and payload of this one. Every chunk except an MTrk track is padded to an even size.

Returns
The new current header, or null once the enclosing chunk is exhausted.
Ghidra address:
NTSC-U/C: 0x00145db8
Ghidra address:
PAL: 0x001468d0

◆ CurSubChunkHeader()

HxChunkHeader * HxIListChunk::CurSubChunkHeader ( )

Report the current chunk header.

Returns
The current header, or null before the first Next() or after the last.
Ghidra address:
NTSC-U/C: 0x00146408
Ghidra address:
PAL: 0x00146f20

◆ Next() [2/2]

HxChunkHeader * HxIListChunk::Next ( const HxChunkName & name)

Advance until a chunk with the given name is current.

The search starts from the chunk after the current one and does not rewind.

Parameters
nameThe chunk name, or a list's form type.
Returns
The matching header, or null when no later chunk matches.
Ghidra address:
NTSC-U/C: 0x00146428
Ghidra address:
PAL: 0x00146f40

◆ Lock()

void HxIListChunk::Lock ( )

Mark the reader as having a nested reader or chunk open.

Ghidra address:
NTSC-U/C: 0x001464a0
Ghidra address:
PAL: 0x00146fb8

◆ Unlock()

void HxIListChunk::Unlock ( )

Clear the mark Lock() sets.

Ghidra address:
NTSC-U/C: 0x001464b0
Ghidra address:
PAL: 0x00146fc8

Member Data Documentation

◆ mParent

HxIListChunk* HxIListChunk::mParent

The enclosing reader, or null for a top-level reader. +0x00

◆ mStream

HxStream* HxIListChunk::mStream

The stream every chunk lies in. +0x04

◆ mHeader

HxChunkHeader* HxIListChunk::mHeader

Heap header of the enclosing chunk. +0x08

◆ mStart

int HxIListChunk::mStart

Stream position of the first chunk. +0x0c

◆ mEnd

int HxIListChunk::mEnd

Stream position after the last chunk. +0x10

◆ mLocked

int HxIListChunk::mLocked

Non-zero while a nested reader or chunk is open. +0x14

◆ mCurrent

HxChunkHeader HxIListChunk::mCurrent

Header of the current chunk. +0x18

◆ mHasCurrent

int HxIListChunk::mHasCurrent

Non-zero while mCurrent is valid. +0x24

◆ mAtStart

int HxIListChunk::mAtStart

Non-zero from Reset() until the first Next(). +0x28

◆ mNext

int HxIListChunk::mNext

Stream position of the next chunk header. +0x2c


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