mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
Initial commit
This commit is contained in:
57
arm9/source/patches/platform/LoaderPlatform.h
Normal file
57
arm9/source/patches/platform/LoaderPlatform.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include "SdReadPatchCode.h"
|
||||
#include "SdReadDmaPatchCode.h"
|
||||
#include "SdWritePatchCode.h"
|
||||
#include "../PatchHeap.h"
|
||||
#include "../PatchCodeCollection.h"
|
||||
|
||||
/// @brief Abstract class for platform (flashcard or other sd access method) specific parts of the loader.
|
||||
class LoaderPlatform
|
||||
{
|
||||
public:
|
||||
/// @brief Creates the SD read patch code for the platform.
|
||||
/// @param patchCodeCollection The patch code collection.
|
||||
/// @param patchHeap The patch heap.
|
||||
/// @return A unique pointer to the created SD read patch code.
|
||||
virtual const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const = 0;
|
||||
|
||||
/// @brief Creates the SD read dma patch code for the platform.
|
||||
/// @param patchCodeCollection The patch code collection.
|
||||
/// @param patchHeap The patch heap.
|
||||
/// @return A unique pointer to the created SD read dma patch code.
|
||||
virtual const SdReadDmaPatchCode* CreateSdReadDmaPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr) const { return nullptr; }
|
||||
|
||||
/// @brief Creates the SD write patch code for the platform.
|
||||
/// @param patchCodeCollection The patch code collection.
|
||||
/// @param patchHeap The patch heap.
|
||||
/// @return A unique pointer to the created SD write patch code.
|
||||
virtual const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const = 0;
|
||||
|
||||
/// @brief Creates the rom read patch code for the platform.
|
||||
/// @param patchCodeCollection The patch code collection.
|
||||
/// @param patchHeap The patch heap.
|
||||
/// @return A unique pointer to the created rom read patch code.
|
||||
virtual const SdReadPatchCode* CreateRomReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const { return nullptr; }
|
||||
|
||||
/// @brief Checks if the platform supports rom reads directly.
|
||||
/// @return True if the platform supports rom reads, or false otherwise.
|
||||
virtual bool HasRomReads() const { return false; }
|
||||
|
||||
/// @brief Checks if the platform supports sd reads via dma.
|
||||
/// @return True if the platform supports sd reads via dma, or false otherwise.
|
||||
virtual bool HasDmaSdReads() const { return false; }
|
||||
|
||||
/// @brief Prepares the platform for running a rom.
|
||||
/// @param romDirSector The directory sector of the rom file, or 0 if not applicable.
|
||||
/// @param romDirSectorOffset The byte offset of the rom fat entry in the directory sector.
|
||||
virtual void PrepareRomBoot(u32 romDirSector, u32 romDirSectorOffset) const { }
|
||||
|
||||
/// @brief For platforms that need it this function may be used to (re)initialize the sd card.
|
||||
/// @return True if the sd card initialization was successful, or false otherwise.
|
||||
virtual bool InitializeSdCard() { return true; }
|
||||
};
|
||||
Reference in New Issue
Block a user