add hmd2 devices stubs

This commit is contained in:
DH 2024-11-24 15:02:25 +03:00
parent c46b391203
commit 8c5bde7bc5
7 changed files with 142 additions and 0 deletions

View file

@ -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

View file

@ -53,3 +53,7 @@ IoDevice *createIccPowerCharacterDevice();
IoDevice *createCaymanRegCharacterDevice();
IoDevice *createA53IoCharacterDevice();
IoDevice *createNsidCtlCharacterDevice();
IoDevice *createHmd2CmdCharacterDevice();
IoDevice *createHmd2ImuCharacterDevice();
IoDevice *createHmd2GazeCharacterDevice();
IoDevice *createHmd2GenDataCharacterDevice();

32
rpcsx/iodev/hmd2_cmd.cpp Normal file
View file

@ -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<orbis::File> *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<orbis::File> *file,
const char *path, std::uint32_t flags,
std::uint32_t mode, orbis::Thread *thread) {
auto newFile = orbis::knew<Hmd2CmdFile>();
newFile->device = this;
newFile->ops = &ops;
*file = newFile;
return {};
}
IoDevice *createHmd2CmdCharacterDevice() { return orbis::knew<Hmd2CmdDevice>(); }

32
rpcsx/iodev/hmd2_gaze.cpp Normal file
View file

@ -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<orbis::File> *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<orbis::File> *file,
const char *path, std::uint32_t flags,
std::uint32_t mode, orbis::Thread *thread) {
auto newFile = orbis::knew<Hmd2GazeFile>();
newFile->device = this;
newFile->ops = &ops;
*file = newFile;
return {};
}
IoDevice *createHmd2GazeCharacterDevice() { return orbis::knew<Hmd2GazeDevice>(); }

View file

@ -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<orbis::File> *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<orbis::File> *file,
const char *path, std::uint32_t flags,
std::uint32_t mode, orbis::Thread *thread) {
auto newFile = orbis::knew<Hmd2GenDataFile>();
newFile->device = this;
newFile->ops = &ops;
*file = newFile;
return {};
}
IoDevice *createHmd2GenDataCharacterDevice() { return orbis::knew<Hmd2GenDataDevice>(); }

32
rpcsx/iodev/hmd2_imu.cpp Normal file
View file

@ -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<orbis::File> *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<orbis::File> *file,
const char *path, std::uint32_t flags,
std::uint32_t mode, orbis::Thread *thread) {
auto newFile = orbis::knew<Hmd2ImuFile>();
newFile->device = this;
newFile->ops = &ops;
*file = newFile;
return {};
}
IoDevice *createHmd2ImuCharacterDevice() { return orbis::knew<Hmd2ImuDevice>(); }

View file

@ -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({