mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-06 00:19:22 +02:00
Wrapper to turn romfs_file into romfs_fileobj
Useful for turning romfs_direntry files into readable files
This commit is contained in:
parent
13d880fe12
commit
6218f4875c
@ -161,6 +161,14 @@ Result romfsFindFile(const char *path, romfs_fileobj *file);
|
||||
*/
|
||||
Result romfsFindFileInMount(romfs_mount *mount, const char *path, romfs_fileobj *file);
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for turning a romfs_file into a romfs_fileobj to be operated on, this
|
||||
* is useful for creating readable files from a romfs_direntry
|
||||
* @param mount The mount the file came from
|
||||
* @param file The file information
|
||||
*/
|
||||
romfs_fileobj romfsFileObj(romfs_mount *mount, romfs_file *file);
|
||||
|
||||
/**
|
||||
* @brief Reads data from the specified RomFS file.
|
||||
* @param file The RomFS file to read from.
|
||||
|
@ -685,6 +685,16 @@ Result romfsFindFileInMount(romfs_mount *mount, const char *path, romfs_fileobj
|
||||
return 0;
|
||||
}
|
||||
|
||||
romfs_fileobj romfsFileObj(romfs_mount *mount, romfs_file *file)
|
||||
{
|
||||
romfs_fileobj result = { 0 };
|
||||
result.mount = mount;
|
||||
result.file = file;
|
||||
result.offset = mount->header.fileDataOff + file->dataOff;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Result romfsReadFile(romfs_fileobj *file, void *buffer, u64 size, u64 offset, u64 *nread)
|
||||
{
|
||||
if (nread == NULL || file == NULL || buffer == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user