mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
Refactored platform code to use interfaces for patch code with a special feature and improved patch code file names
This commit is contained in:
@@ -1,28 +1,26 @@
|
||||
#pragma once
|
||||
#include "../PatchCode.h"
|
||||
|
||||
/// @brief Abstract base class for patch code implementing dma SD reads
|
||||
class SdReadDmaPatchCode : public PatchCode
|
||||
/// @brief Abstract base class for patch code implementing dma sector reads
|
||||
class IReadSectorsDmaPatchCode
|
||||
{
|
||||
protected:
|
||||
SdReadDmaPatchCode(const void* code, u32 size, PatchHeap& patchHeap)
|
||||
: PatchCode(code, size, patchHeap) { }
|
||||
IReadSectorsDmaPatchCode() { }
|
||||
|
||||
public:
|
||||
/// @brief Pointer to a function for reading a single SD sector using the given dmaChannel.
|
||||
/// In first sector of batch read, previousSrcSector will be 0.
|
||||
/// On further reads previousSrcSector will contains the previous srcSector
|
||||
/// which can be used to continue a sequential read.
|
||||
typedef void (*SdReadDmaFunc)(u32 srcSector, u32 previousSrcSector, u32 dmaChannel, void* dst);
|
||||
typedef void (*ReadSectorsDmaFunc)(u32 srcSector, u32 previousSrcSector, u32 dmaChannel, void* dst);
|
||||
|
||||
/// @brief Pointer to a function for finishing a batch of dma reads.
|
||||
typedef void (*SdReadDmaFinishFunc)(void);
|
||||
typedef void (*ReadSectorsDmaFinishFunc)(void);
|
||||
|
||||
/// @brief Gets a pointer to the dma SD read function in the patch code.
|
||||
/// @return The pointer to the dma SD read function.
|
||||
virtual const SdReadDmaFunc GetSdReadDmaFunction() const = 0;
|
||||
virtual const ReadSectorsDmaFunc GetSdReadDmaFunction() const = 0;
|
||||
|
||||
/// @brief Gets a pointer to the dma SD read finish function in the patch code.
|
||||
/// @return The pointer to the dma SD read finish function.
|
||||
virtual const SdReadDmaFinishFunc GetSdReadDmaFinishFunction() const = 0;
|
||||
virtual const ReadSectorsDmaFinishFunc GetSdReadDmaFinishFunction() const = 0;
|
||||
};
|
||||
17
arm9/source/patches/platform/IReadSectorsPatchCode.h
Normal file
17
arm9/source/patches/platform/IReadSectorsPatchCode.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
/// @brief Abstract base class for patch code implementing sector reads
|
||||
class IReadSectorsPatchCode
|
||||
{
|
||||
protected:
|
||||
IReadSectorsPatchCode() { }
|
||||
|
||||
public:
|
||||
/// @brief Pointer to a function for reading sectorCount sectors
|
||||
/// from srcSector to the given dst buffer.
|
||||
typedef void (*ReadSectorsFunc)(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
/// @brief Gets a pointer to the sector read function in the patch code.
|
||||
/// @return The pointer to the sector read function.
|
||||
virtual const ReadSectorsFunc GetReadSectorsFunction() const = 0;
|
||||
};
|
||||
17
arm9/source/patches/platform/IWriteSectorsPatchCode.h
Normal file
17
arm9/source/patches/platform/IWriteSectorsPatchCode.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
/// @brief Abstract base class for patch code implementing sector writes
|
||||
class IWriteSectorsPatchCode
|
||||
{
|
||||
protected:
|
||||
IWriteSectorsPatchCode() { }
|
||||
|
||||
public:
|
||||
/// @brief Pointer to a function for writing sectorCount sectors
|
||||
/// from the given src buffer to dstSector.
|
||||
typedef void (*WriteSectorsFunc)(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
/// @brief Gets a pointer to the sector write function in the patch code.
|
||||
/// @return The pointer to the sector write function.
|
||||
virtual const WriteSectorsFunc GetWriteSectorFunction() const = 0;
|
||||
};
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include "SdReadPatchCode.h"
|
||||
#include "SdReadDmaPatchCode.h"
|
||||
#include "SdWritePatchCode.h"
|
||||
#include "IReadSectorsPatchCode.h"
|
||||
#include "IReadSectorsDmaPatchCode.h"
|
||||
#include "IWriteSectorsPatchCode.h"
|
||||
#include "../PatchHeap.h"
|
||||
#include "../PatchCodeCollection.h"
|
||||
#include "LoaderPlatformType.h"
|
||||
@@ -14,29 +13,29 @@ 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(
|
||||
/// @return A pointer to the created SD read patch code.
|
||||
virtual const IReadSectorsPatchCode* 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(
|
||||
/// @return A pointer to the created SD read dma patch code.
|
||||
virtual const IReadSectorsDmaPatchCode* 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(
|
||||
/// @return A pointer to the created SD write patch code.
|
||||
virtual const IWriteSectorsPatchCode* 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(
|
||||
/// @return A pointer to the created rom read patch code.
|
||||
virtual const IReadSectorsPatchCode* CreateRomReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const { return nullptr; }
|
||||
|
||||
/// @brief Returns the type of this loader platform.
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#include "patches/platform/ace3ds/Ace3DSLoaderPlatform.h"
|
||||
#include "patches/platform/g003/G003LoaderPlatform.h"
|
||||
#include "patches/platform/melonds/MelonDSLoaderPlatform.h"
|
||||
#include "patches/platform/dstt/DSTTLoaderPlatform.h"
|
||||
#include "patches/platform/ak2/AK2LoaderPlatform.h"
|
||||
#include "patches/platform/akrpg/AKRPGLoaderPlatform.h"
|
||||
#include "patches/platform/r4idsn/R4iDSNLoaderPlatform.h"
|
||||
#include "patches/platform/dstt/DsttLoaderPlatform.h"
|
||||
#include "patches/platform/ak2/Ak2LoaderPlatform.h"
|
||||
#include "patches/platform/akrpg/AkRpgLoaderPlatform.h"
|
||||
#include "patches/platform/r4idsn/R4iDsnLoaderPlatform.h"
|
||||
#include "patches/platform/supercard/SuperCardLoaderPlatform.h"
|
||||
#include "patches/platform/ezp/EZPLoaderPlatform.h"
|
||||
#include "patches/platform/ezp/EzpLoaderPlatform.h"
|
||||
#include "patches/platform/datel/DatelLoaderPlatform.h"
|
||||
#include "patches/platform/stargate/StargateLoaderPlatform.h"
|
||||
#include "LoaderPlatformFactory.h"
|
||||
@@ -34,17 +34,17 @@ LoaderPlatform* LoaderPlatformFactory::CreateLoaderPlatform() const
|
||||
#elif defined(PICO_LOADER_TARGET_MELONDS)
|
||||
return new MelonDSLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_DSTT)
|
||||
return new DSTTLoaderPlatform();
|
||||
return new DsttLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_AK2)
|
||||
return new AK2LoaderPlatform();
|
||||
return new Ak2LoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_AKRPG)
|
||||
return new AKRPGLoaderPlatform();
|
||||
return new AkRpgLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_R4iDSN)
|
||||
return new R4iDSNLoaderPlatform();
|
||||
return new R4iDsnLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_SUPERCARD)
|
||||
return new SuperCardLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_EZP)
|
||||
return new EZPLoaderPlatform();
|
||||
return new EzpLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_DATEL)
|
||||
return new DatelLoaderPlatform();
|
||||
#elif defined(PICO_LOADER_TARGET_STARGATE)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "../PatchCode.h"
|
||||
|
||||
/// @brief Abstract base class for patch code implementing SD reads
|
||||
class SdReadPatchCode : public PatchCode
|
||||
{
|
||||
protected:
|
||||
SdReadPatchCode(const void* code, u32 size, PatchHeap& patchHeap)
|
||||
: PatchCode(code, size, patchHeap) { }
|
||||
|
||||
public:
|
||||
/// @brief Pointer to a function for reading sectorCount SD sectors
|
||||
/// from srcSector to the given dst buffer.
|
||||
typedef void (*SdReadFunc)(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
/// @brief Gets a pointer to the SD read function in the patch code.
|
||||
/// @return The pointer to the SD read function.
|
||||
virtual const SdReadFunc GetSdReadFunction() const = 0;
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "../PatchCode.h"
|
||||
|
||||
/// @brief Abstract base class for patch code implementing SD writes
|
||||
class SdWritePatchCode : public PatchCode
|
||||
{
|
||||
protected:
|
||||
SdWritePatchCode(const void* code, u32 size, PatchHeap& patchHeap)
|
||||
: PatchCode(code, size, patchHeap) { }
|
||||
|
||||
public:
|
||||
/// @brief Pointer to a function for writing sectorCount SD sectors
|
||||
/// from the given src buffer to dstSector.
|
||||
typedef void (*SdWriteFunc)(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
/// @brief Gets a pointer to the SD write function in the patch code.
|
||||
/// @return The pointer to the SD write function.
|
||||
virtual const SdWriteFunc GetSdWriteFunction() const = 0;
|
||||
};
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "ace3dsReadSdAsm.h"
|
||||
#include "ace3dsReadSdDmaAsm.h"
|
||||
#include "ace3dsWriteSdAsm.h"
|
||||
#include "Ace3DSReadSdPatchCode.h"
|
||||
#include "Ace3DSReadSdDmaPatchCode.h"
|
||||
#include "Ace3DSWriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the Ace3DS+ flashcard
|
||||
class Ace3DSLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -18,14 +17,14 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdReadDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
|
||||
const IReadSectorsDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
|
||||
PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr) const override
|
||||
{
|
||||
return patchCodeCollection.AddUniquePatchCode<Ace3DSReadSdDmaPatchCode>(
|
||||
patchHeap, miiCardDmaCopy32Ptr);
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsDmaPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ace3ds_readsddma);
|
||||
|
||||
extern "C" void ace3ds_readSdDma(u32 srcSector, u32 previousSrcSector, u32 dmaChannel, void* dst);
|
||||
extern "C" void ace3ds_finishReadSdDma(void);
|
||||
|
||||
extern u32 ace3ds_readSdDma_miiCardDmaCopy32Ptr;
|
||||
|
||||
class Ace3DSReadSdDmaPatchCode : public PatchCode, public IReadSectorsDmaPatchCode
|
||||
{
|
||||
public:
|
||||
Ace3DSReadSdDmaPatchCode(PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr)
|
||||
: PatchCode(SECTION_START(ace3ds_readsddma), SECTION_SIZE(ace3ds_readsddma), patchHeap)
|
||||
{
|
||||
ace3ds_readSdDma_miiCardDmaCopy32Ptr = (u32)miiCardDmaCopy32Ptr;
|
||||
}
|
||||
|
||||
const ReadSectorsDmaFunc GetSdReadDmaFunction() const override
|
||||
{
|
||||
return (const ReadSectorsDmaFunc)GetAddressAtTarget((void*)ace3ds_readSdDma);
|
||||
}
|
||||
|
||||
const ReadSectorsDmaFinishFunc GetSdReadDmaFinishFunction() const override
|
||||
{
|
||||
return (const ReadSectorsDmaFinishFunc)GetAddressAtTarget((void*)ace3ds_finishReadSdDma);
|
||||
}
|
||||
};
|
||||
20
arm9/source/patches/platform/ace3ds/Ace3DSReadSdPatchCode.h
Normal file
20
arm9/source/patches/platform/ace3ds/Ace3DSReadSdPatchCode.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ace3ds_readsd);
|
||||
|
||||
extern "C" void ace3ds_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class Ace3DSReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit Ace3DSReadSdPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(ace3ds_readsd), SECTION_SIZE(ace3ds_readsd), patchHeap) { }
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)ace3ds_readSd);
|
||||
}
|
||||
};
|
||||
20
arm9/source/patches/platform/ace3ds/Ace3DSWriteSdPatchCode.h
Normal file
20
arm9/source/patches/platform/ace3ds/Ace3DSWriteSdPatchCode.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ace3ds_writesd);
|
||||
|
||||
extern "C" void ace3ds_writeSd(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class Ace3DSWriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit Ace3DSWriteSdPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(ace3ds_writesd), SECTION_SIZE(ace3ds_writesd), patchHeap) { }
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)ace3ds_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ace3ds_readsd);
|
||||
|
||||
extern "C" void ace3ds_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class Ace3DSReadSdPatchCode : public SdReadPatchCode
|
||||
{
|
||||
public:
|
||||
explicit Ace3DSReadSdPatchCode(PatchHeap& patchHeap)
|
||||
: SdReadPatchCode(SECTION_START(ace3ds_readsd), SECTION_SIZE(ace3ds_readsd), patchHeap) { }
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)ace3ds_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadDmaPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ace3ds_readsddma);
|
||||
|
||||
extern "C" void ace3ds_readSdDma(u32 srcSector, u32 previousSrcSector, u32 dmaChannel, void* dst);
|
||||
extern "C" void ace3ds_finishReadSdDma(void);
|
||||
|
||||
extern u32 ace3ds_readSdDma_miiCardDmaCopy32Ptr;
|
||||
|
||||
class Ace3DSReadSdDmaPatchCode : public SdReadDmaPatchCode
|
||||
{
|
||||
public:
|
||||
explicit Ace3DSReadSdDmaPatchCode(PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr)
|
||||
: SdReadDmaPatchCode(SECTION_START(ace3ds_readsddma), SECTION_SIZE(ace3ds_readsddma), patchHeap)
|
||||
{
|
||||
ace3ds_readSdDma_miiCardDmaCopy32Ptr = (u32)miiCardDmaCopy32Ptr;
|
||||
}
|
||||
|
||||
const SdReadDmaFunc GetSdReadDmaFunction() const override
|
||||
{
|
||||
return (const SdReadDmaFunc)GetAddressAtTarget((void*)ace3ds_readSdDma);
|
||||
}
|
||||
|
||||
const SdReadDmaFinishFunc GetSdReadDmaFinishFunction() const override
|
||||
{
|
||||
return (const SdReadDmaFinishFunc)GetAddressAtTarget((void*)ace3ds_finishReadSdDma);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ace3ds_writesd);
|
||||
|
||||
extern "C" void ace3ds_writeSd(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class Ace3DSWriteSdPatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
explicit Ace3DSWriteSdPatchCode(PatchHeap& patchHeap)
|
||||
: SdWritePatchCode(SECTION_START(ace3ds_writesd), SECTION_SIZE(ace3ds_writesd), patchHeap) { }
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)ace3ds_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include <libtwl/card/card.h>
|
||||
|
||||
/// All RPG-based SDIO drivers use this as base, and add latency/size as needed
|
||||
@@ -11,7 +10,7 @@
|
||||
#define IORPG_CMD_SET_SD_MODE_SDHC (0xC101000000000000ull)
|
||||
|
||||
/// @brief SDIO parameter types. Used with IORPG_CMD_SDIO command.
|
||||
enum ioRPGSdioParamTypes
|
||||
enum IoRpgSdioParamTypes
|
||||
{
|
||||
IORPG_SDIO_NORESPONSE = 0ull,
|
||||
IORPG_SDIO_READ_RESPONSE = 1ull,
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "common.h"
|
||||
#include <libtwl/card/card.h>
|
||||
#include "ioRPGDefinitions.h"
|
||||
#include "IoRpgDefinitions.h"
|
||||
#include "../SdioDefinitions.h"
|
||||
#include "waitByLoop.h"
|
||||
#include "IoRPGLoaderPlatform.h"
|
||||
#include "IoRpgLoaderPlatform.h"
|
||||
|
||||
bool IoRPGLoaderPlatform::InitializeSdCard()
|
||||
bool IoRpgLoaderPlatform::InitializeSdCard()
|
||||
{
|
||||
bool isSdhc = false;
|
||||
bool isSdVersion2 = false;
|
||||
@@ -70,7 +70,7 @@ bool IoRPGLoaderPlatform::InitializeSdCard()
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
void IoRPGLoaderPlatform::SdSendSdioCommand(u64 command, u8* buffer, u32 length) const
|
||||
void IoRpgLoaderPlatform::SdSendSdioCommand(u64 command, u8* buffer, u32 length) const
|
||||
{
|
||||
u32 flags;
|
||||
if (length == 0)
|
||||
@@ -140,7 +140,7 @@ void IoRPGLoaderPlatform::SdSendSdioCommand(u64 command, u8* buffer, u32 length)
|
||||
card_romWaitBusy();
|
||||
}
|
||||
|
||||
u32 IoRPGLoaderPlatform::SdSendR1Command(u8 cmd, u32 argument) const
|
||||
u32 IoRpgLoaderPlatform::SdSendR1Command(u8 cmd, u32 argument) const
|
||||
{
|
||||
u64 buffer = 0;
|
||||
SdSendSdioCommand(IoRpgCmdSdio(cmd, IORPG_SDIO_READ_RESPONSE, argument), (u8*)&buffer, SD_R1_RESPONSE_LENGTH_BITS);
|
||||
@@ -148,7 +148,7 @@ u32 IoRPGLoaderPlatform::SdSendR1Command(u8 cmd, u32 argument) const
|
||||
return (u32)(buffer >> 9);
|
||||
}
|
||||
|
||||
void IoRPGLoaderPlatform::SdSendR2Command(u8 cmd, u32 argument) const
|
||||
void IoRpgLoaderPlatform::SdSendR2Command(u8 cmd, u32 argument) const
|
||||
{
|
||||
ALIGN(4) u8 ret[136 >> 3] = {};
|
||||
SdSendSdioCommand(IoRpgCmdSdio(cmd, IORPG_SDIO_READ_RESPONSE, argument), ret, SD_R2_RESPONSE_LENGTH_BITS);
|
||||
@@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "iorpgSendSdioCommandAsm.h"
|
||||
#include "iorpgSdWaitForStateAsm.h"
|
||||
#include "IoRpgSendSdioCommandPatchCode.h"
|
||||
#include "IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for flashcarts based on the Acekard RPG family
|
||||
class IoRPGLoaderPlatform : public LoaderPlatform
|
||||
class IoRpgLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
explicit IoRPGLoaderPlatform(u8 ioRpgCmdSdioByte)
|
||||
explicit IoRpgLoaderPlatform(u8 ioRpgCmdSdioByte)
|
||||
: _ioRpgCmdSdioByte(ioRpgCmdSdioByte) { }
|
||||
|
||||
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
|
||||
@@ -42,7 +41,7 @@ private:
|
||||
|
||||
/// @brief Builds a card command containing the SDIO command, SDIO parameter and the parameter type
|
||||
/// @param SDIO command
|
||||
/// @param Parameter type seen in ioRPGSdioParamTypes
|
||||
/// @param Parameter type seen in IoRpgSdioParamTypes
|
||||
/// @param Parameter to SDIO command.
|
||||
/// @return A u64 to be written to REG_MCCMD0
|
||||
u64 IoRpgCmdSdio(u8 sdio, u8 paramType, u32 parameter) const
|
||||
@@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "patches/PatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(iorpg_sdwaitforstate);
|
||||
|
||||
extern "C" void iorpg_sdWaitForState(u32 status_shift, u8 state);
|
||||
|
||||
class ioRPGSDWaitForStatePatchCode : public PatchCode
|
||||
class IoRpgSdWaitForStatePatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit ioRPGSDWaitForStatePatchCode(PatchHeap& patchHeap)
|
||||
explicit IoRpgSdWaitForStatePatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(iorpg_sdwaitforstate), SECTION_SIZE(iorpg_sdwaitforstate), patchHeap) { }
|
||||
|
||||
const void* GetSDWaitForStateFunction() const
|
||||
@@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "patches/PatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(iorpg_sendsdiocommand);
|
||||
|
||||
extern "C" void iorpg_sendSdioCommand(u8 sdio, u8 param_type, u32 param, u32 read_len);
|
||||
|
||||
class ioRPGSendSDIOCommandPatchCode : public PatchCode
|
||||
class IoRpgSendSdioCommandPatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit ioRPGSendSDIOCommandPatchCode(PatchHeap& patchHeap)
|
||||
explicit IoRpgSendSdioCommandPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(iorpg_sendsdiocommand), SECTION_SIZE(iorpg_sendsdiocommand), patchHeap) { }
|
||||
|
||||
const void* GetSendSdioCommandFunction() const
|
||||
@@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../acekard-common/IoRPGLoaderPlatform.h"
|
||||
#include "ak2ReadSdAsm.h"
|
||||
#include "ak2SdReadSectorAsm.h"
|
||||
#include "ak2WriteSdAsm.h"
|
||||
#include "../acekard-common/IoRpgLoaderPlatform.h"
|
||||
#include "Ak2ReadSdPatchCode.h"
|
||||
#include "Ak2SdReadSectorPatchCode.h"
|
||||
#include "Ak2WriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the Acekard 2 flashcard
|
||||
class AK2LoaderPlatform : public IoRPGLoaderPlatform
|
||||
class Ak2LoaderPlatform : public IoRpgLoaderPlatform
|
||||
{
|
||||
private:
|
||||
enum
|
||||
@@ -15,43 +14,43 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
AK2LoaderPlatform() : IoRPGLoaderPlatform(IORPG_CMD_SDIO_BYTE) { }
|
||||
Ak2LoaderPlatform() : IoRpgLoaderPlatform(IORPG_CMD_SDIO_BYTE) { }
|
||||
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
auto* waitForStatePatchCode = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSDWaitForStatePatchCode(patchHeap);
|
||||
return new IoRpgSdWaitForStatePatchCode(patchHeap);
|
||||
});
|
||||
return new AK2ReadSdPatchCode(patchHeap,
|
||||
return new Ak2ReadSdPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSendSDIOCommandPatchCode(patchHeap);
|
||||
return new IoRpgSendSdioCommandPatchCode(patchHeap);
|
||||
}),
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new AK2SDReadSectorPatchCode(patchHeap, waitForStatePatchCode);
|
||||
return new Ak2SdReadSectorPatchCode(patchHeap, waitForStatePatchCode);
|
||||
}),
|
||||
waitForStatePatchCode);
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new AK2WriteSdPatchCode(patchHeap,
|
||||
return new Ak2WriteSdPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSendSDIOCommandPatchCode(patchHeap);
|
||||
return new IoRpgSendSdioCommandPatchCode(patchHeap);
|
||||
}),
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSDWaitForStatePatchCode(patchHeap);
|
||||
return new IoRpgSdWaitForStatePatchCode(patchHeap);
|
||||
}));
|
||||
});
|
||||
}
|
||||
37
arm9/source/patches/platform/ak2/Ak2ReadSdPatchCode.h
Normal file
37
arm9/source/patches/platform/ak2/Ak2ReadSdPatchCode.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "Ak2SdReadSectorPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSendSdioCommandPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ak2_readsd);
|
||||
|
||||
extern "C" void ak2_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 ak2_readSd_sendSdioCommand_address;
|
||||
extern u32 ak2_readSd_sdReadSector_address;
|
||||
extern u32 ak2_readSd_sdWaitForState_address;
|
||||
extern u16 ak2_readSd_sdsc_shift;
|
||||
|
||||
class Ak2ReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
Ak2ReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const IoRpgSendSdioCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const Ak2SdReadSectorPatchCode* ak2SdReadSectorPatchCode,
|
||||
const IoRpgSdWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: PatchCode(SECTION_START(ak2_readsd), SECTION_SIZE(ak2_readsd), patchHeap)
|
||||
{
|
||||
ak2_readSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
ak2_readSd_sdReadSector_address = (u32)ak2SdReadSectorPatchCode->GetSDReadSectorFunction();
|
||||
ak2_readSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)ak2_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "../acekard-common/iorpgSdWaitForStateAsm.h"
|
||||
#include "../acekard-common/IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ak2_sdreadsector);
|
||||
|
||||
@@ -9,11 +9,11 @@ extern "C" void ak2_sdReadSector(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 ak2_sdReadSector_sdWaitForState_address;
|
||||
|
||||
class AK2SDReadSectorPatchCode : public PatchCode
|
||||
class Ak2SdReadSectorPatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit AK2SDReadSectorPatchCode(PatchHeap& patchHeap,
|
||||
const ioRPGSDWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
explicit Ak2SdReadSectorPatchCode(PatchHeap& patchHeap,
|
||||
const IoRpgSdWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: PatchCode(SECTION_START(ak2_sdreadsector), SECTION_SIZE(ak2_sdreadsector), patchHeap)
|
||||
{
|
||||
ak2_sdReadSector_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
33
arm9/source/patches/platform/ak2/Ak2WriteSdPatchCode.h
Normal file
33
arm9/source/patches/platform/ak2/Ak2WriteSdPatchCode.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSendSdioCommandPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ak2_writesd);
|
||||
|
||||
extern "C" void ak2_writeSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 ak2_writeSd_sendSdioCommand_address;
|
||||
extern u32 ak2_writeSd_sdWaitForState_address;
|
||||
extern u16 ak2_writeSd_sdsc_shift;
|
||||
|
||||
class Ak2WriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
Ak2WriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const IoRpgSendSdioCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const IoRpgSdWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: PatchCode(SECTION_START(ak2_writesd), SECTION_SIZE(ak2_writesd), patchHeap)
|
||||
{
|
||||
ak2_writeSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
ak2_writeSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)ak2_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "ak2SdReadSectorAsm.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "../acekard-common/iorpgSendSdioCommandAsm.h"
|
||||
#include "../acekard-common/iorpgSdWaitForStateAsm.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ak2_readsd);
|
||||
|
||||
extern "C" void ak2_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 ak2_readSd_sendSdioCommand_address;
|
||||
extern u32 ak2_readSd_sdReadSector_address;
|
||||
extern u32 ak2_readSd_sdWaitForState_address;
|
||||
extern u16 ak2_readSd_sdsc_shift;
|
||||
|
||||
class AK2ReadSdPatchCode : public SdReadPatchCode
|
||||
{
|
||||
public:
|
||||
explicit AK2ReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const ioRPGSendSDIOCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const AK2SDReadSectorPatchCode* ak2SdReadSectorPatchCode,
|
||||
const ioRPGSDWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: SdReadPatchCode(SECTION_START(ak2_readsd), SECTION_SIZE(ak2_readsd), patchHeap)
|
||||
{
|
||||
ak2_readSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
ak2_readSd_sdReadSector_address = (u32)ak2SdReadSectorPatchCode->GetSDReadSectorFunction();
|
||||
ak2_readSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)ak2_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
#include "../acekard-common/iorpgSendSdioCommandAsm.h"
|
||||
#include "../acekard-common/iorpgSdWaitForStateAsm.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ak2_writesd);
|
||||
|
||||
extern "C" void ak2_writeSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 ak2_writeSd_sendSdioCommand_address;
|
||||
extern u32 ak2_writeSd_sdWaitForState_address;
|
||||
extern u16 ak2_writeSd_sdsc_shift;
|
||||
|
||||
class AK2WriteSdPatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
explicit AK2WriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const ioRPGSendSDIOCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const ioRPGSDWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: SdWritePatchCode(SECTION_START(ak2_writesd), SECTION_SIZE(ak2_writesd), patchHeap)
|
||||
{
|
||||
ak2_writeSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
ak2_writeSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)ak2_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../acekard-common/IoRPGLoaderPlatform.h"
|
||||
#include "akrpgReadSdAsm.h"
|
||||
#include "akrpgSdReadSectorAsm.h"
|
||||
#include "akrpgWriteSdAsm.h"
|
||||
#include "AkRpgReadSdPatchCode.h"
|
||||
#include "AkRpgSdReadSectorPatchCode.h"
|
||||
#include "AkRpgWriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the Acekard RPG SD card.
|
||||
class AKRPGLoaderPlatform : public IoRPGLoaderPlatform
|
||||
class AkRpgLoaderPlatform : public IoRpgLoaderPlatform
|
||||
{
|
||||
private:
|
||||
enum
|
||||
@@ -15,43 +14,43 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
AKRPGLoaderPlatform() : IoRPGLoaderPlatform(IORPG_CMD_SDIO_BYTE) { }
|
||||
AkRpgLoaderPlatform() : IoRpgLoaderPlatform(IORPG_CMD_SDIO_BYTE) { }
|
||||
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
auto* waitForStatePatchCode = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSDWaitForStatePatchCode(patchHeap);
|
||||
return new IoRpgSdWaitForStatePatchCode(patchHeap);
|
||||
});
|
||||
return new AKRPGReadSdPatchCode(patchHeap,
|
||||
return new AkRpgReadSdPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSendSDIOCommandPatchCode(patchHeap);
|
||||
return new IoRpgSendSdioCommandPatchCode(patchHeap);
|
||||
}),
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new AKRPGSDReadSectorPatchCode(patchHeap, waitForStatePatchCode);
|
||||
return new AkRpgSdReadSectorPatchCode(patchHeap, waitForStatePatchCode);
|
||||
}),
|
||||
waitForStatePatchCode);
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new AKRPGWriteSdPatchCode(patchHeap,
|
||||
return new AkRpgWriteSdPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSendSDIOCommandPatchCode(patchHeap);
|
||||
return new IoRpgSendSdioCommandPatchCode(patchHeap);
|
||||
}),
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new ioRPGSDWaitForStatePatchCode(patchHeap);
|
||||
return new IoRpgSdWaitForStatePatchCode(patchHeap);
|
||||
}));
|
||||
});
|
||||
}
|
||||
37
arm9/source/patches/platform/akrpg/AkRpgReadSdPatchCode.h
Normal file
37
arm9/source/patches/platform/akrpg/AkRpgReadSdPatchCode.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "AkRpgSdReadSectorPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSendSdioCommandPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(akrpg_readsd);
|
||||
|
||||
extern "C" void akrpg_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 akrpg_readSd_sendSdioCommand_address;
|
||||
extern u32 akrpg_readSd_sdReadSector_address;
|
||||
extern u32 akrpg_readSd_sdWaitForState_address;
|
||||
extern u16 akrpg_readSd_sdsc_shift;
|
||||
|
||||
class AkRpgReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
AkRpgReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const IoRpgSendSdioCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const AkRpgSdReadSectorPatchCode* akrpgSdReadSectorPatchCode,
|
||||
const IoRpgSdWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: PatchCode(SECTION_START(akrpg_readsd), SECTION_SIZE(akrpg_readsd), patchHeap)
|
||||
{
|
||||
akrpg_readSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
akrpg_readSd_sdReadSector_address = (u32)akrpgSdReadSectorPatchCode->GetSDReadSectorFunction();
|
||||
akrpg_readSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)akrpg_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "../acekard-common/iorpgSdWaitForStateAsm.h"
|
||||
#include "../acekard-common/IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(akrpg_sdreadsector);
|
||||
|
||||
@@ -9,11 +9,11 @@ extern "C" void akrpg_sdReadSector(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 akrpg_sdReadSector_sdWaitForState_address;
|
||||
|
||||
class AKRPGSDReadSectorPatchCode : public PatchCode
|
||||
class AkRpgSdReadSectorPatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit AKRPGSDReadSectorPatchCode(PatchHeap& patchHeap,
|
||||
const ioRPGSDWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
explicit AkRpgSdReadSectorPatchCode(PatchHeap& patchHeap,
|
||||
const IoRpgSdWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: PatchCode(SECTION_START(akrpg_sdreadsector), SECTION_SIZE(akrpg_sdreadsector), patchHeap)
|
||||
{
|
||||
akrpg_sdReadSector_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
33
arm9/source/patches/platform/akrpg/AkRpgWriteSdPatchCode.h
Normal file
33
arm9/source/patches/platform/akrpg/AkRpgWriteSdPatchCode.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSendSdioCommandPatchCode.h"
|
||||
#include "../acekard-common/IoRpgSdWaitForStatePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(akrpg_writesd);
|
||||
|
||||
extern "C" void akrpg_writeSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 akrpg_writeSd_sendSdioCommand_address;
|
||||
extern u32 akrpg_writeSd_sdWaitForState_address;
|
||||
extern u16 akrpg_writeSd_sdsc_shift;
|
||||
|
||||
class AkRpgWriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
AkRpgWriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const IoRpgSendSdioCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const IoRpgSdWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: PatchCode(SECTION_START(akrpg_writesd), SECTION_SIZE(akrpg_writesd), patchHeap)
|
||||
{
|
||||
akrpg_writeSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
akrpg_writeSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)akrpg_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "akrpgSdReadSectorAsm.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "../acekard-common/iorpgSendSdioCommandAsm.h"
|
||||
#include "../acekard-common/iorpgSdWaitForStateAsm.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(akrpg_readsd);
|
||||
|
||||
extern "C" void akrpg_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 akrpg_readSd_sendSdioCommand_address;
|
||||
extern u32 akrpg_readSd_sdReadSector_address;
|
||||
extern u32 akrpg_readSd_sdWaitForState_address;
|
||||
extern u16 akrpg_readSd_sdsc_shift;
|
||||
|
||||
class AKRPGReadSdPatchCode : public SdReadPatchCode
|
||||
{
|
||||
public:
|
||||
explicit AKRPGReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const ioRPGSendSDIOCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const AKRPGSDReadSectorPatchCode* akrpgSdReadSectorPatchCode,
|
||||
const ioRPGSDWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: SdReadPatchCode(SECTION_START(akrpg_readsd), SECTION_SIZE(akrpg_readsd), patchHeap)
|
||||
{
|
||||
akrpg_readSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
akrpg_readSd_sdReadSector_address = (u32)akrpgSdReadSectorPatchCode->GetSDReadSectorFunction();
|
||||
akrpg_readSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)akrpg_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
#include "../acekard-common/iorpgSendSdioCommandAsm.h"
|
||||
#include "../acekard-common/iorpgSdWaitForStateAsm.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(akrpg_writesd);
|
||||
|
||||
extern "C" void akrpg_writeSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 akrpg_writeSd_sendSdioCommand_address;
|
||||
extern u32 akrpg_writeSd_sdWaitForState_address;
|
||||
extern u16 akrpg_writeSd_sdsc_shift;
|
||||
|
||||
class AKRPGWriteSdPatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
explicit AKRPGWriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const ioRPGSendSDIOCommandPatchCode* iorpgSendSdioCommandPatchCode,
|
||||
const ioRPGSDWaitForStatePatchCode* iorpgSdWaitForStatePatchCode)
|
||||
: SdWritePatchCode(SECTION_START(akrpg_writesd), SECTION_SIZE(akrpg_writesd), patchHeap)
|
||||
{
|
||||
akrpg_writeSd_sendSdioCommand_address = (u32)iorpgSendSdioCommandPatchCode->GetSendSdioCommandFunction();
|
||||
akrpg_writeSd_sdWaitForState_address = (u32)iorpgSdWaitForStatePatchCode->GetSDWaitForStateFunction();
|
||||
}
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)akrpg_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "DatelSpiCommandsAsm.h"
|
||||
#include "DatelReadSectorsAsm.h"
|
||||
#include "DatelWriteSectorsAsm.h"
|
||||
#include "DatelSendSdioCommandPatchCode.h"
|
||||
#include "DatelReadSdPatchCode.h"
|
||||
#include "DatelWriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the DATEL line of flashcarts
|
||||
class DatelLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
auto spi = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -18,7 +17,7 @@ public:
|
||||
});
|
||||
auto sendSdio = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new DatelSendSDIOCommandPatchCode(patchHeap, spi);
|
||||
return new DatelSendSdioCommandPatchCode(patchHeap, spi);
|
||||
});
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
@@ -26,7 +25,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
auto spi = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -35,7 +34,7 @@ public:
|
||||
});
|
||||
auto sendSdio = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new DatelSendSDIOCommandPatchCode(patchHeap, spi);
|
||||
return new DatelSendSdioCommandPatchCode(patchHeap, spi);
|
||||
});
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(datel_read);
|
||||
|
||||
extern u16 datel_readSectorSdhcLabel;
|
||||
@@ -12,13 +14,13 @@ extern u32 datel_SDReadMultipleSector_ReadSpiShort;
|
||||
|
||||
extern "C" void datel_SDReadMultipleSector(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class DatelReadSdPatchCode : public SdReadPatchCode
|
||||
class DatelReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
DatelReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const DatelReadSpiBytePatchCode* datelReadSpiBytePatchCode,
|
||||
const DatelSendSDIOCommandPatchCode* datelSendSDIOCommandPatchCode)
|
||||
: SdReadPatchCode(SECTION_START(datel_read), SECTION_SIZE(datel_read), patchHeap)
|
||||
const DatelSendSdioCommandPatchCode* datelSendSDIOCommandPatchCode)
|
||||
: PatchCode(SECTION_START(datel_read), SECTION_SIZE(datel_read), patchHeap)
|
||||
{
|
||||
datel_SDReadMultipleSector_SpiSendSDIOCommandR0 = (u32)datelSendSDIOCommandPatchCode->GetSpiSendSDIOCommandR0Function();
|
||||
|
||||
@@ -26,8 +28,8 @@ public:
|
||||
datel_SDReadMultipleSector_ReadSpiShort = (u32)datelReadSpiBytePatchCode->GetReadSpiShortFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)datel_SDReadMultipleSector);
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)datel_SDReadMultipleSector);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadDmaPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(datel_read_spi);
|
||||
DEFINE_SECTION_SYMBOLS(datel_spi_send);
|
||||
@@ -49,11 +49,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DatelSendSDIOCommandPatchCode : public PatchCode
|
||||
class DatelSendSdioCommandPatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
DatelSendSDIOCommandPatchCode(PatchHeap& patchHeap,
|
||||
const DatelReadSpiBytePatchCode* datelReadSpiBytePatchCode)
|
||||
DatelSendSdioCommandPatchCode(PatchHeap& patchHeap, const DatelReadSpiBytePatchCode* datelReadSpiBytePatchCode)
|
||||
: PatchCode(SECTION_START(datel_spi_send), SECTION_SIZE(datel_spi_send), patchHeap)
|
||||
{
|
||||
datel_spiSendSDIOCommandR0_ReadWriteSpiByte = (u32)datelReadSpiBytePatchCode->GetReadWriteSpiByteFunction();
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(datel_write);
|
||||
|
||||
@@ -13,13 +14,13 @@ extern u32 datel_SDWriteMultipleSector_ReadSpiByte;
|
||||
|
||||
extern "C" void datel_SDWriteMultipleSector(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class DatelWriteSdPatchCode : public SdWritePatchCode
|
||||
class DatelWriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
DatelWriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const DatelReadSpiBytePatchCode* datelReadSpiBytePatchCode,
|
||||
const DatelSendSDIOCommandPatchCode* datelSendSDIOCommandPatchCode)
|
||||
: SdWritePatchCode(SECTION_START(datel_write), SECTION_SIZE(datel_write), patchHeap)
|
||||
const DatelSendSdioCommandPatchCode* datelSendSDIOCommandPatchCode)
|
||||
: PatchCode(SECTION_START(datel_write), SECTION_SIZE(datel_write), patchHeap)
|
||||
{
|
||||
datel_SDWriteMultipleSector_SpiSendSDIOCommand = (u32)datelSendSDIOCommandPatchCode->GetSpiSendSDIOCommandFunction();
|
||||
|
||||
@@ -27,8 +28,8 @@ public:
|
||||
datel_SDWriteMultipleSector_ReadSpiByte = (u32)datelReadSpiBytePatchCode->GetReadSpiByteFunction();
|
||||
}
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)datel_SDWriteMultipleSector);
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)datel_SDWriteMultipleSector);
|
||||
}
|
||||
};
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "dspicoReadSectorsAsm.h"
|
||||
#include "dspicoReadSdSectorDmaAsm.h"
|
||||
#include "dspicoWriteSectorsAsm.h"
|
||||
#include "DSPicoReadSdSectorsPatchCode.h"
|
||||
#include "DSPicoReadSdSectorDmaPatchCode.h"
|
||||
#include "DSPicoWriteSdSectorsPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the DS pico flashcard
|
||||
class DSPicoLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -22,7 +21,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdReadDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
|
||||
const IReadSectorsDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
|
||||
PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr) const override
|
||||
{
|
||||
auto pollSdDataReadyPatchCode = patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -34,7 +33,7 @@ public:
|
||||
patchHeap, pollSdDataReadyPatchCode, miiCardDmaCopy32Ptr);
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadDmaPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsDmaPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(dspico_readsdsectordma);
|
||||
DEFINE_SECTION_SYMBOLS(dspico_readsdsectordma_pollSdDataReady);
|
||||
@@ -23,34 +24,34 @@ public:
|
||||
return GetAddressAtTarget((void*)dspico_readSdSectorDma_pollSdDataReady);
|
||||
}
|
||||
|
||||
const SdReadDmaPatchCode::SdReadDmaFinishFunc GetSdReadDmaFinishFunction() const
|
||||
const IReadSectorsDmaPatchCode::ReadSectorsDmaFinishFunc GetSdReadDmaFinishFunction() const
|
||||
{
|
||||
return (const SdReadDmaPatchCode::SdReadDmaFinishFunc)GetAddressAtTarget((void*)dspico_finishReadSdSectorDma);
|
||||
return (const IReadSectorsDmaPatchCode::ReadSectorsDmaFinishFunc)GetAddressAtTarget((void*)dspico_finishReadSdSectorDma);
|
||||
}
|
||||
};
|
||||
|
||||
class DSPicoReadSdSectorDmaPatchCode : public SdReadDmaPatchCode
|
||||
class DSPicoReadSdSectorDmaPatchCode : public PatchCode, public IReadSectorsDmaPatchCode
|
||||
{
|
||||
public:
|
||||
DSPicoReadSdSectorDmaPatchCode(PatchHeap& patchHeap,
|
||||
const DSPicoReadSdSectorDmaPollSdDataReadyPatchCode* pollSdDataReadyPatchCode, const void* miiCardDmaCopy32Ptr)
|
||||
: SdReadDmaPatchCode(SECTION_START(dspico_readsdsectordma), SECTION_SIZE(dspico_readsdsectordma), patchHeap)
|
||||
: PatchCode(SECTION_START(dspico_readsdsectordma), SECTION_SIZE(dspico_readsdsectordma), patchHeap)
|
||||
, _sdReadDmaFinishFunc(pollSdDataReadyPatchCode->GetSdReadDmaFinishFunction())
|
||||
{
|
||||
dspico_readSdSectorDma_miiCardDmaCopy32Ptr = (u32)miiCardDmaCopy32Ptr;
|
||||
dspico_readSdSectorDma_pollSdDataReadyPtr = (u32)pollSdDataReadyPatchCode->GetPollSdDataReadyFunction();
|
||||
}
|
||||
|
||||
const SdReadDmaFunc GetSdReadDmaFunction() const override
|
||||
const ReadSectorsDmaFunc GetSdReadDmaFunction() const override
|
||||
{
|
||||
return (const SdReadDmaFunc)GetAddressAtTarget((void*)dspico_readSdSectorDma);
|
||||
return (const ReadSectorsDmaFunc)GetAddressAtTarget((void*)dspico_readSdSectorDma);
|
||||
}
|
||||
|
||||
const SdReadDmaFinishFunc GetSdReadDmaFinishFunction() const override
|
||||
const ReadSectorsDmaFinishFunc GetSdReadDmaFinishFunction() const override
|
||||
{
|
||||
return _sdReadDmaFinishFunc;
|
||||
}
|
||||
|
||||
private:
|
||||
const SdReadDmaFinishFunc _sdReadDmaFinishFunc;
|
||||
const ReadSectorsDmaFinishFunc _sdReadDmaFinishFunc;
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(dspico_readsdsectors);
|
||||
DEFINE_SECTION_SYMBOLS(dspico_readsdsectors_readdirect);
|
||||
@@ -22,17 +23,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DSPicoReadSdSectorsPatchCode : public SdReadPatchCode
|
||||
class DSPicoReadSdSectorsPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
DSPicoReadSdSectorsPatchCode(PatchHeap& patchHeap, const DSPicoReadSdSectorsDirectPatchCode* readSdSectorsDirectPatchCode)
|
||||
: SdReadPatchCode(SECTION_START(dspico_readsdsectors), SECTION_SIZE(dspico_readsdsectors), patchHeap)
|
||||
: PatchCode(SECTION_START(dspico_readsdsectors), SECTION_SIZE(dspico_readsdsectors), patchHeap)
|
||||
{
|
||||
dspico_readsdsectors_readDirectAddress = (u32)readSdSectorsDirectPatchCode->GetReadSdSectorsDirectFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)dspico_readSdSectors);
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)dspico_readSdSectors);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(dspico_writesdsectors);
|
||||
|
||||
extern "C" void dspico_writeSdSectors(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class DSPicoWriteSdSectorsPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit DSPicoWriteSdSectorsPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(dspico_writesdsectors), SECTION_SIZE(dspico_writesdsectors), patchHeap) { }
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)dspico_writeSdSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(dspico_writesdsectors);
|
||||
|
||||
extern "C" void dspico_writeSdSectors(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class DSPicoWriteSdSectorsPatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
explicit DSPicoWriteSdSectorsPatchCode(PatchHeap& patchHeap)
|
||||
: SdWritePatchCode(SECTION_START(dspico_writesdsectors), SECTION_SIZE(dspico_writesdsectors), patchHeap) { }
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)dspico_writeSdSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "common.h"
|
||||
#include <libtwl/card/card.h>
|
||||
#include "dsttDefinitions.h"
|
||||
#include "DsttDefinitions.h"
|
||||
#include "../SdioDefinitions.h"
|
||||
#include "waitByLoop.h"
|
||||
#include "DSTTLoaderPlatform.h"
|
||||
@@ -92,7 +92,7 @@ static void sdHostSetRegister(u8 bits)
|
||||
waitByLoop(0x600);
|
||||
}
|
||||
|
||||
bool DSTTLoaderPlatform::InitializeSdCard(void)
|
||||
bool DsttLoaderPlatform::InitializeSdCard(void)
|
||||
{
|
||||
bool isSdVersion2 = false;
|
||||
bool isSdhc = false;
|
||||
@@ -1,35 +1,34 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "dsttReadSdAsm.h"
|
||||
#include "dsttWriteSdAsm.h"
|
||||
#include "DsttReadSdPatchCode.h"
|
||||
#include "DsttWriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the DSTT flashcard
|
||||
class DSTTLoaderPlatform : public LoaderPlatform
|
||||
class DsttLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new DSTTReadSdPatchCode(patchHeap,
|
||||
return new DsttReadSdPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new DSTTReadSdStopTransmissionPatchCode(patchHeap);
|
||||
return new DsttReadSdStopTransmissionPatchCode(patchHeap);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new DSTTWriteSdPatchCode(patchHeap,
|
||||
return new DsttWriteSdPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new DSTTWriteSdContinuePatchCode(patchHeap);
|
||||
return new DsttWriteSdContinuePatchCode(patchHeap);
|
||||
}));
|
||||
});
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "thumbInstructions.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(dstt_readsd);
|
||||
DEFINE_SECTION_SYMBOLS(dstt_readsd_stopTransmission);
|
||||
@@ -12,10 +13,10 @@ extern "C" void dstt_stopTransmission();
|
||||
extern u32 dstt_stopTransmission_address;
|
||||
extern u16 dstt_readSd_sdsc_shift;
|
||||
|
||||
class DSTTReadSdStopTransmissionPatchCode : public PatchCode
|
||||
class DsttReadSdStopTransmissionPatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit DSTTReadSdStopTransmissionPatchCode(PatchHeap& patchHeap)
|
||||
explicit DsttReadSdStopTransmissionPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(dstt_readsd_stopTransmission), SECTION_SIZE(dstt_readsd_stopTransmission), patchHeap) { }
|
||||
|
||||
const void* GetStopTransmissionFunction() const
|
||||
@@ -24,18 +25,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DSTTReadSdPatchCode : public SdReadPatchCode
|
||||
class DsttReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit DSTTReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const DSTTReadSdStopTransmissionPatchCode* dsttReadSdStopTransmissionPatchCode)
|
||||
: SdReadPatchCode(SECTION_START(dstt_readsd), SECTION_SIZE(dstt_readsd), patchHeap)
|
||||
explicit DsttReadSdPatchCode(PatchHeap& patchHeap,
|
||||
const DsttReadSdStopTransmissionPatchCode* dsttReadSdStopTransmissionPatchCode)
|
||||
: PatchCode(SECTION_START(dstt_readsd), SECTION_SIZE(dstt_readsd), patchHeap)
|
||||
{
|
||||
dstt_stopTransmission_address = (u32)dsttReadSdStopTransmissionPatchCode->GetStopTransmissionFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)dstt_readSd);
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)dstt_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(dstt_writesd);
|
||||
DEFINE_SECTION_SYMBOLS(dstt_writesd_continue);
|
||||
@@ -11,10 +12,10 @@ extern "C" void dstt_writeSdContinue();
|
||||
extern u32 dstt_writeSdContinue_address;
|
||||
extern u16 dstt_writeSd_sdsc_shift;
|
||||
|
||||
class DSTTWriteSdContinuePatchCode : public PatchCode
|
||||
class DsttWriteSdContinuePatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit DSTTWriteSdContinuePatchCode(PatchHeap& patchHeap)
|
||||
explicit DsttWriteSdContinuePatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(dstt_writesd_continue), SECTION_SIZE(dstt_writesd_continue), patchHeap) { }
|
||||
|
||||
const void* GetWriteSdContinueFunction() const
|
||||
@@ -23,18 +24,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DSTTWriteSdPatchCode : public SdWritePatchCode
|
||||
class DsttWriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit DSTTWriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const DSTTWriteSdContinuePatchCode* dsttWriteSdContinuePatchCode)
|
||||
: SdWritePatchCode(SECTION_START(dstt_writesd), SECTION_SIZE(dstt_writesd), patchHeap)
|
||||
DsttWriteSdPatchCode(PatchHeap& patchHeap,
|
||||
const DsttWriteSdContinuePatchCode* dsttWriteSdContinuePatchCode)
|
||||
: PatchCode(SECTION_START(dstt_writesd), SECTION_SIZE(dstt_writesd), patchHeap)
|
||||
{
|
||||
dstt_writeSdContinue_address = (u32)dsttWriteSdContinuePatchCode->GetWriteSdContinueFunction();
|
||||
}
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)dstt_writeSd);
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)dstt_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,33 +1,32 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "ezpReadSectorsAsm.h"
|
||||
#include "ezpReadSdDataAsm.h"
|
||||
#include "ezpWriteSectorsAsm.h"
|
||||
#include "EzpReadSectorsPatchCode.h"
|
||||
#include "EzpReadSdDataPatchCode.h"
|
||||
#include "EzpWriteSectorsPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the EZ-Flash Parallel flashcard
|
||||
class EZPLoaderPlatform : public LoaderPlatform
|
||||
class EzpLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new EZPReadSectorsPatchCode(patchHeap,
|
||||
return new EzpReadSectorsPatchCode(patchHeap,
|
||||
patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new EZPReadSDDataPatchCode(patchHeap);
|
||||
return new EzpReadSdDataPatchCode(patchHeap);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
{
|
||||
return new EZPWriteSectorsPatchCode(patchHeap);
|
||||
return new EzpWriteSectorsPatchCode(patchHeap);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ DEFINE_SECTION_SYMBOLS(ezp_readsddata);
|
||||
|
||||
extern "C" void ezp_readSdData(u32 srcSector, void* dst, u32 sectorCount, u32 sectorCountThisRead);
|
||||
|
||||
class EZPReadSDDataPatchCode : public PatchCode
|
||||
class EzpReadSdDataPatchCode : public PatchCode
|
||||
{
|
||||
public:
|
||||
explicit EZPReadSDDataPatchCode(PatchHeap& patchHeap)
|
||||
explicit EzpReadSdDataPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(ezp_readsddata), SECTION_SIZE(ezp_readsddata), patchHeap) { }
|
||||
|
||||
const void* GetReadSDDataFunction() const
|
||||
27
arm9/source/patches/platform/ezp/EzpReadSectorsPatchCode.h
Normal file
27
arm9/source/patches/platform/ezp/EzpReadSectorsPatchCode.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
#include "EzpReadSdDataPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ezp_readsectors);
|
||||
|
||||
extern "C" void ezp_readSectors(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern "C" u32 ezp_readSectors_readSdData_address;
|
||||
|
||||
class EzpReadSectorsPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit EzpReadSectorsPatchCode(PatchHeap& patchHeap,
|
||||
const EzpReadSdDataPatchCode* ezpReadSdDataPatchCode)
|
||||
: PatchCode(SECTION_START(ezp_readsectors), SECTION_SIZE(ezp_readsectors), patchHeap)
|
||||
{
|
||||
ezp_readSectors_readSdData_address = (u32)ezpReadSdDataPatchCode->GetReadSDDataFunction();
|
||||
}
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)ezp_readSectors);
|
||||
}
|
||||
};
|
||||
20
arm9/source/patches/platform/ezp/EzpWriteSectorsPatchCode.h
Normal file
20
arm9/source/patches/platform/ezp/EzpWriteSectorsPatchCode.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ezp_writesectors);
|
||||
|
||||
extern "C" void ezp_writeSectors(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class EzpWriteSectorsPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit EzpWriteSectorsPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(ezp_writesectors), SECTION_SIZE(ezp_writesectors), patchHeap) { }
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)ezp_writeSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "ezpReadSdDataAsm.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ezp_readsectors);
|
||||
|
||||
extern "C" void ezp_readSectors(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern "C" u32 ezp_readSectors_readSdData_address;
|
||||
|
||||
class EZPReadSectorsPatchCode : public SdReadPatchCode
|
||||
{
|
||||
public:
|
||||
explicit EZPReadSectorsPatchCode(PatchHeap& patchHeap,
|
||||
const EZPReadSDDataPatchCode* ezpReadSdDataPatchCode)
|
||||
: SdReadPatchCode(SECTION_START(ezp_readsectors), SECTION_SIZE(ezp_readsectors), patchHeap)
|
||||
{
|
||||
ezp_readSectors_readSdData_address = (u32)ezpReadSdDataPatchCode->GetReadSDDataFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)ezp_readSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(ezp_writesectors);
|
||||
|
||||
extern "C" void ezp_writeSectors(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class EZPWriteSectorsPatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
explicit EZPWriteSectorsPatchCode(PatchHeap& patchHeap)
|
||||
: SdWritePatchCode(SECTION_START(ezp_writesectors), SECTION_SIZE(ezp_writesectors), patchHeap) { }
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)ezp_writeSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "g003ReadSdAsm.h"
|
||||
#include "g003ReadSdDmaAsm.h"
|
||||
#include "g003WriteSdAsm.h"
|
||||
#include "G003ReadSdPatchCode.h"
|
||||
#include "G003ReadSdDmaPatchCode.h"
|
||||
#include "G003WriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the GMP-Z003 flashcard
|
||||
class G003LoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -18,14 +17,14 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdReadDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
|
||||
const IReadSectorsDmaPatchCode* CreateSdReadDmaPatchCode(PatchCodeCollection& patchCodeCollection,
|
||||
PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr) const override
|
||||
{
|
||||
return patchCodeCollection.AddUniquePatchCode<G003ReadSdDmaPatchCode>(
|
||||
patchHeap, miiCardDmaCopy32Ptr);
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
|
||||
31
arm9/source/patches/platform/g003/G003ReadSdDmaPatchCode.h
Normal file
31
arm9/source/patches/platform/g003/G003ReadSdDmaPatchCode.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsDmaPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(g003_readsddma);
|
||||
|
||||
extern "C" void g003_readSdDma(u32 srcSector, u32 previousSrcSector, u32 dmaChannel, void* dst);
|
||||
extern "C" void g003_finishReadSdDma(void);
|
||||
|
||||
extern u32 g003_readSdDma_miiCardDmaCopy32Ptr;
|
||||
|
||||
class G003ReadSdDmaPatchCode : public PatchCode, public IReadSectorsDmaPatchCode
|
||||
{
|
||||
public:
|
||||
G003ReadSdDmaPatchCode(PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr)
|
||||
: PatchCode(SECTION_START(g003_readsddma), SECTION_SIZE(g003_readsddma), patchHeap)
|
||||
{
|
||||
g003_readSdDma_miiCardDmaCopy32Ptr = (u32)miiCardDmaCopy32Ptr;
|
||||
}
|
||||
|
||||
const ReadSectorsDmaFunc GetSdReadDmaFunction() const override
|
||||
{
|
||||
return (const ReadSectorsDmaFunc)GetAddressAtTarget((void*)g003_readSdDma);
|
||||
}
|
||||
|
||||
const ReadSectorsDmaFinishFunc GetSdReadDmaFinishFunction() const override
|
||||
{
|
||||
return (const ReadSectorsDmaFinishFunc)GetAddressAtTarget((void*)g003_finishReadSdDma);
|
||||
}
|
||||
};
|
||||
20
arm9/source/patches/platform/g003/G003ReadSdPatchCode.h
Normal file
20
arm9/source/patches/platform/g003/G003ReadSdPatchCode.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(g003_readsd);
|
||||
|
||||
extern "C" void g003_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class G003ReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit G003ReadSdPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(g003_readsd), SECTION_SIZE(g003_readsd), patchHeap) { }
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)g003_readSd);
|
||||
}
|
||||
};
|
||||
20
arm9/source/patches/platform/g003/G003WriteSdPatchCode.h
Normal file
20
arm9/source/patches/platform/g003/G003WriteSdPatchCode.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(g003_writesd);
|
||||
|
||||
extern "C" void g003_writeSd(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class G003WriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit G003WriteSdPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(g003_writesd), SECTION_SIZE(g003_writesd), patchHeap) { }
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)g003_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(g003_readsd);
|
||||
|
||||
extern "C" void g003_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class G003ReadSdPatchCode : public SdReadPatchCode
|
||||
{
|
||||
public:
|
||||
explicit G003ReadSdPatchCode(PatchHeap& patchHeap)
|
||||
: SdReadPatchCode(SECTION_START(g003_readsd), SECTION_SIZE(g003_readsd), patchHeap) { }
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)g003_readSd);
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadDmaPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(g003_readsddma);
|
||||
|
||||
extern "C" void g003_readSdDma(u32 srcSector, u32 previousSrcSector, u32 dmaChannel, void* dst);
|
||||
extern "C" void g003_finishReadSdDma(void);
|
||||
|
||||
extern u32 g003_readSdDma_miiCardDmaCopy32Ptr;
|
||||
|
||||
class G003ReadSdDmaPatchCode : public SdReadDmaPatchCode
|
||||
{
|
||||
public:
|
||||
explicit G003ReadSdDmaPatchCode(PatchHeap& patchHeap, const void* miiCardDmaCopy32Ptr)
|
||||
: SdReadDmaPatchCode(SECTION_START(g003_readsddma), SECTION_SIZE(g003_readsddma), patchHeap)
|
||||
{
|
||||
g003_readSdDma_miiCardDmaCopy32Ptr = (u32)miiCardDmaCopy32Ptr;
|
||||
}
|
||||
|
||||
const SdReadDmaFunc GetSdReadDmaFunction() const override
|
||||
{
|
||||
return (const SdReadDmaFunc)GetAddressAtTarget((void*)g003_readSdDma);
|
||||
}
|
||||
|
||||
const SdReadDmaFinishFunc GetSdReadDmaFinishFunction() const override
|
||||
{
|
||||
return (const SdReadDmaFinishFunc)GetAddressAtTarget((void*)g003_finishReadSdDma);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(g003_writesd);
|
||||
|
||||
extern "C" void g003_writeSd(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class G003WriteSdPatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
explicit G003WriteSdPatchCode(PatchHeap& patchHeap)
|
||||
: SdWritePatchCode(SECTION_START(g003_writesd), SECTION_SIZE(g003_writesd), patchHeap) { }
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)g003_writeSd);
|
||||
}
|
||||
};
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "IsNitroSdReadAsm.h"
|
||||
#include "IsNitroSdWriteAsm.h"
|
||||
#include "IsNitroSdReadPatchCode.h"
|
||||
#include "IsNitroSdWritePatchCode.h"
|
||||
#include "sharedMemory.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the IS-NITRO-EMULATOR with agb semihosting
|
||||
class IsNitroLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -18,7 +17,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(sdread);
|
||||
|
||||
extern "C" void sdread_asm(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 sdread_asm_agbRamPtr;
|
||||
|
||||
class IsNitroSdReadPatchCode : public SdReadPatchCode
|
||||
{
|
||||
public:
|
||||
IsNitroSdReadPatchCode(PatchHeap& patchHeap, u32 agbRamPtr)
|
||||
: SdReadPatchCode(SECTION_START(sdread), SECTION_SIZE(sdread), patchHeap)
|
||||
{
|
||||
sdread_asm_agbRamPtr = agbRamPtr;
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)sdread_asm);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(sdread);
|
||||
|
||||
extern "C" void sdread_asm(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
extern u32 sdread_asm_agbRamPtr;
|
||||
|
||||
class IsNitroSdReadPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
IsNitroSdReadPatchCode(PatchHeap& patchHeap, u32 agbRamPtr)
|
||||
: PatchCode(SECTION_START(sdread), SECTION_SIZE(sdread), patchHeap)
|
||||
{
|
||||
sdread_asm_agbRamPtr = agbRamPtr;
|
||||
}
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)sdread_asm);
|
||||
}
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(sdwrite);
|
||||
|
||||
extern "C" void sdwrite_asm(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
extern u32 sdwrite_asm_agbRamPtr;
|
||||
|
||||
class IsNitroSdWritePatchCode : public SdWritePatchCode
|
||||
{
|
||||
public:
|
||||
IsNitroSdWritePatchCode(PatchHeap& patchHeap, u32 agbRamPtr)
|
||||
: SdWritePatchCode(SECTION_START(sdwrite), SECTION_SIZE(sdwrite), patchHeap)
|
||||
{
|
||||
sdwrite_asm_agbRamPtr = agbRamPtr;
|
||||
}
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)sdwrite_asm);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(sdwrite);
|
||||
|
||||
extern "C" void sdwrite_asm(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
extern u32 sdwrite_asm_agbRamPtr;
|
||||
|
||||
class IsNitroSdWritePatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
IsNitroSdWritePatchCode(PatchHeap& patchHeap, u32 agbRamPtr)
|
||||
: PatchCode(SECTION_START(sdwrite), SECTION_SIZE(sdwrite), patchHeap)
|
||||
{
|
||||
sdwrite_asm_agbRamPtr = agbRamPtr;
|
||||
}
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)sdwrite_asm);
|
||||
}
|
||||
};
|
||||
@@ -37,7 +37,7 @@ sdwrite_asm:
|
||||
subs r0, #1
|
||||
bne 4b
|
||||
mov r5, lr
|
||||
|
||||
|
||||
// GBA slot irq bit: 1 << 13
|
||||
movs r4, #1
|
||||
lsls r3, r4, #13
|
||||
@@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "m3dsReadSectorsAsm.h"
|
||||
#include "m3dsWriteSectorsAsm.h"
|
||||
#include "M3DSReadSdSectorsPatchCode.h"
|
||||
#include "M3DSWriteSdSectorsPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for the M3 DS Real flashcard
|
||||
class M3DSLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -21,7 +20,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdReadPatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(m3ds_readsdsectors);
|
||||
DEFINE_SECTION_SYMBOLS(m3ds_readsdsectors_receiveSector);
|
||||
@@ -22,17 +23,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class M3DSReadSdSectorsPatchCode : public SdReadPatchCode
|
||||
class M3DSReadSdSectorsPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit M3DSReadSdSectorsPatchCode(PatchHeap& patchHeap, const M3DSReceiveSectorPatchCode* m3dsReceiveSectorPatchCode)
|
||||
: SdReadPatchCode(SECTION_START(m3ds_readsdsectors), SECTION_SIZE(m3ds_readsdsectors), patchHeap)
|
||||
M3DSReadSdSectorsPatchCode(PatchHeap& patchHeap, const M3DSReceiveSectorPatchCode* m3dsReceiveSectorPatchCode)
|
||||
: PatchCode(SECTION_START(m3ds_readsdsectors), SECTION_SIZE(m3ds_readsdsectors), patchHeap)
|
||||
{
|
||||
m3ds_receiveSector_address = (u32)m3dsReceiveSectorPatchCode->GetReceiveSectorFunction();
|
||||
}
|
||||
|
||||
const SdReadFunc GetSdReadFunction() const override
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const SdReadFunc)GetAddressAtTarget((void*)m3ds_readSdSectors);
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)m3ds_readSdSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "../SdWritePatchCode.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(m3ds_writesdsectors);
|
||||
DEFINE_SECTION_SYMBOLS(m3ds_writesdsectors_sendSector);
|
||||
@@ -22,17 +23,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class M3DSWriteSdSectorsPatchCode : public SdWritePatchCode
|
||||
class M3DSWriteSdSectorsPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
M3DSWriteSdSectorsPatchCode(PatchHeap& patchHeap, const M3DSSendSectorPatchCode* m3dsSendSectorPatchCode)
|
||||
: SdWritePatchCode(SECTION_START(m3ds_writesdsectors), SECTION_SIZE(m3ds_writesdsectors), patchHeap)
|
||||
: PatchCode(SECTION_START(m3ds_writesdsectors), SECTION_SIZE(m3ds_writesdsectors), patchHeap)
|
||||
{
|
||||
m3ds_sendSector_address = (u32)m3dsSendSectorPatchCode->GetSendSectorFunction();
|
||||
}
|
||||
|
||||
const SdWriteFunc GetSdWriteFunction() const override
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const SdWriteFunc)GetAddressAtTarget((void*)m3ds_writeSdSectors);
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)m3ds_writeSdSectors);
|
||||
}
|
||||
};
|
||||
@@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "../LoaderPlatform.h"
|
||||
#include "melondsReadSdAsm.h"
|
||||
#include "melondsWriteSdAsm.h"
|
||||
#include "MelonDSReadSdPatchCode.h"
|
||||
#include "MelonDSWriteSdPatchCode.h"
|
||||
|
||||
/// @brief Implementation of LoaderPlatform for MelonDS
|
||||
class MelonDSLoaderPlatform : public LoaderPlatform
|
||||
{
|
||||
public:
|
||||
const SdReadPatchCode* CreateSdReadPatchCode(
|
||||
const IReadSectorsPatchCode* CreateSdReadPatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
@@ -17,7 +16,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
const SdWritePatchCode* CreateSdWritePatchCode(
|
||||
const IWriteSectorsPatchCode* CreateSdWritePatchCode(
|
||||
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const override
|
||||
{
|
||||
return patchCodeCollection.GetOrAddSharedPatchCode([&]
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IReadSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(melonds_readsd);
|
||||
|
||||
extern "C" void melonds_readSd(u32 srcSector, void* dst, u32 sectorCount);
|
||||
|
||||
class MelonDSReadSdPatchCode : public PatchCode, public IReadSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit MelonDSReadSdPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(melonds_readsd), SECTION_SIZE(melonds_readsd), patchHeap) { }
|
||||
|
||||
const ReadSectorsFunc GetReadSectorsFunction() const override
|
||||
{
|
||||
return (const ReadSectorsFunc)GetAddressAtTarget((void*)melonds_readSd);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "sections.h"
|
||||
#include "patches/PatchCode.h"
|
||||
#include "../IWriteSectorsPatchCode.h"
|
||||
|
||||
DEFINE_SECTION_SYMBOLS(melonds_writesd);
|
||||
|
||||
extern "C" void melonds_writeSd(u32 dstSector, const void* src, u32 sectorCount);
|
||||
|
||||
class MelonDSWriteSdPatchCode : public PatchCode, public IWriteSectorsPatchCode
|
||||
{
|
||||
public:
|
||||
explicit MelonDSWriteSdPatchCode(PatchHeap& patchHeap)
|
||||
: PatchCode(SECTION_START(melonds_writesd), SECTION_SIZE(melonds_writesd), patchHeap) { }
|
||||
|
||||
const WriteSectorsFunc GetWriteSectorFunction() const override
|
||||
{
|
||||
return (const WriteSectorsFunc)GetAddressAtTarget((void*)melonds_writeSd);
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user