diff --git a/rpcsx/CMakeLists.txt b/rpcsx/CMakeLists.txt index 57309413c..0d135f808 100644 --- a/rpcsx/CMakeLists.txt +++ b/rpcsx/CMakeLists.txt @@ -10,6 +10,7 @@ add_executable(rpcsx audio/AudioDevice.cpp audio/AlsaDevice.cpp + iodev/a53io.cpp iodev/ajm.cpp iodev/blockpool.cpp iodev/bt.cpp @@ -31,6 +32,7 @@ add_executable(rpcsx iodev/metadbg.cpp iodev/notification.cpp iodev/npdrm.cpp + iodev/nsid_ctl.cpp iodev/null.cpp iodev/rng.cpp iodev/sbl_srv.cpp diff --git a/rpcsx/io-devices.hpp b/rpcsx/io-devices.hpp index 583cfd003..2e85d1efb 100644 --- a/rpcsx/io-devices.hpp +++ b/rpcsx/io-devices.hpp @@ -51,3 +51,5 @@ IoDevice *createScreenShotCharacterDevice(); IoDevice *createLvdCtlCharacterDevice(); IoDevice *createIccPowerCharacterDevice(); IoDevice *createCaymanRegCharacterDevice(); +IoDevice *createA53IoCharacterDevice(); +IoDevice *createNsidCtlCharacterDevice(); diff --git a/rpcsx/iodev/a53io.cpp b/rpcsx/iodev/a53io.cpp new file mode 100644 index 000000000..06a7cab41 --- /dev/null +++ b/rpcsx/iodev/a53io.cpp @@ -0,0 +1,42 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" +#include +#include + +struct A53IoFile : orbis::File {}; + +static orbis::ErrorCode a53io_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled a53io ioctl", request); + return {}; +} +static orbis::ErrorCode a53io_read(orbis::File *file, orbis::Uio *uio, + orbis::Thread *thread) { + ORBIS_LOG_TODO(__FUNCTION__); + + std::this_thread::sleep_for(std::chrono::days(1)); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = a53io_ioctl, + .read = a53io_read, +}; + +struct A53IoDevice : 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 *createA53IoCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/nsid_ctl.cpp b/rpcsx/iodev/nsid_ctl.cpp new file mode 100644 index 000000000..6fb256dcc --- /dev/null +++ b/rpcsx/iodev/nsid_ctl.cpp @@ -0,0 +1,51 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" +#include "vfs.hpp" +#include "../io-devices.hpp" +#include +#include + +struct NsidCtlFile : orbis::File {}; + +static orbis::ErrorCode nsid_ctl_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + if (request == 0x20003102) { + ORBIS_LOG_ERROR(__FUNCTION__, "create ssd0 device"); + vfs::addDevice("ssd0", createHddCharacterDevice(0x100000000)); + } else { + ORBIS_LOG_FATAL("Unhandled nsid_ctl ioctl", request); + } + + + return {}; +} +static orbis::ErrorCode nsid_ctl_read(orbis::File *file, orbis::Uio *uio, + orbis::Thread *thread) { + ORBIS_LOG_TODO(__FUNCTION__); + + std::this_thread::sleep_for(std::chrono::days(1)); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = nsid_ctl_ioctl, + .read = nsid_ctl_read, +}; + +struct NsidCtlDevice : 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 *createNsidCtlCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/main.cpp b/rpcsx/main.cpp index 0d3833366..d5e00b654 100644 --- a/rpcsx/main.cpp +++ b/rpcsx/main.cpp @@ -434,6 +434,26 @@ static void guestInitDev() { if (orbis::g_context.fwType == orbis::FwType::Ps5) { vfs::addDevice("iccnvs4", createIccPowerCharacterDevice()); vfs::addDevice("ajmi", createAjmCharacterDevice()); + vfs::addDevice("ssd0", createHddCharacterDevice(0x100000000)); + vfs::addDevice("nsid1.ctl", createNsidCtlCharacterDevice()); + vfs::addDevice("ssd0.swapx2", createHddCharacterDevice(0x100000000)); + vfs::addDevice("ssd0.bd_rvlist", createHddCharacterDevice(1048576)); + vfs::addDevice("ssd0.system", createHddCharacterDevice(671088640)); + vfs::addDevice("ssd0.system_ex", createHddCharacterDevice(1610612736)); + vfs::addDevice("ssd0.system_b", createHddCharacterDevice(671088640)); + vfs::addDevice("ssd0.system_ex_b", createHddCharacterDevice(1610612736)); + vfs::addDevice("ssd0.preinst", createHddCharacterDevice(155189248)); + vfs::addDevice("ssd0.app_temp0", createHddCharacterDevice(1073741824)); + // vfs::addDevice("ssd0.app_temp1", createHddCharacterDevice(1073741824)); + vfs::addDevice("ssd0.system_data", createHddCharacterDevice(8589934592)); + vfs::addDevice("ssd0.update", createHddCharacterDevice(4294967296)); + vfs::addDevice("ssd0.swap", createHddCharacterDevice(8589934592)); + vfs::addDevice("ssd0.app_swap", createHddCharacterDevice(15032385536)); + vfs::addDevice("ssd0.hibernation", createHddCharacterDevice(3623878656)); + vfs::addDevice("ssd0.user", createHddCharacterDevice(-41630302208)); /// ????? + vfs::addDevice("ssd0.user_bfs", createHddCharacterDevice(0x100000000)); + vfs::addDevice("bfs/ctl", createHddCharacterDevice(0x100000000)); + vfs::addDevice("a53io", createA53IoCharacterDevice()); } // mbus->emitEvent({