mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-21 13:57:01 +02:00
hostmem doesn't exist?
This commit is contained in:
parent
0ca35f23eb
commit
9cf1faf9d0
3 changed files with 17 additions and 15 deletions
|
|
@ -32,24 +32,28 @@ struct PS4SinkStream final : public SinkStream {
|
||||||
system_channels = system_channels_;
|
system_channels = system_channels_;
|
||||||
device_channels = device_channels_;
|
device_channels = device_channels_;
|
||||||
|
|
||||||
auto const length = 0x800;
|
auto const length = 240 * 2;
|
||||||
auto const sample_rate = 48000;
|
auto const sample_rate = 48000;
|
||||||
auto const num_channels = this->GetDeviceChannels();
|
auto const num_channels = this->GetDeviceChannels();
|
||||||
output_buffer.resize(length * num_channels * sizeof(s16));
|
|
||||||
|
|
||||||
auto const param_type = num_channels == 1 ? ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_MONO : ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_STEREO;
|
auto const param_type = num_channels == 1 ? ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_MONO : ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_STEREO;
|
||||||
audio_dev = sceAudioOutOpen(ORBIS_USER_SERVICE_USER_ID_SYSTEM, ORBIS_AUDIO_OUT_PORT_TYPE_MAIN, 0, length, sample_rate, param_type);
|
audio_dev = sceAudioOutOpen(ORBIS_USER_SERVICE_USER_ID_SYSTEM, ORBIS_AUDIO_OUT_PORT_TYPE_MAIN, 0, length, sample_rate, param_type);
|
||||||
if (audio_dev > 0) {
|
if (audio_dev > 0) {
|
||||||
audio_thread = std::jthread([=, this](std::stop_token stop_token) {
|
audio_thread = std::jthread([=, this](std::stop_token stop_token) {
|
||||||
|
std::vector<s16> output_buffer(length * num_channels);
|
||||||
while (!stop_token.stop_requested()) {
|
while (!stop_token.stop_requested()) {
|
||||||
if (this->type == StreamType::In) {
|
if (this->type == StreamType::In) {
|
||||||
// this->ProcessAudioIn(input_buffer, length);
|
// this->ProcessAudioIn(input_buffer, length);
|
||||||
} else {
|
} else {
|
||||||
|
int err = 0;
|
||||||
sceAudioOutOutput(audio_dev, nullptr);
|
sceAudioOutOutput(audio_dev, nullptr);
|
||||||
this->ProcessAudioOutAndRender(output_buffer, length);
|
this->ProcessAudioOutAndRender(output_buffer, length);
|
||||||
sceAudioOutOutput(audio_dev, output_buffer.data());
|
if ((err = sceAudioOutOutput(audio_dev, output_buffer.data())) < 0) {
|
||||||
|
LOG_ERROR(Service_Audio, "{}", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sceAudioOutClose(audio_dev);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Service_Audio, "Failed to create audio device! {:#x}", uint32_t(audio_dev));
|
LOG_ERROR(Service_Audio, "Failed to create audio device! {:#x}", uint32_t(audio_dev));
|
||||||
|
|
@ -58,7 +62,6 @@ struct PS4SinkStream final : public SinkStream {
|
||||||
|
|
||||||
~PS4SinkStream() override {
|
~PS4SinkStream() override {
|
||||||
LOG_DEBUG(Service_Audio, "Destroying PS4 stream {}", name);
|
LOG_DEBUG(Service_Audio, "Destroying PS4 stream {}", name);
|
||||||
sceAudioOutClose(audio_dev);
|
|
||||||
if (audio_thread.joinable()) {
|
if (audio_thread.joinable()) {
|
||||||
audio_thread.request_stop();
|
audio_thread.request_stop();
|
||||||
audio_thread.join();
|
audio_thread.join();
|
||||||
|
|
@ -67,8 +70,7 @@ struct PS4SinkStream final : public SinkStream {
|
||||||
|
|
||||||
void Finalize() override {
|
void Finalize() override {
|
||||||
if (audio_dev > 0) {
|
if (audio_dev > 0) {
|
||||||
Stop();
|
|
||||||
sceAudioOutClose(audio_dev);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,7 +86,6 @@ struct PS4SinkStream final : public SinkStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<s16> output_buffer;
|
|
||||||
std::jthread audio_thread;
|
std::jthread audio_thread;
|
||||||
int32_t audio_dev{};
|
int32_t audio_dev{};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -395,8 +395,6 @@ private:
|
||||||
|
|
||||||
#elif defined(__OPENORBIS__)
|
#elif defined(__OPENORBIS__)
|
||||||
// None of the luxuries of POSIX
|
// None of the luxuries of POSIX
|
||||||
class Impl {
|
|
||||||
};
|
|
||||||
#else // ^^^ Windows ^^^ vvv POSIX vvv
|
#else // ^^^ Windows ^^^ vvv POSIX vvv
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_arm64
|
#ifdef ARCHITECTURE_arm64
|
||||||
|
|
@ -678,7 +676,10 @@ private:
|
||||||
|
|
||||||
#endif // ^^^ POSIX ^^^
|
#endif // ^^^ POSIX ^^^
|
||||||
|
|
||||||
HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_) : backing_size(backing_size_), virtual_size(virtual_size_) {
|
HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_)
|
||||||
|
: backing_size(backing_size_)
|
||||||
|
, virtual_size(virtual_size_)
|
||||||
|
{
|
||||||
#ifdef __OPENORBIS__
|
#ifdef __OPENORBIS__
|
||||||
LOG_WARNING(HW_Memory, "Platform doesn't support fastmem");
|
LOG_WARNING(HW_Memory, "Platform doesn't support fastmem");
|
||||||
fallback_buffer.emplace(backing_size);
|
fallback_buffer.emplace(backing_size);
|
||||||
|
|
@ -744,8 +745,7 @@ void HostMemory::Protect(size_t virtual_offset, size_t length, MemoryPermission
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostMemory::ClearBackingRegion(size_t physical_offset, size_t length, u32 fill_value) {
|
void HostMemory::ClearBackingRegion(size_t physical_offset, size_t length, u32 fill_value) {
|
||||||
if (!impl)
|
std::memset(backing_base + physical_offset, fill_value, length);
|
||||||
std::memset(backing_base + physical_offset, fill_value, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostMemory::EnableDirectMappedAddress() {
|
void HostMemory::EnableDirectMappedAddress() {
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t backing_size{};
|
|
||||||
size_t virtual_size{};
|
|
||||||
|
|
||||||
// Low level handler for the platform dependent memory routines
|
// Low level handler for the platform dependent memory routines
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
class Impl;
|
class Impl;
|
||||||
std::unique_ptr<Impl> impl;
|
std::unique_ptr<Impl> impl;
|
||||||
|
#endif
|
||||||
|
size_t backing_size{};
|
||||||
|
size_t virtual_size{};
|
||||||
u8* backing_base{};
|
u8* backing_base{};
|
||||||
u8* virtual_base{};
|
u8* virtual_base{};
|
||||||
size_t virtual_base_offset{};
|
size_t virtual_base_offset{};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue