resonance 1.0.1
Loading...
Searching...
No Matches
memcardtask.h
Go to the documentation of this file.
1#pragma once
2
4
5class Memcard;
6class MemcardUser;
7
9constexpr int kMemcardTaskIdle = 0;
10
12constexpr int kMemcardTaskRunning = 1;
13
15constexpr int kMemcardTaskFinished = 2;
16
40public:
54 MemcardTask(MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie);
55
67 MemcardTask(MemcardUser *pUser, Memcard *pCard, int nCookie)
68 : mUser(pUser), mCard(pCard), mCookie(nCookie), mState(kMemcardTaskIdle) {
69 }
70
77 virtual void Finish() = 0;
78
85 virtual void Execute() = 0;
86
87#ifndef VIDEO_STANDARD_PAL
97 virtual void UnusedHook();
98#endif
99
100 // MemcardManager::Update() reads mState to start an idle task and retire a finished one.
101 friend class MemcardManager;
102
103protected:
115
116 // The receiver Finish() reports to. +0x04
118
119 // The queue this task submits operations to. +0x08
121
122 // The ticket number every queued operation records, drawn by MemcardManager's task factories
123 // from MemcardManager::mTicket. Memcard::Cancel() therefore abandons only this task's work.
124 // +0x0c
126
127 // The packed port and slot. +0x10
129
130 // Zero while idle, 1 once Execute() has run, and 2 once Finish() has run. SaveFileMCT and
131 // LoadFileMCT never write it. Each of those two maintains a separate state member instead.
132 // +0x14
134
135 // One of MemcardStatus, copied from the operation that last reported. +0x18
137};
Receiver notified once a queued memory-card operation has finished.
Definition memcardcbhandler.h:34
int mState
Definition memcardtask.h:133
MemcardTask(MemcardUser *pUser, Memcard *pCard, int nCookie)
Construct an idle task that does not address a single card slot.
Definition memcardtask.h:67
int mCookie
Definition memcardtask.h:125
int mStatus
Definition memcardtask.h:136
void HandleError()
Abandon the task when the last operation reported a failure.
virtual void Finish()=0
Report the finished task to its user and record that it is done.
MemcardTask(MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie)
Construct an idle task against one card slot.
int mPortSlot
Definition memcardtask.h:128
MemcardUser * mUser
Definition memcardtask.h:117
virtual void Execute()=0
Start the task.
Memcard * mCard
Definition memcardtask.h:120
virtual void UnusedHook()
Do nothing.
friend class MemcardManager
Definition memcardtask.h:101
Receiver notified once a memory-card task has finished.
Definition memcarduser.h:24
Queue of memory-card operations, with one entry point per libmc call.
Definition memcard.h:29
constexpr int kMemcardTaskIdle
MemcardTask::mState before Execute() has run.
Definition memcardtask.h:9
constexpr int kMemcardTaskFinished
MemcardTask::mState once Finish() has reported to the user.
Definition memcardtask.h:15
constexpr int kMemcardTaskRunning
MemcardTask::mState while the task is queueing and receiving operations.
Definition memcardtask.h:12