diff --git a/rpcsx-os/CMakeLists.txt b/rpcsx-os/CMakeLists.txt index ed732150f..93b70f0aa 100644 --- a/rpcsx-os/CMakeLists.txt +++ b/rpcsx-os/CMakeLists.txt @@ -36,6 +36,11 @@ add_executable(rpcsx-os iodev/hdmi.cpp iodev/mbus_av.cpp iodev/scanin.cpp + iodev/s3da.cpp + iodev/gbase.cpp + iodev/devstat.cpp + iodev/devact.cpp + iodev/devctl.cpp main.cpp backtrace.cpp diff --git a/rpcsx-os/io-devices.hpp b/rpcsx-os/io-devices.hpp index 3bba5e821..bc1328321 100644 --- a/rpcsx-os/io-devices.hpp +++ b/rpcsx-os/io-devices.hpp @@ -35,3 +35,8 @@ IoDevice *createAVControlCharacterDevice(); IoDevice *createHDMICharacterDevice(); IoDevice *createMBusAVCharacterDevice(); IoDevice *createScaninCharacterDevice(); +IoDevice *createS3DACharacterDevice(); +IoDevice *createGbaseCharacterDevice(); +IoDevice *createDevStatCharacterDevice(); +IoDevice *createDevCtlCharacterDevice(); +IoDevice *createDevActCharacterDevice(); diff --git a/rpcsx-os/iodev/dce.cpp b/rpcsx-os/iodev/dce.cpp index 17343a01a..5599e86d1 100644 --- a/rpcsx-os/iodev/dce.cpp +++ b/rpcsx-os/iodev/dce.cpp @@ -198,6 +198,9 @@ static orbis::ErrorCode dce_ioctl(orbis::File *file, std::uint64_t request, } else if (args->id == 33) { // adjust color std::printf("adjust color\n"); return {}; + } else if (args->id == 0x1e) { + // TODO + return{}; } else if (args->id != 0 && args->id != 1) { // used during open/close ORBIS_LOG_NOTICE("dce: UNIMPLEMENTED FlipControl", args->id, args->arg2, args->ptr, args->size); diff --git a/rpcsx-os/iodev/devact.cpp b/rpcsx-os/iodev/devact.cpp new file mode 100644 index 000000000..ae51e5f3e --- /dev/null +++ b/rpcsx-os/iodev/devact.cpp @@ -0,0 +1,45 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct DevActFile : orbis::File {}; + +static orbis::ErrorCode devact_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + if (request == 0x40105303) { + // is expired + struct Param { + std::uint32_t unk0; + std::uint32_t unk1; + std::uint32_t unk2; + std::uint32_t unk3; + }; + auto param = (Param *)argp; + *param = {}; + param->unk0 = 1; + return{}; + } + ORBIS_LOG_FATAL("Unhandled devact ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = devact_ioctl, +}; + +struct DevActDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createDevActCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/iodev/devctl.cpp b/rpcsx-os/iodev/devctl.cpp new file mode 100644 index 000000000..2a703b51e --- /dev/null +++ b/rpcsx-os/iodev/devctl.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct DevCtlFile : orbis::File {}; + +static orbis::ErrorCode devctl_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled devctl ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = devctl_ioctl, +}; + +struct DevCtlDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createDevCtlCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/iodev/devstat.cpp b/rpcsx-os/iodev/devstat.cpp new file mode 100644 index 000000000..b79326526 --- /dev/null +++ b/rpcsx-os/iodev/devstat.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct DevStatFile : orbis::File {}; + +static orbis::ErrorCode devstat_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled devstat ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = devstat_ioctl, +}; + +struct DevStatDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createDevStatCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/iodev/gbase.cpp b/rpcsx-os/iodev/gbase.cpp new file mode 100644 index 000000000..3ea134c35 --- /dev/null +++ b/rpcsx-os/iodev/gbase.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct GbaseFile : orbis::File {}; + +static orbis::ErrorCode gbase_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled gbase ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = gbase_ioctl, +}; + +struct GbaseDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createGbaseCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/iodev/s3da.cpp b/rpcsx-os/iodev/s3da.cpp new file mode 100644 index 000000000..043d5b5d9 --- /dev/null +++ b/rpcsx-os/iodev/s3da.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct S3DAFile : orbis::File {}; + +static orbis::ErrorCode s3da_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled s3da ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = s3da_ioctl, +}; + +struct S3DADevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createS3DACharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index afca426b6..967ec2ba2 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -369,6 +369,7 @@ static void ps4InitDev() { rx::vfs::addDevice("da0x13.crypt", createHddCharacterDevice()); rx::vfs::addDevice("da0x14.crypt", createHddCharacterDevice()); rx::vfs::addDevice("da0x15", createHddCharacterDevice()); + rx::vfs::addDevice("da0x15.crypt", createHddCharacterDevice()); rx::vfs::addDevice("notification0", createNotificationCharacterDevice(0)); rx::vfs::addDevice("notification1", createNotificationCharacterDevice(1)); rx::vfs::addDevice("notification2", createNotificationCharacterDevice(2)); @@ -376,12 +377,21 @@ static void ps4InitDev() { rx::vfs::addDevice("notification4", createNotificationCharacterDevice(4)); rx::vfs::addDevice("notification5", createNotificationCharacterDevice(5)); rx::vfs::addDevice("aout0", createAoutCharacterDevice()); + rx::vfs::addDevice("aout1", createAoutCharacterDevice()); + rx::vfs::addDevice("aout2", createAoutCharacterDevice()); rx::vfs::addDevice("av_control", createAVControlCharacterDevice()); rx::vfs::addDevice("hdmi", createHDMICharacterDevice()); rx::vfs::addDevice("mbus_av", createMBusAVCharacterDevice()); rx::vfs::addDevice("scanin", createScaninCharacterDevice()); + rx::vfs::addDevice("s3da", createS3DACharacterDevice()); + rx::vfs::addDevice("gbase", createGbaseCharacterDevice()); + rx::vfs::addDevice("devstat", createDevStatCharacterDevice()); + rx::vfs::addDevice("devact", createDevActCharacterDevice()); + rx::vfs::addDevice("devctl", createDevCtlCharacterDevice()); - orbis::g_context.shmDevice = createShmDevice(); + auto shm = createShmDevice(); + rx::vfs::addDevice("shm", shm); + orbis::g_context.shmDevice = shm; orbis::g_context.blockpoolDevice = createBlockPoolDevice(); }