mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-25 03:11:58 +01:00
f41e01ff87
-added new option, "force_cios_rev" (default 0 (=disabled)), if you set it to for example "force_cios_rev=250", then wiiflow will use IOS250 for the AUTO setting, for reload when using "force_cios_load" and when switching to emu nand in IOS58 mode -added more detailed debug prints and on screen information about the currently loaded cIOS -minor cleanup in nand get file and external booter
52 lines
941 B
C
52 lines
941 B
C
|
|
#include <ogcsys.h>
|
|
#include <locale.h>
|
|
#include <ogc/isfs.h>
|
|
#include <string.h>
|
|
|
|
#include "fs.h"
|
|
#include "utils.h"
|
|
#include "gecko/gecko.h"
|
|
#include "memory/mem2.hpp"
|
|
|
|
static fstats stats ATTRIBUTE_ALIGN(32);
|
|
|
|
u8 *ISFS_GetFile(const char *path, u32 *size, s32 length)
|
|
{
|
|
*size = 0;
|
|
//gprintf("ISFS_GetFile %s", path);
|
|
s32 fd = ISFS_Open(path, ISFS_OPEN_READ);
|
|
u8 *buf = NULL;
|
|
|
|
if(fd >= 0)
|
|
{
|
|
memset(&stats, 0, sizeof(fstats));
|
|
if(ISFS_GetFileStats(fd, &stats) >= 0)
|
|
{
|
|
if(length <= 0)
|
|
length = stats.file_length;
|
|
if(length > 0)
|
|
buf = (u8 *)MEM2_memalign(32, ALIGN32(length));
|
|
if(buf)
|
|
{
|
|
*size = stats.file_length;
|
|
if(ISFS_Read(fd, (char*)buf, length) != length)
|
|
{
|
|
*size = 0;
|
|
MEM2_free(buf);
|
|
}
|
|
}
|
|
}
|
|
ISFS_Close(fd);
|
|
}
|
|
if(*size > 0)
|
|
{
|
|
//gprintf(" succeed!\n");
|
|
DCFlushRange(buf, *size);
|
|
ICInvalidateRange(buf, *size);
|
|
}
|
|
//else
|
|
// gprintf(" failed!\n");
|
|
return buf;
|
|
}
|