wavelength 1.0.0
Loading...
Searching...
No Matches
mcmanager.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include "game/campaign.h"
7#include "game/gameoptions.h"
8#include "game/remixinfo.h"
25#include "memcard/memcarduser.h"
26
36class MCManager {
37public:
39 MCManager() : mUser(nullptr) {
40 }
41
50 void Init();
51
58 void Terminate();
59
68 void InitialCheck(MemcardUser *pUser, int nSlot);
69
79 void GetCardStatus(MemcardUser *pUser, int nSlot);
80
94 MemcardUser *pUser, int nSlot, Campaign *pProfile, const char *pszOldName, int nOverwrite);
95
105 void LoadFreqs(MemcardUser *pUser, int nSlot);
106
116 void DeleteFreq(MemcardUser *pUser, int nSlot, const char *pszName);
117
130 void
131 SaveRemix(MemcardUser *pUser, int nSlot, RemixInfo *pInfo, const void *pData, int nOverwrite);
132
144 void LoadRemix(MemcardUser *pUser, int nSlot, const char *pszName, void *pBuffer, int nSize);
145
155 void ListRemixes(MemcardUser *pUser, int nSlot);
156
166 void DeleteRemix(MemcardUser *pUser, int nSlot, const char *pszName);
167
178 void SaveSettings(MemcardUser *pUser, int nSlot, GameOptions *pSettings, int nOverwrite);
179
189 void LoadSettings(MemcardUser *pUser, int nSlot);
190
200 void ListNetConfigs(MemcardUser *pUser, int nSlot);
201
210 void FormatCard(MemcardUser *pUser, int nSlot);
211
225 int nSlot,
226 const char *pszName,
227 const void *pData,
228 int nSize,
229 bool bReserved);
230
240 void Poll();
241
250 const char *GetSlotName(int nSlot);
251
253 const std::vector<Campaign> &GetProfiles() const {
254 return mProfiles;
255 }
256
258 const std::vector<RemixInfo> &GetRemixInfos() const {
259 return mRemixInfos;
260 }
261
263 const GameOptions &GetSettings() const {
264 return mSettings;
265 }
266
267private:
268 MemcardUser *mUser;
269 std::unique_ptr<MCInitialCheckTask> mInitialCheck;
270 std::unique_ptr<MCCardStatusTask> mCardStatus;
271 std::unique_ptr<MCSaveFreqTask> mSaveFreq;
272 std::unique_ptr<MCLoadFreqsTask> mLoadFreqs;
273 std::unique_ptr<MCDeleteFreqTask> mDeleteFreq;
274 std::unique_ptr<MCSaveRemixTask> mSaveRemix;
275 std::unique_ptr<MCLoadRemixTask> mLoadRemix;
276 std::unique_ptr<MCListRemixesTask> mListRemixes;
277 std::unique_ptr<MCDeleteRemixTask> mDeleteRemix;
278 std::unique_ptr<MCSaveSettingsTask> mSaveSettings;
279 std::unique_ptr<MCLoadSettingsTask> mLoadSettings;
280 std::unique_ptr<MCSaveDataTask> mSaveData;
281 std::unique_ptr<MCFormatCardTask> mFormatCard;
282 std::unique_ptr<MCUnformatCardTask> mUnformatCard;
283 std::unique_ptr<MCListNetConfigsTask> mListNetConfigs;
284 MemcardSerialTask *mCurrentTask;
285 std::vector<Campaign> mProfiles;
286 std::vector<RemixInfo> mRemixInfos;
287 GameOptions mSettings;
288 std::vector<int> mReserved80; // +0x80, emptied by ClearResults() and never read.
289
298 void StartTask(MemcardSerialTask *pTask, MemcardUser *pUser);
299
306 void ClearTask();
307
314 void ClearResults();
315};
316
Saved settings and progress of one player, among them the controller bindings.
Definition campaign.h:20
The settings of the game options screen, which are saved apart from the players to the settings file ...
Definition gameoptions.h:13
Front end of the memory card work.
Definition mcmanager.h:36
void GetCardStatus(MemcardUser *pUser, int nSlot)
Start learning whether a usable card is in a slot.
void SaveFile(MemcardUser *pUser, int nSlot, const char *pszName, const void *pData, int nSize, bool bReserved)
Start saving a block of memory to a file.
const std::vector< RemixInfo > & GetRemixInfos() const
Definition mcmanager.h:258
void InitialCheck(MemcardUser *pUser, int nSlot)
Start checking a card at startup.
void Terminate()
Destroy the tasks Init() built, and release the configuration buffers.
void ListRemixes(MemcardUser *pUser, int nSlot)
Start reading the descriptions of the saved remixes into mRemixInfos.
void DeleteFreq(MemcardUser *pUser, int nSlot, const char *pszName)
Start deleting a saved Freq.
void SaveSettings(MemcardUser *pUser, int nSlot, GameOptions *pSettings, int nOverwrite)
Start saving the settings.
void SaveFreq(MemcardUser *pUser, int nSlot, Campaign *pProfile, const char *pszOldName, int nOverwrite)
Start saving the Freq of a profile.
MCManager()
Construct a manager with no task running.
Definition mcmanager.h:39
const std::vector< Campaign > & GetProfiles() const
Definition mcmanager.h:253
void Poll()
Report the end of the running task to its user, and stop the task.
void LoadSettings(MemcardUser *pUser, int nSlot)
Start loading the settings into mSettings.
void Init()
Read the memory card configuration and build the tasks.
const GameOptions & GetSettings() const
Definition mcmanager.h:263
void LoadRemix(MemcardUser *pUser, int nSlot, const char *pszName, void *pBuffer, int nSize)
Start loading a saved remix.
void LoadFreqs(MemcardUser *pUser, int nSlot)
Start loading every saved Freq into mProfiles.
void DeleteRemix(MemcardUser *pUser, int nSlot, const char *pszName)
Start deleting a saved remix.
void FormatCard(MemcardUser *pUser, int nSlot)
Start formatting an unformatted card.
const char * GetSlotName(int nSlot)
Report the localised name of a memory card slot.
void SaveRemix(MemcardUser *pUser, int nSlot, RemixInfo *pInfo, const void *pData, int nOverwrite)
Start saving a remix.
void ListNetConfigs(MemcardUser *pUser, int nSlot)
Start listing the network configurations.
Memory card work made of MemcardTask steps that run one after another.
Definition memcardserialtask.h:13
Receiver of the outcome of the memory card work MCManager runs.
Definition memcarduser.h:19
Description of a saved remix.
Definition remixinfo.h:26
MCManager TheMCManager
The memory card front end.