Files
pico-loader/arm9/source/patches/platform/dstt/DsttLoaderPlatform.h
2026-05-10 09:37:38 +02:00

64 lines
2.3 KiB
C++

#pragma once
#include "../LoaderPlatform.h"
#include "DsttReadSdPatchCode.h"
#include "DsttReadSdDmaPatchCode.h"
#include "DsttWriteSdPatchCode.h"
#include "DsttSdStopTransmissionPatchCode.h"
#include "DsttReadSdHelperPatchCode.h"
/// @brief Implementation of LoaderPlatform for the DSTT flashcard
class DsttLoaderPlatform : public LoaderPlatform
{
public:
const IReadSectorsPatchCode* CreateSdReadPatchCode(
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
{
return patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttReadSdPatchCode(patchHeap,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttSdStopTransmissionPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttReadSdHelperPatchCode(patchHeap);
}));
});
}
const IReadSectorsDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr) const override
{
return patchCodeCollection.AddUniquePatchCode<DsttReadSdDmaPatchCode>(
patchHeap, miiCardDmaCopy32Ptr,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttSdStopTransmissionPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttReadSdHelperPatchCode(patchHeap);
}));
}
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
{
return patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttWriteSdPatchCode(patchHeap,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new DsttWriteSdContinuePatchCode(patchHeap);
}));
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool HasDmaSdReads() const override { return true; }
bool InitializeSdCard() override;
};