mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
HOTSWサンプルコードの変更
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1237 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
b47edd4ad4
commit
5f9ff91070
@ -53,7 +53,7 @@ static u8 rom_arm7[1024*1024] ATTRIBUTE_ALIGN(32);
|
|||||||
デバイスアクセスAPI
|
デバイスアクセスAPI
|
||||||
*/
|
*/
|
||||||
#if 1
|
#if 1
|
||||||
// FS”Ĺ (fctx == FSFile*)
|
// FSӁ (arg == FSFile*)
|
||||||
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
||||||
{
|
{
|
||||||
FSFile* fp = arg;
|
FSFile* fp = arg;
|
||||||
@ -74,7 +74,7 @@ static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
|||||||
#else
|
#else
|
||||||
#ifdef SDK_ARM9
|
#ifdef SDK_ARM9
|
||||||
#define PAGE_SIZE 512
|
#define PAGE_SIZE 512
|
||||||
// CARD”Ĺ (fctx == dma no)
|
// CARDӁ (arg == dma no)
|
||||||
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
||||||
{
|
{
|
||||||
u32 dma = (u32)arg;
|
u32 dma = (u32)arg;
|
||||||
@ -82,12 +82,33 @@ static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// HOTSW”Ĺ (fctx == CardBootData* cdb)
|
// HOTSWӁ (arg == CardBootData* cdb)
|
||||||
#include <hotswTypes.h>
|
#include <hotswTypes.h>
|
||||||
#include <dsCardCommon.h>
|
#include <dsCardCommon.h>
|
||||||
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
|
||||||
{
|
{
|
||||||
HotSwState retval = ReadPageGame((CardBootData*)arg, (u32)offset, dest, (u32)length);
|
HotSwState retval;
|
||||||
|
if ( offset % 512 )
|
||||||
|
{
|
||||||
|
static u8 page_buffer[512];
|
||||||
|
u32 page_offset = (u32)(offset & -512);
|
||||||
|
u32 buffer_offset = (u32)(offset % 512);
|
||||||
|
u32 valid_length = 512 - buffer_offset;
|
||||||
|
retval = ReadPageGame((CardBootData*)arg, page_offset, page_buffer, 512);
|
||||||
|
if (retval != HOTSW_SUCCESS)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length));
|
||||||
|
dest = (u8*)dest + valid_length;
|
||||||
|
offset += valid_length;
|
||||||
|
length -= valid_length;
|
||||||
|
if ( length < 0)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retval = ReadPageGame((CardBootData*)arg, (u32)offset, dest, (u32)length);
|
||||||
return (retval == HOTSW_SUCCESS);
|
return (retval == HOTSW_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user