[rpcsx-os] iodev: stub s3da, gbase, devstat, devact

Add shm, aout1, aout2, da0x15.crypt
This commit is contained in:
DH 2023-11-11 20:27:01 +03:00
parent dafbd2a0c5
commit 9f30ad9d72
9 changed files with 197 additions and 1 deletions

View file

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

View file

@ -35,3 +35,8 @@ IoDevice *createAVControlCharacterDevice();
IoDevice *createHDMICharacterDevice();
IoDevice *createMBusAVCharacterDevice();
IoDevice *createScaninCharacterDevice();
IoDevice *createS3DACharacterDevice();
IoDevice *createGbaseCharacterDevice();
IoDevice *createDevStatCharacterDevice();
IoDevice *createDevCtlCharacterDevice();
IoDevice *createDevActCharacterDevice();

View file

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

45
rpcsx-os/iodev/devact.cpp Normal file
View file

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

32
rpcsx-os/iodev/devctl.cpp Normal file
View file

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

View file

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

32
rpcsx-os/iodev/gbase.cpp Normal file
View file

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

32
rpcsx-os/iodev/s3da.cpp Normal file
View file

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

View file

@ -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();
}