2
3
4
5
6
7
8
9
10
11
12#ifndef EVMU_FS_UTILS_H
13#define EVMU_FS_UTILS_H
15#include "../evmu_api.h"
16#include <gimbal/utils/gimbal_date_time.h>
19
20
21
22#define EVMU_DIRECTORY_ENTRY_SIZE 32
23#define EVMU_DIRECTORY_FILE_NAME_SIZE 12
24#define EVMU_DIRECTORY_UNUSED_SIZE 4
41} EVMU_COPY_PROTECTION;
66
67
82typedef GblBool (*EvmuDirEntryIterFn)(EvmuDirEntry* pEntry,
void* pClosure);
84GBL_STATIC_ASSERT(
sizeof(EvmuDirEntry) == 32);
87
88
89
90
93 GblStringBuffer* pStr) GBL_NOEXCEPT;
96 const char* pStr) GBL_NOEXCEPT;
104
105
106
107
110 GblDateTime* pDateTime) GBL_NOEXCEPT;
113 const GblDateTime* pDateTime) GBL_NOEXCEPT;
117
118
119
120
123 const char* pFileName,
125 EVMU_FILE_TYPE fileType,
126 EVMU_COPY_PROTECTION copyProtection) GBL_NOEXCEPT;
129 GblStringBuffer* pBuffer) GBL_NOEXCEPT;
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
#define EVMU_DIRECTORY_UNUSED_SIZE
#define EVMU_DIRECTORY_FILE_NAME_SIZE
Maximum file name size in bytes for a directory entry (no NULL terminator)
EVMU_FILE_TYPE
Type of file stored on the filesystem.
@ EVMU_FILE_TYPE_NONE
Not a file.
@ EVMU_FILE_TYPE_DATA
Save DATA file.
@ EVMU_FILE_TYPE_GAME
Mini GAME file.
EVMU_COPY_PROTECTION
Copy protection type byte.
@ EVMU_COPY_ALLOWED
Not copy protected.
@ EVMU_COPY_UNKNOWN
Unknown/Other.
@ EVMU_COPY_PROTECTED
Copy protected.
Represents a single entry into the FAT directory.
uint8_t copyProtection
EVMU_COPY_TYPE for file.
uint8_t unused[4]
Unused/reserved bytes (all 0s)
const char * EvmuDirEntry_fileTypeStr(const EvmuDirEntry *pSelf)
Returns the a string representation of EvmuDirEntry::fileType.
const char * EvmuDirEntry_protectedStr(const EvmuDirEntry *pSelf)
Returns the a string representation of EvmuDirEntry::copyProtection.
const char * EvmuDirEntry_name(const EvmuDirEntry *pSelf, GblStringBuffer *pStr)
Fills the buffer with the EvmuDirEntry::fileName field and returns a pointer to its internal C string...
size_t EvmuDirEntry_setName(EvmuDirEntry *pSelf, const char *pStr)
Writes the given string to the EvmuDirEntry::fileName field, returning number of bytes written.
char fileName[12]
File name: Shift-JS encoding without NULL terminator.
uint16_t fileSize
Size of file in blocks.
EvmuTimestamp timestamp
File creation date timestamp.
uint8_t fileType
EVMU_FILE_TYPE for file.
Properties for creating a new file on flash.
char name[12]
Name on the filesystem (see EvmuDirEntry::fileName)
uint8_t copy
Copy protection setting.
size_t bytes
Size in bytes.
void EvmuNewFileInfo_init(EvmuNewFileInfo *pSelf, const char *pFileName, size_t fileSize, EVMU_FILE_TYPE fileType, EVMU_COPY_PROTECTION copyProtection)
Initializes an EvmuNewFileInfo structure with the given properties.
const char * EvmuNewFileInfo_name(const EvmuNewFileInfo *pSelf, GblStringBuffer *pBuffer)
Populates the GblStringBuffer with the filename, returning a pointer to its internal storage.
Filesystem timestamp, stored in BCD format.
uint8_t year
Date year (last two digits) (BCD)
uint8_t day
Date day (1-31) (BCD)
uint8_t century
Date century (first two digits) (BCD)
void EvmuTimestamp_setDateTime(EvmuTimestamp *pSelf, const GblDateTime *pDateTime)
Converts the given GblDateTime into an EvmuTimestamp.
uint8_t hour
Time hour (0-23) (BCD)
uint8_t minute
Time minute (0-59) (BCD)
uint8_t month
Date month (1-12) (BCD)
uint8_t weekDay
Day of the week (0-6) (BCD)
GblDateTime * EvmuTimestamp_dateTime(const EvmuTimestamp *pSelf, GblDateTime *pDateTime)
Converts the given EvmuTimestamp into the given GblDateTime, also returning it.
uint8_t second
Time second (0-59) (BCD)