mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-25 03:11:58 +01:00
-fixed booting big homebrew applications (32MB max, but
only tested with 7MB so not sure if so much still works)
This commit is contained in:
parent
3153ef3d2e
commit
091e9bcb1e
@ -26,13 +26,14 @@ bool bootHB;
|
|||||||
|
|
||||||
bool IsDollZ (u8 *buff)
|
bool IsDollZ (u8 *buff)
|
||||||
{
|
{
|
||||||
u8 dollz_stamp[] = {0x3C};
|
u8 dollz_stamp[] = {0x3C};
|
||||||
int dollz_offs = 0x100;
|
int dollz_offs = 0x100;
|
||||||
|
|
||||||
int ret = memcmp (&buff[dollz_offs], dollz_stamp, sizeof(dollz_stamp));
|
int ret = memcmp (&buff[dollz_offs], dollz_stamp, sizeof(dollz_stamp));
|
||||||
if (ret == 0) return true;
|
if (ret == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBootArgument(const char * argv)
|
void AddBootArgument(const char * argv)
|
||||||
@ -44,9 +45,8 @@ void AddBootArgument(const char * argv)
|
|||||||
int CopyHomebrewMemory(u8 *temp, u32 pos, u32 len)
|
int CopyHomebrewMemory(u8 *temp, u32 pos, u32 len)
|
||||||
{
|
{
|
||||||
homebrewsize += len;
|
homebrewsize += len;
|
||||||
memcpy(homebrewbuffer+pos, temp, len);
|
memcpy(homebrewbuffer+pos, temp, len);
|
||||||
DCFlushRange(homebrewbuffer+pos, len);
|
DCFlushRange(homebrewbuffer+pos, len);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,38 +60,36 @@ void FreeHomebrewBuffer()
|
|||||||
|
|
||||||
int LoadHomebrew(const char * filepath)
|
int LoadHomebrew(const char * filepath)
|
||||||
{
|
{
|
||||||
if(!filepath) return -1;
|
if(!filepath)
|
||||||
|
return -1;
|
||||||
|
|
||||||
FILE *file = fopen(filepath ,"rb");
|
FILE *file = fopen(filepath ,"rb");
|
||||||
if(!file) return -2;
|
if(!file)
|
||||||
|
return -2;
|
||||||
|
|
||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
u32 filesize = ftell(file);
|
u32 filesize = ftell(file);
|
||||||
rewind(file);
|
rewind(file);
|
||||||
|
|
||||||
SmartBuf buffer = smartAnyAlloc(filesize);
|
if(filesize > 33554431)
|
||||||
if (!buffer)
|
return -3;
|
||||||
|
|
||||||
|
bool good_read = fread(homebrewbuffer, 1, filesize, file) == filesize;
|
||||||
|
if (!good_read)
|
||||||
{
|
{
|
||||||
SAFE_CLOSE(file);
|
SAFE_CLOSE(file);
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool good_read = fread((u8 *)buffer.get(), 1, filesize, file) == filesize;
|
|
||||||
if (!good_read)
|
|
||||||
{
|
|
||||||
SAFE_CLOSE(file);
|
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
SAFE_CLOSE(file);
|
SAFE_CLOSE(file);
|
||||||
|
|
||||||
DCFlushRange((u8 *)buffer.get(), filesize);
|
homebrewsize += filesize;
|
||||||
|
return 1;
|
||||||
return CopyHomebrewMemory((u8*)buffer.get(), 0, filesize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SetupARGV(struct __argv * args)
|
static int SetupARGV(struct __argv * args)
|
||||||
{
|
{
|
||||||
if(!args) return -1;
|
if(!args)
|
||||||
|
return -1;
|
||||||
|
|
||||||
bzero(args, sizeof(struct __argv));
|
bzero(args, sizeof(struct __argv));
|
||||||
args->argvMagic = ARGV_MAGIC;
|
args->argvMagic = ARGV_MAGIC;
|
||||||
@ -129,7 +127,8 @@ static int SetupARGV(struct __argv * args)
|
|||||||
|
|
||||||
int BootHomebrew()
|
int BootHomebrew()
|
||||||
{
|
{
|
||||||
if(homebrewsize == 0) return -1;
|
if(homebrewsize == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
struct __argv args;
|
struct __argv args;
|
||||||
if (!IsDollZ(homebrewbuffer))
|
if (!IsDollZ(homebrewbuffer))
|
||||||
|
Loading…
Reference in New Issue
Block a user