Isle
Loading...
Searching...
No Matches
mxloopingsmkpresenter.cpp
Go to the documentation of this file.
2
3#include "mxautolock.h"
4#include "mxdsmediaaction.h"
5#include "mxdssubscriber.h"
6
8
9// FUNCTION: LEGO1 0x100b48b0
11{
12 Init();
13}
14
15// FUNCTION: LEGO1 0x100b4950
17{
19}
20
21// FUNCTION: LEGO1 0x100b49b0
22void MxLoopingSmkPresenter::Init()
23{
24 m_elapsedDuration = 0;
27}
28
29// FUNCTION: LEGO1 0x100b49d0
30void MxLoopingSmkPresenter::Destroy(MxBool p_fromDestructor)
31{
33 Init();
35
36 if (!p_fromDestructor) {
38 }
39}
40
41// FUNCTION: LEGO1 0x100b4a00
43{
46 // TODO: struct incorrect, Palette at wrong offset?
47 memset(&m_mxSmk.m_smackTag.Palette[4], 0, sizeof(m_mxSmk.m_smackTag.Palette));
48 }
49}
50
51// FUNCTION: LEGO1 0x100b4a30
53{
54 MxStreamChunk* chunk = NextChunk();
55
58 }
59 else {
60 LoadFrame(chunk);
61 LoopChunk(chunk);
62 m_elapsedDuration += 1000 / ((MxDSMediaAction*) m_action)->GetFramesPerSecond();
63 }
64
66}
67
68// FUNCTION: LEGO1 0x100b4a90
70{
71 if (m_action->GetDuration() < m_elapsedDuration) {
73 }
74 else {
75 MxStreamChunk* chunk;
77 LoadFrame(chunk);
78 m_elapsedDuration += 1000 / ((MxDSMediaAction*) m_action)->GetFramesPerSecond();
79 }
80}
81
82// FUNCTION: LEGO1 0x100b4b00
84{
85 for (MxS16 i = 0; i < m_unk0x5c; i++) {
87 MxStreamChunk* chunk;
89
90 cursor.Last(chunk);
91 MxLong time = chunk->GetTime();
92
93 cursor.First(chunk);
94
95 time -= chunk->GetTime();
96 time += 1000 / ((MxDSMediaAction*) m_action)->GetFramesPerSecond();
97
98 cursor.Reset();
99 while (cursor.Next(chunk)) {
100 chunk->SetTime(chunk->GetTime() + time);
101 }
102
104 }
105
106 MxStreamChunk* chunk;
108
109 if (m_action->GetElapsedTime() < chunk->GetTime()) {
110 break;
111 }
112
113 VTable0x8c();
114
116
118 break;
119 }
120 }
121}
122
123// FUNCTION: LEGO1 0x100b4cd0
125{
128}
129
130// FUNCTION: LEGO1 0x100b4d40
132{
133 Destroy(FALSE);
134}
void Enter()
[AI] Acquires/gains entry to the critical section or mutex, blocking if not available.
void Leave()
[AI] Releases/leaves the critical section or mutex.
virtual MxLong GetDuration()
[AI] Gets the duration for which this action is intended to run.
Definition: mxdsaction.cpp:39
virtual MxLong GetElapsedTime()
[AI] Gets elapsed time for this action since the last time field 0x90 was set.
Definition: mxdsaction.cpp:159
MxLong GetTime()
[AI] Returns the time (timestamp or tick) associated with this chunk. [AI]
Definition: mxdschunk.h:102
MxU16 GetChunkFlags()
[AI] Returns the chunk's flag bitfield. [AI]
Definition: mxdschunk.h:96
void SetTime(MxLong p_time)
[AI] Sets the time (timestamp/tick/frame) associated with this chunk.
Definition: mxdschunk.h:85
MxDSMediaAction extends MxDSAction to add media-specific playback properties and management.
void FreeDataChunk(MxStreamChunk *p_chunk)
[AI] Frees (deletes) a data chunk if it's found in the consumed data list; also forcibly deletes sing...
MxBool Next()
[AI]
MxBool Last(T &p_obj)
[AI]
MxBool Current(T &p_obj)
[AI]
void Reset()
[AI]
Definition: mxlist.h:269
MxBool HasMatch()
[AI]
Definition: mxlist.h:242
MxBool First(T &p_obj)
[AI]
[AI] Presenter for looping Smacker video resources.
void RepeatingTickle() override
[AI] Processes the repeating tickle state, manages looping frame/time logic and state transitions for...
~MxLoopingSmkPresenter() override
[AI] Destructor, releases internal resources and calls cleanup as needed.
void Destroy() override
[AI] General object destruction routine, releases resources and unregisters presenter from the manage...
void NextFrame() override
[AI] Advances to the next frame of the video, managing end of stream logic and frame reloading for lo...
MxResult AddToManager() override
[AI] Adds this presenter to its manager, handling resource/thread safety and registration.
virtual void VTable0x8c()
[AI] Processes looped frame loading and tickle state progression during loop playback.
void VTable0x88() override
[AI] Handles palette resets and frame control at the logical end of a loop.
MxLoopingSmkPresenter()
[AI] Constructs a looping SMK presenter and initializes resources and state.
MxStreamChunk * NextChunk()
[AI] Returns the next data chunk in the stream, removing it from the stream queue.
MxStreamChunkList * m_loopingChunks
[AI] Linked list of all chunks available for looping/repeating playback.
virtual void LoopChunk(MxStreamChunk *p_chunk)
[AI] Adds a chunk to the looping chunk list, making it available for repeated playback.
MxStreamChunkListCursor * m_loopingChunkCursor
[AI] Cursor used to iterate through the loopingChunk list during repeat mode.
MxDSSubscriber * m_subscriber
[AI] Subscriber that provides the stream data (e.g., audio/video chunks) for this presenter.
void ProgressTickleState(TickleState p_tickleState)
[AI] Helper for advancing the presenter's tickle state and updating transition history.
Definition: mxpresenter.h:72
MxDSAction * m_action
[AI] The associated action currently being presented by this presenter.
Definition: mxpresenter.h:211
TickleState m_currentTickleState
[AI] Current state in the tickle lifecycle.
Definition: mxpresenter.h:199
@ e_repeating
[AI] Presentation is repeating (e.g., looping media).
Definition: mxpresenter.h:28
@ e_freezing
[AI] Temporarily suspending updates or playback.
Definition: mxpresenter.h:29
MxCriticalSection m_criticalSection
[AI] Thread synchronization for presenter state and data.
Definition: mxpresenter.h:214
MxSmk m_mxSmk
[AI] Smacker file decoding context holding header, palette, frame types, and decode buffers.
void LoadFrame(MxStreamChunk *p_chunk) override
[AI] Loads and renders a Smacker video frame from a stream chunk.
MxResult AddToManager() override
[AI] Registers this presenter instance with the video presentation manager.
void Destroy() override
[AI] Cleans up and destroys the resources used by this presenter.
MxU32 m_currentFrame
[AI] Current frame index within the Smacker stream.
[AI] Cursor for iterating over a MxStreamChunkList.
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
Definition: mxstreamchunk.h:19
void SetBit2(BOOL p_e)
void SetBit1(BOOL p_e)
MxS16 m_unk0x5c
Loop/advance/frame decode counter. [AI].
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
Definition: mxautolock.h:5
#define DS_CHUNK_END_OF_STREAM
[AI] Flag bit indicating this chunk is the last in its stream.
Definition: mxdschunk.h:14
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
signed short MxS16
[AI]
Definition: mxtypes.h:26
SmackTag m_smackTag
[AI] Metadata block from the Smacker file header.
Definition: mxsmk.h:78
u8 Palette[772]
Definition: smack.h:49
u32 Frames
Definition: smack.h:37