Commit Graph
6 Commits
Author SHA1 Message Date
MarcZX10 5addd7d084 fix(libSceFios2): read guest inputs through checked copies
Copy SceFiosOpAttr, SceFiosOpenParams, SceFiosParams, the vector arrays
and struct tm out of guest memory with GuestCopyIn instead of
dereferencing them, and return SCE_FIOS_ERROR_BAD_PTR when a copy
fails. The *Sync forms return the error of an operation that was never
created, and the test covers unreadable attributes, open parameters and
vector arrays.
2026-10-28 07:27:12 +00:00
MarcZX10 1b872fe3f4 feat(libSceFios2): implement dates and time intervals
Implement sceFiosDateGetCurrent, sceFiosDateFromComponents,
sceFiosDateToComponents, sceFiosTimeIntervalFromNanoseconds and
sceFiosTimeIntervalToNanoseconds. Dates are nanoseconds since the Unix
epoch in UTC, converted with a proleptic Gregorian calendar that does
not depend on the host C library, and out-of-range components are
normalized.
2026-10-28 06:07:44 +00:00
MarcZX10 f6a1e52f7d feat(libSceFios2): implement directory handles
Implement sceFiosDHOpen, sceFiosDHRead, sceFiosDHClose, their Sync
forms and sceFiosDHGetPath. Opening lists the directory through
sceKernelGetdirentries and reports SCE_FIOS_ERROR_BAD_SIZE with the
required size through sceFiosOpGetActualCount when the supplied buffer
is null or too small, the sizing probe title code performs. Reading
fills SceFiosDirEntry and ends with SCE_FIOS_ERROR_EOF.
2026-10-28 06:06:34 +00:00
MarcZX10 0db3e4c00a feat(libSceFios2): implement file handles
Implement sceFiosFHOpen, sceFiosFHOpenWithMode, sceFiosFHClose,
sceFiosFHStat, sceFiosFHTruncate, sceFiosFHSync, the read, write,
pread and pwrite families including the vectored forms with their Sync
variants, and sceFiosFHSeek, sceFiosFHTell, sceFiosFHGetSize,
sceFiosFHGetPath and sceFiosFHGetOpenParams.

A handle owns a kernel descriptor and serializes its transfers.
Transfers the open flags exclude, bad vector counts, negative sizes and
offsets and closed handles return SCE_FIOS_ERROR_* codes.
2026-10-28 06:05:27 +00:00
MarcZX10 45b9f0b8b0 feat(libSceFios2): implement path mutations and whole-file transfers
Implement sceFiosDelete, sceFiosFileDelete, sceFiosDirectoryCreate,
sceFiosDirectoryDelete, sceFiosRename, sceFiosFileRead,
sceFiosFileWrite and sceFiosFileTruncate with their Sync forms on top
of the kernel file exports, so guest path mapping and archive handling
stay in one place. Reads and writes loop until the request is
satisfied or the file ends, argument and kernel failures map to
SCE_FIOS_ERROR_* codes, and the test covers the error paths and the
operation counters.
2026-10-28 04:34:18 +00:00
MarcZX10 f1d46c0375 feat(libSceFios2): implement the operation runtime and path queries
Add the shared FIOS2 runtime: one handle number space for operations,
files and directories, operation records with completion callbacks,
suspend and resume with queued operations, cancellation, default
operation attributes and the stored initialization parameters.

Implement the control exports (sceFiosInitialize, sceFiosTerminate,
suspend and resume, the sceFiosGetAll* enumerations, sceFiosOp*) and
the path queries sceFiosExists, sceFiosFileExists, sceFiosDirectoryExists,
sceFiosFileGetSize and sceFiosStat with their Sync forms on top of
sceKernelStat. Failures return SCE_FIOS_ERROR_* codes.

The prototypes and layouts come from public emulator sources and are
listed in docs/dev/debt/libSceFios2.md.
2026-10-28 04:32:34 +00:00