diff --git a/rpcsx/CMakeLists.txt b/rpcsx/CMakeLists.txt index 0d135f8..869e248 100644 --- a/rpcsx/CMakeLists.txt +++ b/rpcsx/CMakeLists.txt @@ -27,6 +27,10 @@ add_executable(rpcsx iodev/hmd_cmd.cpp iodev/hmd_mmap.cpp iodev/hmd_snsr.cpp + iodev/hmd2_cmd.cpp + iodev/hmd2_imu.cpp + iodev/hmd2_gen_data.cpp + iodev/hmd2_gaze.cpp iodev/icc_configuration.cpp iodev/mbus.cpp iodev/metadbg.cpp diff --git a/rpcsx/io-devices.hpp b/rpcsx/io-devices.hpp index 2e85d1e..edbff23 100644 --- a/rpcsx/io-devices.hpp +++ b/rpcsx/io-devices.hpp @@ -53,3 +53,7 @@ IoDevice *createIccPowerCharacterDevice(); IoDevice *createCaymanRegCharacterDevice(); IoDevice *createA53IoCharacterDevice(); IoDevice *createNsidCtlCharacterDevice(); +IoDevice *createHmd2CmdCharacterDevice(); +IoDevice *createHmd2ImuCharacterDevice(); +IoDevice *createHmd2GazeCharacterDevice(); +IoDevice *createHmd2GenDataCharacterDevice(); diff --git a/rpcsx/iodev/hmd2_cmd.cpp b/rpcsx/iodev/hmd2_cmd.cpp new file mode 100644 index 0000000..a6077ce --- /dev/null +++ b/rpcsx/iodev/hmd2_cmd.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/utils/Logs.hpp" + +struct Hmd2CmdDevice : public IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override; +}; +struct Hmd2CmdFile : public orbis::File {}; + +static orbis::ErrorCode hmd2_cmd_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + ORBIS_LOG_FATAL("Unhandled hmd2_cmd ioctl", request); + return {}; +} + +static const orbis::FileOps ops = { + .ioctl = hmd2_cmd_ioctl, +}; + +orbis::ErrorCode Hmd2CmdDevice::open(orbis::Ref *file, + const char *path, std::uint32_t flags, + std::uint32_t mode, orbis::Thread *thread) { + auto newFile = orbis::knew(); + newFile->device = this; + newFile->ops = &ops; + *file = newFile; + return {}; +} + +IoDevice *createHmd2CmdCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_gaze.cpp b/rpcsx/iodev/hmd2_gaze.cpp new file mode 100644 index 0000000..57e2a7d --- /dev/null +++ b/rpcsx/iodev/hmd2_gaze.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/utils/Logs.hpp" + +struct Hmd2GazeDevice : public IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override; +}; +struct Hmd2GazeFile : public orbis::File {}; + +static orbis::ErrorCode hmd2_gaze_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + ORBIS_LOG_FATAL("Unhandled hmd2_gaze ioctl", request); + return {}; +} + +static const orbis::FileOps ops = { + .ioctl = hmd2_gaze_ioctl, +}; + +orbis::ErrorCode Hmd2GazeDevice::open(orbis::Ref *file, + const char *path, std::uint32_t flags, + std::uint32_t mode, orbis::Thread *thread) { + auto newFile = orbis::knew(); + newFile->device = this; + newFile->ops = &ops; + *file = newFile; + return {}; +} + +IoDevice *createHmd2GazeCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_gen_data.cpp b/rpcsx/iodev/hmd2_gen_data.cpp new file mode 100644 index 0000000..3e501cc --- /dev/null +++ b/rpcsx/iodev/hmd2_gen_data.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/utils/Logs.hpp" + +struct Hmd2GenDataDevice : public IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override; +}; +struct Hmd2GenDataFile : public orbis::File {}; + +static orbis::ErrorCode hmd2_gen_data_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + ORBIS_LOG_FATAL("Unhandled hmd2_gen_data ioctl", request); + return {}; +} + +static const orbis::FileOps ops = { + .ioctl = hmd2_gen_data_ioctl, +}; + +orbis::ErrorCode Hmd2GenDataDevice::open(orbis::Ref *file, + const char *path, std::uint32_t flags, + std::uint32_t mode, orbis::Thread *thread) { + auto newFile = orbis::knew(); + newFile->device = this; + newFile->ops = &ops; + *file = newFile; + return {}; +} + +IoDevice *createHmd2GenDataCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_imu.cpp b/rpcsx/iodev/hmd2_imu.cpp new file mode 100644 index 0000000..a4207d5 --- /dev/null +++ b/rpcsx/iodev/hmd2_imu.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/utils/Logs.hpp" + +struct Hmd2ImuDevice : public IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override; +}; +struct Hmd2ImuFile : public orbis::File {}; + +static orbis::ErrorCode hmd2_imu_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + ORBIS_LOG_FATAL("Unhandled hmd2_imu ioctl", request); + return {}; +} + +static const orbis::FileOps ops = { + .ioctl = hmd2_imu_ioctl, +}; + +orbis::ErrorCode Hmd2ImuDevice::open(orbis::Ref *file, + const char *path, std::uint32_t flags, + std::uint32_t mode, orbis::Thread *thread) { + auto newFile = orbis::knew(); + newFile->device = this; + newFile->ops = &ops; + *file = newFile; + return {}; +} + +IoDevice *createHmd2ImuCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/main.cpp b/rpcsx/main.cpp index d48cbac..f6d2b7a 100644 --- a/rpcsx/main.cpp +++ b/rpcsx/main.cpp @@ -453,7 +453,13 @@ static void guestInitDev() { vfs::addDevice("ssd0.user", createHddCharacterDevice(-41630302208)); /// ????? vfs::addDevice("ssd0.user_bfs", createHddCharacterDevice(0x100000000)); vfs::addDevice("bfs/ctl", createHddCharacterDevice(0x100000000)); + vfs::addDevice("md2", createHddCharacterDevice(0x100000000)); vfs::addDevice("a53io", createA53IoCharacterDevice()); + + vfs::addDevice("hmd2_cmd", createHmd2CmdCharacterDevice()); + vfs::addDevice("hmd2_imu", createHmd2ImuCharacterDevice()); + vfs::addDevice("hmd2_gaze", createHmd2GazeCharacterDevice()); + vfs::addDevice("hmd2_gen_data", createHmd2GenDataCharacterDevice()); } // mbus->emitEvent({