resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::Movie Class Reference

Animation that streams a compressed video file into a set of textures. More...

#include <movie.h>

Inheritance diagram for Rnd::Movie:
Collaboration diagram for Rnd::Movie:

Classes

struct  TrackTexture
 One video track of the file and the texture it plays into. More...

Public Member Functions

 Movie (const HxStr &name)
 Construct a movie with no file, no track textures, and a cleared stream buffer.
virtual ~Movie ()
 Close the file and release every track texture.
virtual void Load (Stream &stream)
 Read the movie record from stream.
virtual void DumpText (Dbg &sink)
 Write a description of this movie to sink.
virtual void Save (Stream &stream)
 Serialise the movie.
virtual void Replace (Object *pFrom, Object *pTo)
 Replace one object reference with another.
virtual const HxStr & ClassName () const
 Report the class key a .rnd file writes for a movie.
virtual void Copy (const Object *pSource, unsigned nFlags)
 Copy another movie over this one.
Tex * FindTrackTexture (int nTrackId) const
 Return the texture of the first entry of mTrackTextures that plays nTrackId.
const HxStr & GetRelativeFilename () const
 Return mFilename relative to FilePath::sRoot.
virtual void SetFrameSelf (float flFrame)
 Advance the movie to a frame.
virtual void Reopen ()
 Reopen the file this movie already names.
void SetFilename (const HxStr &name)
 Set the file this movie plays, under FilePath::sRoot.
void OpenMovieFile ()
 Open the file mFilename names and take a reference on every track texture.
void CloseMovieFile ()
 Release every track texture and destroy the stream reader.
void AttachTrack (int nTrackId)
 Route one track's chunks to this movie.
void DetachTrack (int nTrackId)
 Stop routing one track's chunks anywhere.
void SetTrackTexture (int nTrackId, Tex *pTex)
 Play a track into a texture, replacing any texture the track played into before.
void RemoveTrackTexture (int nTrackId)
 Drop the first entry of mTrackTextures that plays nTrackId, releasing its texture, and detach the track.
void OnChunk (AMovieChunkHdr *pHeader, void *pPayload)
 Draw one video chunk into the texture its track plays into.
Public Member Functions inherited from Rnd::Animatable
 Animatable ()
 Construct an animatable with no children, no filters, and a zero frame.
virtual ~Animatable ()
 Drop this object's references on its children and delete its filters.
Animatable * Parent ()
 Report the animatable that animates this one.
void AddAnim (Animatable *pAnim)
 Append pAnim to mAnims.
void RemoveAnim (Animatable *pAnim)
 Erase pAnim from mAnims.
void SetFrame (float flFrame)
 Drive this object and its whole subtree to a frame.
float UnfilterFrame (float flValue)
 Map a value back through mFilters.
void AddFilter (Filter *pFilter)
 Append an already-built filter to mFilters.
void AddScaleOffset (float flScale, float flOffset)
 Append a new ScaleOffset stage to mFilters.
void AddMinMaxLoop (float flMin, float flMax, int nLoop)
 Append a new MinMaxLoop stage to mFilters.
void AddZeroOrder (float flLevel, float flMaxDelta)
 Append a new ZeroOrder stage to mFilters.
void AddFirstOrder (float flLevel, float flRatio)
 Append a new FirstOrder stage to mFilters.
void AddSecondOrder (float flLevel, float flSpring, float flDamper)
 Append a new SecondOrder stage to mFilters.
void RemoveFilter (int nIndex)
 Delete and erase the filter at one position in mFilters.
Filter * FilterAt (int nIndex)
 Return the filter at one position in mFilters.
void SetRate (float flRate)
 Change the multiplier of the ScaleOffset stage at the front of mFilters.
void SetOffset (float flOffset)
 Change the addend of the ScaleOffset stage at the front of mFilters.
void SetLoopRange (float flMin, float flMax)
 Change both ends of the MinMaxLoop stage at the back of mFilters.
virtual float FilteredFrameEnd ()
 Report the last frame this object's subtree animates to.
virtual void StartAnim ()
 Restart the animation of this object and its whole subtree.
void RemoveAllAnims ()
 Drop this object's reference on every mAnims entry and then empty mAnims.
Public Member Functions inherited from Rnd::Object
 Object ()
 Construct an unnamed object.
 Object (const HxStr &name)
 Construct an object and register it under name.
virtual ~Object ()
 Erase the registry entry and release the name buffer.
void SetName (const HxStr &name)
 Re-register this object under a different name.
void AddRef (Object *pReferrer)
 Register pReferrer as a store of a pointer to this object.
void RemoveRef (Object *pReferrer)
 Drop one registration made by AddRef().

Static Public Member Functions

static void * operator new (size_t nSize)
 Allocate a movie under the tag "Rnd::Movie".
static void operator delete (void *pBlock)
 Release a movie block under the same tag.
static void MasterTrackCallback (AMovieChunkHdr *pHeader, void *pPayload, void *pData)
 The AMovieSet handler AttachTrack() installs, which passes the chunk to pData's OnChunk().
static void ReadTrackTextures (Stream &stream, std::list< TrackTexture > &textures)
 Read a track texture list from stream.
Static Public Member Functions inherited from Rnd::Animatable
static Filter * NewFilter (int nType)
 Build one default-constructed filter for a type tag.

Public Attributes

FilePath mFilename
 File this movie plays, resolved against FilePath::sRoot.
std::list< TrackTexture > mTrackTextures
 Textures the file's tracks play into.
Public Attributes inherited from Rnd::Animatable
float mFilteredFrame
 The frame SetFrame() last received, after the filter chain.
Public Attributes inherited from Rnd::Object
HxStr mName
int mInternal

Additional Inherited Members

Public Types inherited from Rnd::Animatable
enum  FilterType {
  kFilterScaleOffset = 0 , kFilterMinMaxLoop = 1 , kFilterZeroOrder = 2 , kFilterFirstOrder = 3 ,
  kFilterSecondOrder = 4
}
 Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload. More...
Protected Member Functions inherited from Rnd::Object
void ReleaseAllRefs ()
 Tell every referrer to drop its pointer to this object.
Protected Attributes inherited from Rnd::Object
std::list< Object * > mRefs

Detailed Description

Animation that streams a compressed video file into a set of textures.

Its RTTI descriptor is at 0x008efc90. It has Rnd::Animatable as its only public non-virtual base at offset 0. Rnd::Manager::RemapLegacyClassName() rewrites the earlier title TexMovie to Movie for any file below format version 5. The rewrite identifies the class as the texture-streaming one rather than a separate video surface.

The object is 0x458 bytes, which the factory at 0x005d20b8 pins by requesting exactly that many under the tag "Rnd::Movie" at 0x00835ba8. Rnd::Animatable derives from Rnd::Object virtually, so the Rnd::Object subobject is placed last, at +0x43c, which the -0x43c adjustment on every entry of the Rnd::Object vtable below confirms. That subobject is 0x18 bytes, so four bytes of tail padding follow it.

Two vtables belong to the class. The eight-entry table at 0x00835d60 is addressed by the Rnd::Object subobject vptr and overrides seven of the eight Rnd::Object slots. The five-entry table at 0x00835da8 is addressed by the Animatable vptr at +0x14; it inherits FilteredFrameEnd() and StartAnim() from Rnd::Animatable, overrides SetFrameSelf(), and adds the one virtual this class declares. Both tables end in an all-zero terminator entry rather than a slot. Reading the second table's terminator as a slot would have run it into the literal pool that follows it, where the bytes decode as further plausible-looking entries.

A movie plays its file through one Rnd::AMovieSet, which it owns and deletes in CloseMovieFile(). Each track of the file is attached to the texture mTrackTextures names for it, and the stream passes that track's video chunks to OnChunk() as SetFrameSelf() advances it.

Constructor & Destructor Documentation

◆ Movie()

Rnd::Movie::Movie ( const HxStr & name)
explicit

Construct a movie with no file, no track textures, and a cleared stream buffer.

The stream reader starts null, the opened flag clear, and the recorded zone at -1. The routine takes only the object name; the second argument the disassembly shows is the compiler's virtual-base construction flag, which the factory passes as 1.

Parameters
nameThe registry key for this object.
Ghidra address:
NTSC-U/C: 0x005ce3d0
Ghidra address:
PAL: 0x00610330

◆ ~Movie()

virtual Rnd::Movie::~Movie ( )
virtual

Close the file and release every track texture.

Ghidra address:
NTSC-U/C: 0x005ce930
Ghidra address:
PAL: 0x006108a8

Member Function Documentation

◆ Load()

virtual void Rnd::Movie::Load ( Stream & stream)
virtual

Read the movie record from stream.

The first word is the record revision. A revision of 3 or above reports "Can't load new Movie" and abandons the record. The base record follows, then the file is closed, then mFilename is read through FilePath::Load(), which resolves it against FilePath::sRoot. A revision below 2 then reads and discards one byte. The track texture list follows, and the file is reopened from the name just read.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x005d22f8
Ghidra address:
PAL: 0x00614328

Reimplemented from Rnd::Animatable.

◆ DumpText()

virtual void Rnd::Movie::DumpText ( Dbg & sink)
virtual

Write a description of this movie to sink.

Rnd::Object and then Rnd::Animatable describe themselves first. At a positive dump level a "[Movie]" section follows with mFilename and mTrackTextures, the list through the printer at 0x005d15e0.

Parameters
sinkThe text sink.
Ghidra address:
NTSC-U/C: 0x005d21e0
Ghidra address:
PAL: 0x00614210

Reimplemented from Rnd::Animatable.

◆ Save()

virtual void Rnd::Movie::Save ( Stream & stream)
virtual

Serialise the movie.

Writes revision 2, then the Rnd::Animatable record, mFilename relative to FilePath::sRoot, and mTrackTextures through the writer at 0x005d1790.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x005d2280
Ghidra address:
PAL: 0x006142b0

Reimplemented from Rnd::Animatable.

◆ Replace()

virtual void Rnd::Movie::Replace ( Object * pFrom,
Object * pTo )
virtual

Replace one object reference with another.

Forwards to Rnd::Animatable, then retargets every track texture that is pFrom, moving this object's reference, and finally notifies the stream reader.

Parameters
pFromThe object being replaced.
pToThe object to point at, which may be null.
Ghidra address:
NTSC-U/C: 0x005ced80
Ghidra address:
PAL: 0x00610d08

Reimplemented from Rnd::Animatable.

◆ ClassName()

virtual const HxStr & Rnd::Movie::ClassName ( ) const
virtual

Report the class key a .rnd file writes for a movie.

Returns
g_movieClassName.
Ghidra address:
NTSC-U/C: 0x005d2078
Ghidra address:
PAL: 0x006140a8

Implements Rnd::Object.

◆ Copy()

virtual void Rnd::Movie::Copy ( const Object * pSource,
unsigned nFlags )
virtual

Copy another movie over this one.

Narrows the source with a dynamic cast, runs the Rnd::Animatable copy, closes the file, copies mFilename and mTrackTextures, and opens the file again. The cast result is used without a null check, so a source that is not a movie faults.

Parameters
pSourceThe source object.
nFlagsThe copy flags, passed to the base.
Ghidra address:
NTSC-U/C: 0x005d23c8
Ghidra address:
PAL: 0x006143f8

Reimplemented from Rnd::Animatable.

◆ operator new()

void * Rnd::Movie::operator new ( size_t nSize)
static

Allocate a movie under the tag "Rnd::Movie".

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.
Ghidra address:
NTSC-U/C: 0x005d1eb8
Ghidra address:
PAL: 0x00613ee8

◆ operator delete()

void Rnd::Movie::operator delete ( void * pBlock)
static

Release a movie block under the same tag.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x005d1ed8
Ghidra address:
PAL: 0x00613f08

◆ FindTrackTexture()

Tex * Rnd::Movie::FindTrackTexture ( int nTrackId) const

Return the texture of the first entry of mTrackTextures that plays nTrackId.

The routine has no caller in the shipped build, and its name is inferred.

Parameters
nTrackIdThe track to look up.
Returns
The track's texture, or null when no entry plays it.
Ghidra address:
NTSC-U/C: 0x005d2480
Ghidra address:
PAL: 0x006144b0

◆ GetRelativeFilename()

const HxStr & Rnd::Movie::GetRelativeFilename ( ) const

Return mFilename relative to FilePath::sRoot.

The routine has no caller in the shipped build, and its name is inferred.

Returns
The relative path, valid until the next relative path is taken.
Ghidra address:
NTSC-U/C: 0x005d2058
Ghidra address:
PAL: 0x00614088

◆ SetFrameSelf()

virtual void Rnd::Movie::SetFrameSelf ( float flFrame)
virtual

Advance the movie to a frame.

Animatable vtable slot 3.

Parameters
flFrameThe frame to animate to, after this object's filter chain.
Ghidra address:
NTSC-U/C: 0x005cef88
Ghidra address:
PAL: 0x00610f10

Reimplemented from Rnd::Animatable.

◆ Reopen()

virtual void Rnd::Movie::Reopen ( )
virtual

Reopen the file this movie already names.

Animatable vtable slot 4, and the one virtual this class adds. The body is CloseMovieFile() followed by OpenMovieFile() and it takes no argument, so the routine reloads rather than assigning a name. Nothing in the image calls it or overrides it.

Ghidra address:
NTSC-U/C: 0x005d21b0
Ghidra address:
PAL: 0x006141e0

◆ SetFilename()

void Rnd::Movie::SetFilename ( const HxStr & name)

Set the file this movie plays, under FilePath::sRoot.

Hands the name to FilePath::SetFromRoot(), which FilePath::Load() also ends in, so a name set this way and a name read from a file are resolved against the same directory. Neither opens the file; Reopen() does that.

Parameters
nameThe file name, without the .mmv extension the open path appends.
Ghidra address:
NTSC-U/C: 0x005d2190
Ghidra address:
PAL: 0x006141c0

◆ OpenMovieFile()

void Rnd::Movie::OpenMovieFile ( )

Open the file mFilename names and take a reference on every track texture.

Adds this object as a referrer on each track texture first, then returns at once when mFilename is empty. The path is mFilename with ".mmv" appended. A path whose uncompressed length reads as zero reports "Couldn't load movie file: %s" and returns. Otherwise the current zone is recorded, a 0x380-byte stream reader is allocated, and its constructor is run against the path. A constructor that reports an error writes the text from the table at 0x007a8400, indexed by the negative error code, into "Couldn't load movie file %s: %s", then destroys the reader and clears the member.

Ghidra address:
NTSC-U/C: 0x005cebe0
Ghidra address:
PAL: 0x00610b68

◆ CloseMovieFile()

void Rnd::Movie::CloseMovieFile ( )

Release every track texture and destroy the stream reader.

Ghidra address:
NTSC-U/C: 0x005cef00
Ghidra address:
PAL: 0x00610e88

◆ AttachTrack()

void Rnd::Movie::AttachTrack ( int nTrackId)

Route one track's chunks to this movie.

Installs MasterTrackCallback() with this movie as its data. Does nothing when no file is open.

Parameters
nTrackIdThe track.
Ghidra address:
NTSC-U/C: 0x005d24d8
Ghidra address:
PAL: 0x00614508

◆ DetachTrack()

void Rnd::Movie::DetachTrack ( int nTrackId)

Stop routing one track's chunks anywhere.

Does nothing when no file is open.

Parameters
nTrackIdThe track.
Ghidra address:
NTSC-U/C: 0x005d2508
Ghidra address:
PAL: 0x00614538

◆ SetTrackTexture()

void Rnd::Movie::SetTrackTexture ( int nTrackId,
Tex * pTex )

Play a track into a texture, replacing any texture the track played into before.

The texture takes a reference from this movie and is appended to mTrackTextures. With a file open, a texture whose size or depth differs from the track's frame is logged and reconfigured as an 8 bit bitmap of the frame's size. The track is then attached. A null texture only removes the track. The routine has no caller in the shipped build, and its name is inferred.

Parameters
nTrackIdThe track.
pTexThe texture, or null.
Ghidra address:
NTSC-U/C: 0x005cf1f8
Ghidra address:
PAL: 0x006111a0

◆ RemoveTrackTexture()

void Rnd::Movie::RemoveTrackTexture ( int nTrackId)

Drop the first entry of mTrackTextures that plays nTrackId, releasing its texture, and detach the track.

The name is inferred.

Parameters
nTrackIdThe track.
Ghidra address:
NTSC-U/C: 0x005cf3f8
Ghidra address:
PAL: 0x006113c0

◆ OnChunk()

void Rnd::Movie::OnChunk ( AMovieChunkHdr * pHeader,
void * pPayload )

Draw one video chunk into the texture its track plays into.

A palette chunk is copied into mPalette and handed to the texture. A frame chunk's bitmap takes mPalette and is copied onto the locked mip 0 at the chunk's position. A blank chunk fills mip 0 with its colour. A track with no texture is ignored. The name is inferred.

Parameters
pHeaderThe chunk.
pPayloadThe chunk's payload.
Ghidra address:
NTSC-U/C: 0x005cf4c0
Ghidra address:
PAL: 0x00611488

◆ MasterTrackCallback()

void Rnd::Movie::MasterTrackCallback ( AMovieChunkHdr * pHeader,
void * pPayload,
void * pData )
static

The AMovieSet handler AttachTrack() installs, which passes the chunk to pData's OnChunk().

The routine was an orphan in the analysis, and its name is inferred.

Parameters
pHeaderThe chunk.
pPayloadThe chunk's payload.
pDataThe movie.
Ghidra address:
NTSC-U/C: 0x005d2530
Ghidra address:
PAL: 0x00614560

◆ ReadTrackTextures()

void Rnd::Movie::ReadTrackTextures ( Stream & stream,
std::list< TrackTexture > & textures )
static

Read a track texture list from stream.

The first word is the entry count, and the list is resized to it before the entries are read. Each entry is a track id and the object name of its texture, and the name is resolved through Rnd::TheManager and narrowed to Rnd::Tex. A name that resolves to nothing, or to an object that is not a texture, stores a null texture rather than failing the record.

The routine takes no movie. It is placed here because Movie::TrackTexture is the only type it builds, and Load() is its only caller.

Parameters
streamThe stream to read from.
texturesReceives the entries.
Ghidra address:
NTSC-U/C: 0x005d1a90
Ghidra address:
PAL: 0x00613a80

Member Data Documentation

◆ mFilename

FilePath Rnd::Movie::mFilename

File this movie plays, resolved against FilePath::sRoot.

Public because FilePath's routines take its address from outside the hierarchy and the image exposes no accessor. +0x18

◆ mTrackTextures

std::list<TrackTexture> Rnd::Movie::mTrackTextures

Textures the file's tracks play into.

Public because ReadTrackTextures() receives its address from Load() and fills it from outside the class, and the image exposes no accessor. +0x30


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