rpcsx-os: create audio device only for hdmi aout

This commit is contained in:
Nikita Savyolov 2024-10-04 09:40:52 +03:00
parent 3c1620c030
commit cfc42bf804
No known key found for this signature in database
GPG key ID: 32C1EF023AFC184B
3 changed files with 13 additions and 9 deletions

View file

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

View file

@ -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<orbis::File> *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<orbis::File> *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<AoutDevice>(); }
IoDevice *createAoutCharacterDevice(std::int8_t id) {
return orbis::knew<AoutDevice>(id);
}

View file

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