aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-04-04 01:14:36 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2023-04-04 01:14:36 +0200
commitf7d9c309661f3027d5bfd119b3daf814e26ef589 (patch)
tree36299daf69c4f435a0f32ebb0b52ada9c799700a /libpsn00b/include
parentfd846206ae9419af5ed227989b3ad49b541a823c (diff)
downloadpsn00bsdk-f7d9c309661f3027d5bfd119b3daf814e26ef589.tar.gz
Add PCDRV API, fix warnings and DS region misdetection
Diffstat (limited to 'libpsn00b/include')
-rw-r--r--libpsn00b/include/psxsn.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/libpsn00b/include/psxsn.h b/libpsn00b/include/psxsn.h
new file mode 100644
index 0000000..53a3cd9
--- /dev/null
+++ b/libpsn00b/include/psxsn.h
@@ -0,0 +1,54 @@
+/*
+ * PSn00bSDK kernel API library (host file access)
+ * (C) 2023 spicyjpeg - MPL licensed
+ */
+
+/**
+ * @file psxsn.h
+ * @brief Host file access API header
+ *
+ * @details This header provides stubs for the PCDRV API, which grants read and
+ * write access to a directory on the host's filesystem when the executable is
+ * running on an emulator or through a debugger that supports the PCDRV
+ * protocol, such as Unirom or pcsx-redux. These functions are completely
+ * separate and independent from the BIOS file API and do not register any
+ * device drivers.
+ *
+ * Note that in the official SDK these functions are provided by libsn, while
+ * in PSn00bSDK they are part of libpsxapi.
+ */
+
+#ifndef __PSXSN_H
+#define __PSXSN_H
+
+#include <stddef.h>
+
+typedef enum _PCDRV_OpenMode {
+ PCDRV_MODE_READ = 0,
+ PCDRV_MODE_WRITE = 1,
+ PCDRV_MODE_READ_WRITE = 2
+} PCDRV_OpenMode;
+
+typedef enum _PCDRV_SeekMode {
+ PCDRV_SEEK_SET = 0,
+ PCDRV_SEEK_CUR = 1,
+ PCDRV_SEEK_END = 2
+} PCDRV_SeekMode;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int PCinit(void);
+int PCcreat(const char *path);
+int PCopen(const char *path, PCDRV_OpenMode mode);
+int PCclose(int fd);
+int PCread(int fd, void *data, size_t length);
+int PCwrite(int fd, const void *data, size_t length);
+int PClseek(int fd, int offset, PCDRV_SeekMode mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif