Initial commit

This commit is contained in:
Gericom
2025-11-22 11:08:28 +01:00
commit 9cf3ffbfcf
358 changed files with 58350 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
#pragma once
#include "common.h"
#include "../LoaderPlatform.h"
#include "SuperCardCommon.h"
#include "sclite/SuperCardLiteImpl.h"
#include "scsd/SuperCardSDImpl.h"
/// @brief Implementation of LoaderPlatform for the slot 2 SuperCard flashcard
class SuperCardLoaderPlatform : public LoaderPlatform
{
public:
const SdReadPatchCode* CreateSdReadPatchCode(
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
{
if (isScLite)
{
return patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardReadSectorLitePatchCode(patchHeap,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardCommonPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardSDCommandAndDropLitePatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardReadDataLitePatchCode(patchHeap);
})
);
});
}
else
{
return patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardReadSectorPatchCode(patchHeap,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardCommonPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardSdCommandAndDropPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardReadDataPatchCode(patchHeap);
})
);
});
}
}
const SdWritePatchCode* CreateSdWritePatchCode(
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
{
if (isScLite)
{
return patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardWriteSectorLitePatchCode(patchHeap,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardCommonPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardSDCommandAndDropLitePatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardWriteDataLitePatchCode(patchHeap);
})
);
});
}
else
{
return patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardWriteSectorPatchCode(patchHeap,
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardCommonPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardSdCommandAndDropPatchCode(patchHeap);
}),
patchCodeCollection.GetOrAddSharedPatchCode([&]
{
return new SuperCardWriteDataPatchCode(patchHeap);
})
);
});
}
}
bool InitializeSdCard() override;
private:
u16 isScLite = false;
bool InitializeSdCardIntern();
};