Nugget
Loading...
Searching...
No Matches
fileio.h
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2020 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
27#pragma once
28
31
32int psxopen(const char *fname, int mode);
33int psxlseek(int fd, int offset, int whence);
34int psxread(int fd, void *buffer, int size);
35int psxwrite(int fd, void *buffer, int size);
36int psxclose(int fd);
37int psxioctl(int fd, int cmd, int arg);
38void psxexit(int code);
39int isFileConsole(int fd);
40int psxgetc(int fd);
41void psxputc(int c, int fd);
42
43void psxputchar(int c);
44int psxgetchar();
45char *psxgets(char *storage);
46void psxputs(const char *str);
47int psxprintf(const char *msg, ...);
48void ioabortraw(int code);
49
50void setupFileIO(int installTTY);
51void installStdIo(int installTTY);
52void reopenStdio();
53
54struct Device *findDevice(const char *name);
55int addDevice(struct Device *);
56int removeDevice(const char *name);
57
58struct File *getFileFromHandle(int fd);
59struct File *findEmptyFile();
60
61const char *splitFilepathAndFindDevice(const char *name, struct Device **device, int *deviceId);
62
63extern uint32_t psxerrno;
64
65void cdevscan();
66
67struct DirEntry *firstFile(const char *filepath, struct DirEntry *entry);
68struct DirEntry *nextFile(struct DirEntry *entry);
69int format(const char *deviceName);
70
71int psxrename(const char *oldName, const char *newName);
72int psxerase(const char *path);
73
74extern struct File *g_firstFile;
75
76int getDeviceStatus();
77void setDeviceStatus(int deviceStatus);
78
80void ioAbortWithMsg(const char *msg1, const char *msg2);
uint32_t cmd
Definition dma.c:108
int psxwrite(int fd, void *buffer, int size)
Definition stdio.c:167
int psxgetchar()
Definition stdio.c:266
int removeDevice(const char *name)
Definition misc.c:95
int psxread(int fd, void *buffer, int size)
Definition stdio.c:133
struct DirEntry * firstFile(const char *filepath, struct DirEntry *entry)
Definition filesystem.c:34
int addDevice(struct Device *)
Definition misc.c:178
int isFileConsole(int fd)
Definition misc.c:172
const char * splitFilepathAndFindDevice(const char *name, struct Device **device, int *deviceId)
Definition misc.c:133
void setupFileIO(int installTTY)
Definition misc.c:51
struct Device * findDevice(const char *name)
Definition misc.c:82
struct File * getFileFromHandle(int fd)
Definition misc.c:109
int psxrename(const char *oldName, const char *newName)
Definition stdio.c:339
int format(const char *deviceName)
Definition filesystem.c:60
void ioabortraw(int code)
Definition misc.c:117
void psxputc(int c, int fd)
Definition stdio.c:246
char * psxgets(char *storage)
Definition stdio.c:277
void ioAbortWithMsg(const char *msg1, const char *msg2)
Definition misc.c:119
int psxioctl(int fd, int cmd, int arg)
Definition stdio.c:216
void installStdIo(int installTTY)
Definition stdio.c:49
void psxexit(int code)
Definition misc.c:166
void printInstalledDevices()
Definition misc.c:75
void psxputchar(int c)
Definition stdio.c:251
int psxprintf(const char *msg,...)
Definition stdio.c:332
int psxgetc(int fd)
Definition stdio.c:240
void cdevscan()
Definition misc.c:160
int psxlseek(int fd, int offset, int whence)
Definition stdio.c:108
void psxputs(const char *str)
Definition stdio.c:320
int getDeviceStatus()
Definition misc.c:72
void setDeviceStatus(int deviceStatus)
Definition misc.c:73
void reopenStdio()
Definition stdio.c:40
struct DirEntry * nextFile(struct DirEntry *entry)
Definition filesystem.c:58
struct File * findEmptyFile()
Definition misc.c:124
int psxerase(const char *path)
Definition stdio.c:390
int psxclose(int fd)
Definition stdio.c:201
int psxopen(const char *fname, int mode)
Definition stdio.c:70
uint32_t psxerrno
Definition misc.c:49
struct File * g_firstFile
Definition misc.c:45
static int size
Definition string.h:32
Definition device.h:62
const char * name
Definition device.h:63
Definition direntry.h:33
Definition stdio.h:96
struct Device * device
Definition stdio.h:100
uint32_t deviceId
Definition stdio.h:97
uint32_t fd
Definition stdio.h:101
static void * buffer
Definition syscalls.h:230
static int c
Definition syscalls.h:121
static void uint32_t mode
Definition syscalls.h:230
void uint32_t(classId, spec)