2016-03-21 18:29:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.h"
|
2016-11-15 23:06:01 +01:00
|
|
|
#include "dir.h"
|
2016-03-21 18:29:55 +01:00
|
|
|
#include "nand.h"
|
|
|
|
|
2016-04-04 22:45:49 +02:00
|
|
|
#define VRT_SYSNAND NAND_SYSNAND
|
|
|
|
#define VRT_EMUNAND NAND_EMUNAND
|
|
|
|
#define VRT_IMGNAND NAND_IMGNAND
|
2016-04-09 21:50:50 +02:00
|
|
|
#define VRT_MEMORY (1<<10)
|
2016-11-25 18:30:01 +01:00
|
|
|
#define VRT_GAME (1<<11)
|
2016-03-22 14:30:11 +01:00
|
|
|
|
2016-04-22 17:47:13 +02:00
|
|
|
#define VFLAG_A9LH_AREA (1<<20)
|
2016-04-22 15:48:57 +02:00
|
|
|
|
2016-11-14 22:24:20 +01:00
|
|
|
// virtual file flag (subject to change):
|
|
|
|
// bits 0...9 : reserved for NAND virtual sources and info
|
2016-11-25 18:30:01 +01:00
|
|
|
// bits 10...15: reserved for other virtual sources
|
|
|
|
// bits 16...23: reserved for external flags
|
2016-11-14 22:24:20 +01:00
|
|
|
// bits 24...31: reserved for internal flags (different per source)
|
2016-03-21 18:29:55 +01:00
|
|
|
typedef struct {
|
2016-11-25 18:30:01 +01:00
|
|
|
char name[32];
|
|
|
|
u32 offset; // must be a multiple of 0x200 (for NAND access)
|
2016-03-21 18:29:55 +01:00
|
|
|
u32 size;
|
|
|
|
u32 keyslot;
|
|
|
|
u32 flags;
|
|
|
|
} __attribute__((packed)) VirtualFile;
|
|
|
|
|
2016-04-09 21:56:42 +02:00
|
|
|
u32 GetVirtualSource(const char* path);
|
|
|
|
bool CheckVirtualDrive(const char* path);
|
2016-11-15 23:34:21 +01:00
|
|
|
bool GetVirtualFile(VirtualFile* vfile, const char* path);
|
|
|
|
bool FindVirtualFileBySize(VirtualFile* vfile, const char* path, u32 size);
|
2016-11-15 23:06:01 +01:00
|
|
|
bool GetVirtualDirContents(DirStruct* contents, const char* path, const char* pattern);
|
2016-04-08 21:02:38 +02:00
|
|
|
int ReadVirtualFile(const VirtualFile* vfile, u8* buffer, u32 offset, u32 count, u32* bytes_read);
|
|
|
|
int WriteVirtualFile(const VirtualFile* vfile, const u8* buffer, u32 offset, u32 count, u32* bytes_written);
|