diff --git a/rpcsx-os/io-devices.hpp b/rpcsx-os/io-devices.hpp index b10045a87..99f11fd50 100644 --- a/rpcsx-os/io-devices.hpp +++ b/rpcsx-os/io-devices.hpp @@ -31,7 +31,7 @@ IoDevice *createXptCharacterDevice(); IoDevice *createCdCharacterDevice(); IoDevice *createMetaDbgCharacterDevice(); IoDevice *createHddCharacterDevice(std::uint64_t size); -IoDevice *createAoutCharacterDevice(); +IoDevice *createAoutCharacterDevice(std::int8_t id); IoDevice *createAVControlCharacterDevice(); IoDevice *createHDMICharacterDevice(); IoDevice *createMBusAVCharacterDevice(); diff --git a/rpcsx-os/iodev/aout.cpp b/rpcsx-os/iodev/aout.cpp index 0c019841a..4d036c01a 100644 --- a/rpcsx-os/iodev/aout.cpp +++ b/rpcsx-os/iodev/aout.cpp @@ -28,8 +28,11 @@ struct AoutFile : orbis::File {}; struct AoutDevice : public IoDevice { + std::int8_t id; AudioDevice *audioDevice; + AoutDevice(std::int8_t id) : id(id) {} + orbis::ErrorCode open(orbis::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -187,12 +190,14 @@ orbis::ErrorCode AoutDevice::open(orbis::Ref *file, thread->where(); *file = newFile; - // TODO: create it only for hdmi device - if (true) { + // create audio device only for hdmi output, 0 - hdmi, 1 - analog, 2 - spdif + if (id == 0) { // TODO: use factory to more backends support - this->audioDevice = new AlsaDevice(); + audioDevice = new AlsaDevice(); } return {}; } -IoDevice *createAoutCharacterDevice() { return orbis::knew(); } +IoDevice *createAoutCharacterDevice(std::int8_t id) { + return orbis::knew(id); +} diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index 06628ca1a..db2e06feb 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -404,9 +404,9 @@ static void ps4InitDev() { rx::vfs::addDevice("notification3", createNotificationCharacterDevice(3)); 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("aout0", createAoutCharacterDevice(0)); + rx::vfs::addDevice("aout1", createAoutCharacterDevice(1)); + rx::vfs::addDevice("aout2", createAoutCharacterDevice(2)); rx::vfs::addDevice("av_control", createAVControlCharacterDevice()); rx::vfs::addDevice("hdmi", createHDMICharacterDevice()); rx::vfs::addDevice("mbus_av", mbusAv); @@ -2224,7 +2224,6 @@ int main(int argc, const char *argv[]) { }); // confirmed to work and known method of initialization since 5.05 version if (orbis::g_context.fwSdkVersion >= 0x5050000) { - ORBIS_LOG_TODO("FW VERSION IS", orbis::g_context.fwSdkVersion); auto fakeIpmiThread = createGuestThread(); audioIpmiClient = createIpmiClient(fakeIpmiThread, "SceSysAudioSystemIpc"); // HACK: here is a bug in audiod because we send this very early and audiod has time to reset the state due to initialization