mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
* DATEL: Make read sector function vram safe The platform code was performing reads in single byte units, breaking in case the destination buffer was in vram. This caused issues with some games (e.g. Castelvania Order of Ecclesia), and also broke soft resetting. * Halve wait timeout on sector read since we read 2 bytes at the time
34 lines
1.3 KiB
C++
34 lines
1.3 KiB
C++
#pragma once
|
|
#include "sections.h"
|
|
#include "../SdReadPatchCode.h"
|
|
DEFINE_SECTION_SYMBOLS(datel_read);
|
|
|
|
extern u16 datel_readSectorSdhcLabel;
|
|
|
|
extern u32 datel_SDReadMultipleSector_SpiSendSDIOCommandR0;
|
|
|
|
extern u32 datel_SDReadMultipleSector_ReadSpiByteTimeout;
|
|
extern u32 datel_SDReadMultipleSector_ReadSpiShort;
|
|
|
|
extern "C" void datel_SDReadMultipleSector(u32 srcSector, void* dst, u32 sectorCount);
|
|
|
|
class DatelReadSdPatchCode : public SdReadPatchCode
|
|
{
|
|
public:
|
|
DatelReadSdPatchCode(PatchHeap& patchHeap,
|
|
const DatelReadSpiBytePatchCode* datelReadSpiBytePatchCode,
|
|
const DatelSendSDIOCommandPatchCode* datelSendSDIOCommandPatchCode)
|
|
: SdReadPatchCode(SECTION_START(datel_read), SECTION_SIZE(datel_read), patchHeap)
|
|
{
|
|
datel_SDReadMultipleSector_SpiSendSDIOCommandR0 = (u32)datelSendSDIOCommandPatchCode->GetSpiSendSDIOCommandR0Function();
|
|
|
|
datel_SDReadMultipleSector_ReadSpiByteTimeout = (u32)datelReadSpiBytePatchCode->GetReadSpiByteTimeoutFunction();
|
|
datel_SDReadMultipleSector_ReadSpiShort = (u32)datelReadSpiBytePatchCode->GetReadSpiShortFunction();
|
|
}
|
|
|
|
const SdReadFunc GetSdReadFunction() const override
|
|
{
|
|
return (const SdReadFunc)GetAddressAtTarget((void*)datel_SDReadMultipleSector);
|
|
}
|
|
};
|