Commit Graph

13 Commits

Author SHA1 Message Date
Xavier Del Campo Romero c6ded28dce
libpsx: Fix const-correctness for fwrite(3)
According to C99 §7.19.8.2p1, fwrite(3) is expected to take a const void
*, and not void *.
2023-11-29 13:00:13 +01:00
Xavier Del Campo Romero c157ae7c78
libpsx: Add rewind(3) 2023-11-29 12:55:31 +01:00
Xavier Del Campo Romero 51824e61d0 libc.c: do not lseek(2) on partial sector reads 2022-02-07 02:14:10 +01:00
Xavier Del Campo Romero d78c64ba7c libc.c: fix ptr when partially reading sector 2021-12-08 03:24:01 +01:00
Xavier Del Campo Romero a34280dec7 Provide buffered fread(3)
In order to reduce calls to seek(2) (which are very expensive), this
commit keeps a sector-sized cache for each available FILE instance,
except from the standard streams, of course.

As expected, this allows calls to fread(3) to react much faster when
small, contiguous chunks are read.
2021-10-24 03:10:03 +02:00
Xavier Del Campo Romero 9c6112eb5b fopen_internal: return ENOENT on file not found
This is actually expected by open(2), but I do not expect the BIOS
implementation to conform.
2021-10-24 03:10:03 +02:00
Xavier Del Campo Romero 9157d1d6e6 lib.c: reduce NUM_OF_FILE_STRUCTS
Number has been reduced to a minimum to save memory.
2021-10-24 03:10:03 +02:00
Xavier Del Campo Romero 7af858caaf Provide conforming interface for fwrite(3) 2021-10-24 03:10:03 +02:00
Xavier Del Campo Romero fdf8c18335 Add conforming interfaces of standard streams 2021-10-24 03:09:47 +02:00
Xavier Del Campo Romero 4b1beb6199 fmode_to_desmode: remove annoying debug messages 2021-10-24 02:37:52 +02:00
Xavier Del Campo Romero 58256c917e fopen_internal: do not resolve cdromL by default
This avoids calling malloc(3) and thus allowing the linker to remove
the heap implementation from memory.c via --gc-sections.
2021-10-24 02:30:59 +02:00
Xavi Del Campo 26b206560d Added -ffunction/data-sections and -Os to libpsx 2020-01-31 14:10:20 +01:00
Xavi Del Campo 7c24e9a9b0 Imported pristine psxsdk-20190410 from official repo 2020-01-31 10:32:23 +01:00