5f32779ceb
- To override the last used boot mode on soft reboot, you only need to press A if you want to boot to the default option. Holding L(+payload button)/R is enough for the other modes. - Added version number to the config menu - Replaced the memsearch algorithm with a faster one - Integrated 3ds_injector from @yifanlu. This brings us region free and all the other FreeMultiPatcher patches. Other than that, you now have the possibility to display the currently booted NAND/FIRM in System Settings! - Rewritten most code for the config menu. You now can navigate to the first/last options with left and right. - You can now choose the 9.0 FIRM to be default in the config menu. This will essentially switch "no buttons" and L in both modes. - You can now choose the second emuNAND to be default in the config menu. This will essentially switch "B is not pressed" and "B is pressed". - When the second emuNAND is booted, it will persist like the other boot options on soft reboot - Bugfixes
106 lines
1.5 KiB
C
106 lines
1.5 KiB
C
#include <3ds.h>
|
|
#include "ifile.h"
|
|
#include "fsldr.h"
|
|
|
|
Result IFile_Open(IFile *file, FS_Archive archive, FS_Path path, u32 flags)
|
|
{
|
|
Result res;
|
|
|
|
res = FSLDR_OpenFileDirectly(&file->handle, archive, path, flags, 0);
|
|
file->pos = 0;
|
|
file->size = 0;
|
|
return res;
|
|
}
|
|
|
|
Result IFile_Close(IFile *file)
|
|
{
|
|
return FSFILE_Close(file->handle);
|
|
}
|
|
|
|
Result IFile_GetSize(IFile *file, u64 *size)
|
|
{
|
|
Result res;
|
|
|
|
res = FSFILE_GetSize(file->handle, size);
|
|
file->size = *size;
|
|
return res;
|
|
}
|
|
|
|
Result IFile_Read(IFile *file, u64 *total, void *buffer, u32 len)
|
|
{
|
|
u32 read;
|
|
u32 left;
|
|
char *buf;
|
|
u64 cur;
|
|
Result res;
|
|
|
|
if (len == 0)
|
|
{
|
|
*total = 0;
|
|
return 0;
|
|
}
|
|
|
|
buf = (char *)buffer;
|
|
cur = 0;
|
|
left = len;
|
|
while (1)
|
|
{
|
|
res = FSFILE_Read(file->handle, &read, file->pos, buf, left);
|
|
if (R_FAILED(res))
|
|
{
|
|
break;
|
|
}
|
|
|
|
cur += read;
|
|
file->pos += read;
|
|
if (read == left)
|
|
{
|
|
break;
|
|
}
|
|
buf += read;
|
|
left -= read;
|
|
}
|
|
|
|
*total = cur;
|
|
return res;
|
|
}
|
|
|
|
Result IFile_Write(IFile *file, u64 *total, void *buffer, u32 len, u32 flags)
|
|
{
|
|
u32 written;
|
|
u32 left;
|
|
char *buf;
|
|
u64 cur;
|
|
Result res;
|
|
|
|
if (len == 0)
|
|
{
|
|
*total = 0;
|
|
return 0;
|
|
}
|
|
|
|
buf = (char *)buffer;
|
|
cur = 0;
|
|
left = len;
|
|
while (1)
|
|
{
|
|
res = FSFILE_Write(file->handle, &written, file->pos, buf, left, flags);
|
|
if (R_FAILED(res))
|
|
{
|
|
break;
|
|
}
|
|
|
|
cur += written;
|
|
file->pos += written;
|
|
if (written == left)
|
|
{
|
|
break;
|
|
}
|
|
buf += written;
|
|
left -= written;
|
|
}
|
|
|
|
*total = cur;
|
|
return res;
|
|
}
|