diff --git a/configure.py b/configure.py index 0e8539c1..471dba50 100644 --- a/configure.py +++ b/configure.py @@ -1694,7 +1694,7 @@ config.libs = [ Object(NonMatching, "fa/pf_cache.c"), Object(NonMatching, "fa/pf_cluster.c"), Object(NonMatching, "fa/pf_dir.c"), - Object(NonMatching, "fa/pf_entry.c"), + Object(Matching, "fa/pf_entry.c"), Object(NonMatching, "fa/pf_entry_iterator.c"), Object(NonMatching, "fa/pf_fat.c"), Object(NonMatching, "fa/pf_fat12.c"), @@ -1753,15 +1753,15 @@ config.libs = [ Object(Matching, "fa/pf_mkdir.c"), Object(Matching, "fa/pf_mount.c"), Object(NonMatching, "fa/pf_move.c"), - Object(NonMatching, "fa/pf_opendir.c"), - Object(NonMatching, "fa/pf_readdir.c"), + Object(Matching, "fa/pf_opendir.c"), + Object(Matching, "fa/pf_readdir.c"), Object(NonMatching, "fa/pf_regctx.c"), Object(Matching, "fa/pf_remove.c"), Object(Matching, "fa/pf_rename.c"), - Object(NonMatching, "fa/pf_rewinddir.c"), + Object(Matching, "fa/pf_rewinddir.c"), Object(Matching, "fa/pf_rmdir.c"), Object(NonMatching, "fa/pf_rmvvol.c"), - Object(NonMatching, "fa/pf_seekdir.c"), + Object(Matching, "fa/pf_seekdir.c"), Object(NonMatching, "fa/pf_setclstlink.c"), Object(NonMatching, "fa/pf_setcode.c"), Object(NonMatching, "fa/pf_setencode.c"), @@ -1770,7 +1770,7 @@ config.libs = [ Object(NonMatching, "fa/pf_setvol.c"), Object(NonMatching, "fa/pf_setvolcfg.c"), Object(NonMatching, "fa/pf_sync.c"), - Object(NonMatching, "fa/pf_telldir.c"), + Object(Matching, "fa/pf_telldir.c"), Object(Matching, "fa/pf_unmount.c"), Object(NonMatching, "fa/pf_unregctx.c"), Object(NonMatching, "fa/pf_xdivide.c"), diff --git a/libs/RVL_SDK/src/fa/pf_entry.c b/libs/RVL_SDK/src/fa/pf_entry.c index d0a12eb5..1eea1b50 100644 --- a/libs/RVL_SDK/src/fa/pf_entry.c +++ b/libs/RVL_SDK/src/fa/pf_entry.c @@ -653,7 +653,10 @@ pf_s32 PFENT_MakeRootDir(PF_VOLUME* p_vol) { default: return 7; } - PFDRV_LoadVolumeLabelFromBuf(p_vol, (pf_u8*)"NO NAME "); + { + static pf_u8 default_volume_label[16] = "NO NAME "; + PFDRV_LoadVolumeLabelFromBuf(p_vol, default_volume_label); + } return 0; } @@ -722,7 +725,8 @@ pf_s32 PFENT_RemoveEntry(PF_DIR_ENT* p_ent, PFENTRY_ENT_ITER* p_iter) { pf_u16 entry_offset; pf_u32 i; PF_VOLUME* p_vol = PF_NULL; - const pf_u8 dir_fb_free[1] = {0xE5}; + pf_u8 dir_fb_free[8] = {0xE5}; + pf_u8 del = dir_fb_free[0]; p_vol = p_ent->p_vol; entry_sector = p_ent->entry_sector; @@ -735,7 +739,7 @@ pf_s32 PFENT_RemoveEntry(PF_DIR_ENT* p_ent, PFENTRY_ENT_ITER* p_iter) { } entry_sector = p_iter->sector; entry_offset = p_iter->offset; - err = PFSEC_WriteData(p_vol, (pf_u8*)&dir_fb_free, entry_sector, entry_offset, 1, &success_size, 0); + err = PFSEC_WriteData(p_vol, &del, entry_sector, entry_offset, 1, &success_size, 0); if (err != 0) { return err; } @@ -744,7 +748,7 @@ pf_s32 PFENT_RemoveEntry(PF_DIR_ENT* p_ent, PFENTRY_ENT_ITER* p_iter) { } } } - err = PFSEC_WriteData(p_vol, (pf_u8*)&dir_fb_free, p_ent->entry_sector, p_ent->entry_offset, 1, &success_size, 0); + err = PFSEC_WriteData(p_vol, &del, p_ent->entry_sector, p_ent->entry_offset, 1, &success_size, 0); if (err != 0) { return err; } diff --git a/libs/RVL_SDK/src/fa/pf_opendir.c b/libs/RVL_SDK/src/fa/pf_opendir.c index 8e0016f5..a9992cb9 100644 --- a/libs/RVL_SDK/src/fa/pf_opendir.c +++ b/libs/RVL_SDK/src/fa/pf_opendir.c @@ -1,34 +1,33 @@ #include -typedef struct PF_API_STRING { - const s8* head; - const s8* tail; - const s8* current; +typedef struct PFF2_STR { + const s8* p_head; + const s8* p_tail; + const s8* p_current; u32 code_mode; -} PF_API_STRING; +} PFF2_STR; -typedef struct PF_API_VOLUME_SET { +typedef struct PFF2_VOL_SET { u8 reserved[0x40]; s32 last_error; -} PF_API_VOLUME_SET; +} PFF2_VOL_SET; -extern PF_API_VOLUME_SET pf_vol_set; -extern s32 PFSTR_InitStr(PF_API_STRING* string, const s8* text, u32 mode); -extern s32 PFAPI_convertReturnValue(s32 error); - -extern s32 PFDIR_opendir(PF_API_STRING* path, FADIR** directory); -extern void* PFAPI_convertReturnValue2NULL(s32 error, void* stream); +extern PFF2_VOL_SET pf_vol_set; +extern s32 PFSTR_InitStr(PFF2_STR* path, const s8* text, u32 code_mode); +extern s32 PFDIR_opendir(PFF2_STR* path, FADIR** result); +extern FAFILE* PFAPI_convertReturnValue2NULL(s32 err, FAFILE* p_stream); FADIR* pf2_opendir(const char* path) { - PF_API_STRING path_string; - FADIR* directory; - s32 error; + FADIR* p_dir; + PFF2_STR path_str; + s32 err; - error = PFSTR_InitStr(&path_string, (const s8*)path, 1); - if (error == 0) { - error = PFDIR_opendir(&path_string, &directory); + err = PFSTR_InitStr(&path_str, (const s8*)path, 1); + if (err == 0) { + err = PFDIR_opendir(&path_str, &p_dir); } else { - pf_vol_set.last_error = error; + pf_vol_set.last_error = err; } - return PFAPI_convertReturnValue2NULL(error, directory); + p_dir = PFAPI_convertReturnValue2NULL(err, p_dir); + return p_dir; } diff --git a/libs/RVL_SDK/src/fa/pf_readdir.c b/libs/RVL_SDK/src/fa/pf_readdir.c index 96b78c3a..7a9481da 100644 --- a/libs/RVL_SDK/src/fa/pf_readdir.c +++ b/libs/RVL_SDK/src/fa/pf_readdir.c @@ -1,8 +1,12 @@ #include -extern s32 PFDIR_readdir(FADIR* directory, void* result); -extern s32 PFAPI_convertReturnValue(s32 error); +typedef struct FADirEnt FADirEnt; -s32 pf2_readdir(FADIR* directory, void* result) { - return PFAPI_convertReturnValue(PFDIR_readdir(directory, result)); +extern s32 PFDIR_readdir(FADIR* dir, FADirEnt* result); +extern s32 PFAPI_convertReturnValue(s32 err); + +FAError pf2_readdir(FADIR* dir, FADirEnt* result) { + s32 err = PFDIR_readdir(dir, result); + err = PFAPI_convertReturnValue(err); + return err; } diff --git a/libs/RVL_SDK/src/fa/pf_rewinddir.c b/libs/RVL_SDK/src/fa/pf_rewinddir.c index 396356df..011229fc 100644 --- a/libs/RVL_SDK/src/fa/pf_rewinddir.c +++ b/libs/RVL_SDK/src/fa/pf_rewinddir.c @@ -1,8 +1,10 @@ #include -extern s32 PFDIR_seekdir(FADIR* directory, u32 position); -extern s32 PFAPI_convertReturnValue(s32 error); +extern s32 PFDIR_seekdir(FADIR* dir, u32 position); +extern s32 PFAPI_convertReturnValue(s32 err); -s32 pf2_rewinddir(FADIR* directory) { - return PFAPI_convertReturnValue(PFDIR_seekdir(directory, 0)); +FAError pf2_rewinddir(FADIR* dir) { + s32 err = PFDIR_seekdir(dir, 0); + err = PFAPI_convertReturnValue(err); + return err; } diff --git a/libs/RVL_SDK/src/fa/pf_seekdir.c b/libs/RVL_SDK/src/fa/pf_seekdir.c index 2acd1e99..d225f812 100644 --- a/libs/RVL_SDK/src/fa/pf_seekdir.c +++ b/libs/RVL_SDK/src/fa/pf_seekdir.c @@ -1,8 +1,10 @@ #include -extern s32 PFDIR_seekdir(FADIR* directory, u32 position); -extern s32 PFAPI_convertReturnValue(s32 error); +extern s32 PFDIR_seekdir(FADIR* dir, u32 position); +extern s32 PFAPI_convertReturnValue(s32 err); -s32 pf2_seekdir(FADIR* directory, u32 position) { - return PFAPI_convertReturnValue(PFDIR_seekdir(directory, position)); +FAError pf2_seekdir(FADIR* dir, u32 position) { + s32 err = PFDIR_seekdir(dir, position); + err = PFAPI_convertReturnValue(err); + return err; } diff --git a/libs/RVL_SDK/src/fa/pf_telldir.c b/libs/RVL_SDK/src/fa/pf_telldir.c index 1115c69d..7b4c4066 100644 --- a/libs/RVL_SDK/src/fa/pf_telldir.c +++ b/libs/RVL_SDK/src/fa/pf_telldir.c @@ -1,8 +1,10 @@ #include -extern s32 PFDIR_telldir(FADIR* directory, u32* position); -extern s32 PFAPI_convertReturnValue(s32 error); +extern s32 PFDIR_telldir(FADIR* dir, u32* position); +extern s32 PFAPI_convertReturnValue(s32 err); -s32 pf2_telldir(FADIR* directory, u32* position) { - return PFAPI_convertReturnValue(PFDIR_telldir(directory, position)); +FAError pf2_telldir(FADIR* dir, u32* position) { + s32 err = PFDIR_telldir(dir, position); + err = PFAPI_convertReturnValue(err); + return err; }