resonance 1.0.1
Loading...
Searching...
No Matches
saveremixmct.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
10#include "memcard/savefilemct.h"
11#include "os/hxstr.h"
13
14class ListDirOp;
15
16#ifndef VIDEO_STANDARD_PAL
19#endif
20
51#ifdef VIDEO_STANDARD_PAL
52class SaveRemixMCT : public SaveFileMCT, public MemcardUser {
53#else
54class SaveRemixMCT : public MemcardTask, public MemcardUser {
55#endif
56public:
75 Memcard *pCard,
76 int nPortSlot,
77 int nCookie,
78 const HxStr &remixName,
79 const std::vector<FreqAppearance> &appearances,
80 const HxStr &levelName,
81 int nAlbumNum);
82
91 virtual ~SaveRemixMCT();
92
103
120
121#ifndef VIDEO_STANDARD_PAL
132 virtual void OnCheckInfo(CheckInfoOp *pOp);
133#endif
134
145 virtual void OnListDir(ListDirOp *pOp);
146
153 virtual void Finish();
154
163 virtual void Execute();
164
180 virtual void OnFileLoaded(int nStatus);
181
182#ifndef VIDEO_STANDARD_PAL
193 virtual void OnFileSaved(int nStatus);
194#endif
195
196private:
204 static void AppendDirInfo(std::vector<RemixDirInfo> &infos, const HxStr &name, int nEntryCount);
205
212 static HxStr ChooseTargetDir(const std::vector<RemixDirInfo> &infos);
213
221 void ReadNextIndex();
222
230 void ReadTargetIndex();
231
232#ifndef VIDEO_STANDARD_PAL
239 void WritePayload();
240#endif
241
242 // The European release places every member from here on 0x400 bytes further in.
243
244 // Selects the step the bodies run next. Execute() clears it. In the European release it hides
245 // SaveFileMCT::mStep. +0x20
246 int mStep;
247
248 // The status of the step-2 read of the target's index, tested by WriteIndex(). +0x24
249 int mTargetIndexStatus;
250
251 // The directory the index is being read out of. +0x28
252 HxStr mCurrentDir;
253
254 // Every remix save directory the listing found, consumed one per step. +0x30
255 std::vector<HxStr> mDirNames;
256
257 // A summary of every directory the listing found, built one entry per directory. +0x3c
258 std::vector<RemixDirInfo> mDirInfos;
259
260 // The directory the remix lands in. +0x48
261 HxStr mTargetDir;
262
263 // The payload's file name inside mTargetDir. +0x50
264 HxStr mPayloadFileName;
265
266 // The album number the index entry records. +0x58
267 int mAlbumNum;
268
269 // Non-zero once an entry named mRemixName was found. The save then replaces that entry. +0x5c
270 int mReplacing;
271
272 // The remix's name. +0x60
273 HxStr mRemixName;
274
275 // The players' appearances the index entry records. +0x68
276 std::vector<FreqAppearance> mAppearances;
277
278 // The level the remix was built over. +0x74
279 HxStr mLevelName;
280
281 // One index file passes through this stream's buffer at a time. +0x7c
282 IOBPreallocMemStream mStream;
283
284 // The inner read. The destructor deletes it. +0x9c
285 LoadFileMCT *mLoadTask;
286
287#ifndef VIDEO_STANDARD_PAL
288 // The inner save. The destructor deletes it. +0xa0
289 SaveFileMCT *mSaveTask;
290#endif
291};
Enquiry about the card in one slot.
Definition checkinfoop.h:13
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Bidirectional stream over a caller-supplied byte buffer.
Definition iobpreallocmemstream.h:32
Listing of one directory on a card.
Definition listdirop.h:20
Read one file from a card into a caller-supplied buffer.
Definition loadfilemct.h:40
MemcardTask(MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie)
Construct an idle task against one card slot.
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
Write one payload to a card, together with the save directory and its browser icon.
Definition savefilemct.h:114
Write one remix to a card and add it to the index of the directory it lands in.
Definition saveremixmct.h:54
virtual void OnCheckInfo(CheckInfoOp *pOp)
Start the listing unless the card cannot be read or has too little room.
virtual void OnListDir(ListDirOp *pOp)
Collect the listed directories and start the index walk.
virtual void OnFileLoaded(int nStatus)
Advance the index walk, or move from the target's index to the payload write.
virtual void OnFileSaved(int nStatus)
Advance past a finished write, or rewrite the index once the payload has been written.
void ListRemixDir()
List every remix save directory on the card.
virtual void Finish()
Report the finished save through MemcardUser::OnRemixSaved().
virtual ~SaveRemixMCT()
Delete the inner save and the inner read.
void WriteIndex()
Rewrite the target directory's index with the saved remix, and save it.
virtual void Execute()
Enquire about the card and start the save.
SaveRemixMCT(MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie, const HxStr &remixName, const std::vector< FreqAppearance > &appearances, const HxStr &levelName, int nAlbumNum)
Construct an idle remix save.
constexpr int kRemixSaveMinimumFreeClusters
Free clusters a remix save needs, as the card enquiry reports them in CheckInfoOp::mFree.
Definition saveremixmct.h:18