Compare commits

...

1 Commits

Author SHA1 Message Date
devin
86b2e951c6 fa: link 6 more pf units (service,fopen,fseek,fsfirst,fsnext,fstat) - objdiff 100%
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-30 05:45:29 +00:00
6 changed files with 97 additions and 68 deletions

View File

@@ -1684,7 +1684,7 @@ config.libs = [
RVLSDKLib("fa", [
Object(Matching, "fa/pf_clib.c"),
Object(Matching, "fa/pf_code.c"),
Object(NonMatching, "fa/pf_service.c"),
Object(Matching, "fa/pf_service.c"),
Object(Matching, "fa/pf_str.c"),
Object(Matching, "fa/pf_driver.c"),
Object(NonMatching, "fa/pdm_api.c"),
@@ -1733,15 +1733,15 @@ config.libs = [
Object(Matching, "fa/pf_ferror.c"),
Object(NonMatching, "fa/pf_finfo.c"),
Object(Matching, "fa/pf_flock.c"),
Object(NonMatching, "fa/pf_fopen.c"),
Object(Matching, "fa/pf_fopen.c"),
Object(NonMatching, "fa/pf_format.c"),
Object(Matching, "fa/pf_fread.c"),
Object(NonMatching, "fa/pf_fseek.c"),
Object(Matching, "fa/pf_fseek.c"),
Object(NonMatching, "fa/pf_fsetclstlink.c"),
Object(NonMatching, "fa/pf_fsexec.c"),
Object(NonMatching, "fa/pf_fsfirst.c"),
Object(NonMatching, "fa/pf_fsnext.c"),
Object(NonMatching, "fa/pf_fstat.c"),
Object(Matching, "fa/pf_fsfirst.c"),
Object(Matching, "fa/pf_fsnext.c"),
Object(Matching, "fa/pf_fstat.c"),
Object(Matching, "fa/pf_fsync.c"),
Object(Matching, "fa/pf_fwrite.c"),
Object(NonMatching, "fa/pf_getdev.c"),

View File

@@ -1,38 +1,41 @@
#define PF_FA_STR_LAYOUT
#define VFiPFAPI_ParseOpenModeString PFAPI_ParseOpenModeString
#define VFiPFAPI_convertReturnValue2NULL PFAPI_convertReturnValue2NULL
#define VFiPFFILE_fopen PFFILE_fopen
#define VFiPFSTR_InitStr PFSTR_InitStr
#include <private/vf/PrFILE2/standard/pf_fopen.h>
#include <revolution/fa.h>
typedef struct PFAPI_GLOBAL_STATE {
pf_u8 volume_state[0x40];
pf_s32 last_error;
} PFAPI_GLOBAL_STATE;
extern PFAPI_GLOBAL_STATE pf_vol_set;
typedef struct PFF2_STR {
const s8* p_head;
const s8* p_tail;
const s8* p_current;
u32 code_mode;
} PFF2_STR;
typedef struct PFF2_VOL_SET {
u8 reserved[0x40];
s32 last_error;
} PFF2_VOL_SET;
#include <private/vf/PrFILE2/fatfs/pf_volume.h>
#include <private/vf/PrFILE2/standard/pf_api_util.h>
extern PFF2_VOL_SET pf_vol_set;
extern s32 PFAPI_ParseOpenModeString(const char* mode_str);
extern s32 PFSTR_InitStr(PFF2_STR* path, const s8* text, u32 code_mode);
extern s32 PFFILE_fopen(PFF2_STR* path, s32 mode, FAFILE** result);
extern FAFILE* PFAPI_convertReturnValue2NULL(s32 err, FAFILE* p_stream);
PF_FILE* pf2_fopen(const pf_ch8* path, const pf_ch8* mode) {
pf_u32 open_mode;
PF_FILE* p_file;
PF_STR path_str;
pf_s32 err;
FAFILE* pf2_fopen(const char* path, const char* mode) {
u32 open_mode;
FAFILE* p_file;
PFF2_STR path_str;
s32 err;
open_mode = VFiPFAPI_ParseOpenModeString(mode);
open_mode = PFAPI_ParseOpenModeString(mode);
if (open_mode == 0) {
pf_vol_set.last_error = 10;
p_file = PF_NULL;
p_file = NULL;
} else {
err = VFiPFSTR_InitStr(&path_str, (pf_s8*)path, 1U);
err = PFSTR_InitStr(&path_str, (const s8*)path, 1);
if (err == 0) {
err = VFiPFFILE_fopen(&path_str, open_mode, &p_file);
err = PFFILE_fopen(&path_str, open_mode, &p_file);
} else {
pf_vol_set.last_error = err;
}
p_file = VFiPFAPI_convertReturnValue2NULL(err, p_file);
p_file = PFAPI_convertReturnValue2NULL(err, p_file);
}
return p_file;
}

View File

@@ -1,13 +1,10 @@
#define PF_FA_STR_LAYOUT
#define VFiPFAPI_convertReturnValue PFAPI_convertReturnValue
#define VFiPFFILE_fseek PFFILE_fseek
#include <private/vf/PrFILE2/standard/pf_fseek.h>
#include <revolution/fa.h>
#include <private/vf/PrFILE2/fatfs/pf_volume.h>
#include <private/vf/PrFILE2/standard/pf_api_util.h>
extern s32 PFFILE_fseek(FAFILE* stream, s32 offset, int origin);
extern s32 PFAPI_convertReturnValue(s32 err);
pf_int32 pf2_fseek(PF_FILE* pFile, pf_s32 lOffset, pf_int32 nOrigin) {
pf_s32 err = VFiPFFILE_fseek(pFile, lOffset, nOrigin);
err = VFiPFAPI_convertReturnValue(err);
FAError pf2_fseek(FAFILE* stream, s32 offset, int origin) {
s32 err = PFFILE_fseek(stream, offset, origin);
err = PFAPI_convertReturnValue(err);
return err;
}

View File

@@ -1,30 +1,32 @@
#define PF_FA_STR_LAYOUT
#define VFiPFAPI_convertReturnValue PFAPI_convertReturnValue
#define VFiPFDIR_fsfirst PFDIR_fsfirst
#define VFiPFSTR_InitStr PFSTR_InitStr
#include <private/vf/PrFILE2/standard/pf_fsfirst.h>
#include <revolution/fa.h>
typedef struct PFAPI_GLOBAL_STATE {
pf_u8 volume_state[0x40];
pf_s32 last_error;
} PFAPI_GLOBAL_STATE;
extern PFAPI_GLOBAL_STATE pf_vol_set;
typedef struct PFF2_STR {
const s8* p_head;
const s8* p_tail;
const s8* p_current;
u32 code_mode;
} PFF2_STR;
typedef struct PFF2_VOL_SET {
u8 reserved[0x40];
s32 last_error;
} PFF2_VOL_SET;
#include <private/vf/PrFILE2/fatfs/pf_volume.h>
#include <private/vf/PrFILE2/standard/pf_api_util.h>
extern PFF2_VOL_SET pf_vol_set;
extern s32 PFSTR_InitStr(PFF2_STR* path, const s8* text, u32 code_mode);
extern s32 PFDIR_fsfirst(PFF2_STR* path, u8 attributes, FADta* data);
extern s32 PFAPI_convertReturnValue(s32 err);
pf_int32 pf2_fsfirst(const pf_ch8* path, pf_u8 attrs, PF_DTA* p_dta) {
pf_s32 err;
PF_STR path_str;
FAError pf2_fsfirst(const char* dirName, u8 attr, FADta* dta) {
s32 err;
PFF2_STR path_str;
err = VFiPFSTR_InitStr(&path_str, (pf_s8*)path, 1U);
err = PFSTR_InitStr(&path_str, (const s8*)dirName, 1);
if (err == 0) {
err = VFiPFDIR_fsfirst(&path_str, attrs, p_dta);
err = PFDIR_fsfirst(&path_str, attr, dta);
} else {
pf_vol_set.last_error = err;
}
err = VFiPFAPI_convertReturnValue(err);
err = PFAPI_convertReturnValue(err);
return err;
}

View File

@@ -1,15 +1,10 @@
#define PF_FA_STR_LAYOUT
#define VFiPFAPI_convertReturnValue PFAPI_convertReturnValue
#define VFiPFDIR_fsnext PFDIR_fsnext
#include <private/vf/PrFILE2/standard/pf_fsfirst.h>
#include <revolution/fa.h>
#include <private/vf/PrFILE2/fatfs/pf_volume.h>
#include <private/vf/PrFILE2/standard/pf_api_util.h>
extern s32 PFDIR_fsnext(FADta* data);
extern s32 PFAPI_convertReturnValue(s32 err);
pf_int32 pf2_fsnext(PF_DTA* p_dta) {
pf_s32 err;
err = VFiPFDIR_fsnext(p_dta);
err = VFiPFAPI_convertReturnValue(err);
FAError pf2_fsnext(FADta* dta) {
s32 err = PFDIR_fsnext(dta);
err = PFAPI_convertReturnValue(err);
return err;
}

View File

@@ -0,0 +1,32 @@
#include <revolution/fa.h>
typedef struct PFF2_STR {
const s8* p_head;
const s8* p_tail;
const s8* p_current;
u32 code_mode;
} PFF2_STR;
typedef struct PFF2_VOL_SET {
u8 reserved[0x40];
s32 last_error;
} PFF2_VOL_SET;
extern PFF2_VOL_SET pf_vol_set;
extern s32 PFSTR_InitStr(PFF2_STR* path, const s8* text, u32 code_mode);
extern s32 PFDIR_fstat(PFF2_STR* path, FAFileStat* file_stat);
extern s32 PFAPI_convertReturnValue(s32 err);
FAError pf2_fstat(const char* fileName, FAFileStat* stat) {
s32 err;
PFF2_STR path_str;
err = PFSTR_InitStr(&path_str, (const s8*)fileName, 1);
if (err == 0) {
err = PFDIR_fstat(&path_str, stat);
} else {
pf_vol_set.last_error = err;
}
err = PFAPI_convertReturnValue(err);
return err;
}