[Win] Revert XE_USE_KUSER_SHARED back to 0

Also limit queued audio frames
This commit is contained in:
Gliniak 2023-02-11 18:20:21 +01:00
parent 321dd75e05
commit c74a047655
3 changed files with 6 additions and 5 deletions

View File

@ -46,10 +46,10 @@ AudioSystem::AudioSystem(cpu::Processor* processor)
processor_(processor),
worker_running_(false) {
std::memset(clients_, 0, sizeof(clients_));
queued_frames_ = std::max(cvars::max_queued_frames, (uint32_t)16);
for (size_t i = 0; i < kMaximumClientCount; ++i) {
client_semaphores_[i] =
xe::threading::Semaphore::Create(0, cvars::max_queued_frames);
client_semaphores_[i] = xe::threading::Semaphore::Create(0, queued_frames_);
wait_handles_[i] = client_semaphores_[i].get();
}
shutdown_event_ = xe::threading::Event::CreateAutoResetEvent(false);
@ -179,7 +179,7 @@ X_STATUS AudioSystem::RegisterClient(uint32_t callback, uint32_t callback_arg,
assert_true(index >= 0);
auto client_semaphore = client_semaphores_[index].get();
auto ret = client_semaphore->Release(cvars::max_queued_frames, nullptr);
auto ret = client_semaphore->Release(queued_frames_, nullptr);
assert_true(ret);
AudioDriver* driver;
@ -282,7 +282,7 @@ bool AudioSystem::Restore(ByteStream* stream) {
client.in_use = true;
auto client_semaphore = client_semaphores_[id].get();
auto ret = client_semaphore->Release(cvars::max_queued_frames, nullptr);
auto ret = client_semaphore->Release(queued_frames_, nullptr);
assert_true(ret);
AudioDriver* driver = nullptr;

View File

@ -70,6 +70,7 @@ class AudioSystem {
Memory* memory_ = nullptr;
cpu::Processor* processor_ = nullptr;
std::unique_ptr<XmaDecoder> xma_decoder_;
uint32_t queued_frames_;
std::atomic<bool> worker_running_ = {false};
kernel::object_ref<kernel::XHostThread> worker_thread_;

View File

@ -37,7 +37,7 @@
#define XE_USE_NTDLL_FUNCTIONS 1
//chrispy: disabling this for now, more research needs to be done imo, although it does work very well on my machine
//
#define XE_USE_KUSER_SHARED 1
#define XE_USE_KUSER_SHARED 0
#if XE_USE_NTDLL_FUNCTIONS == 1
/*
ntdll versions of functions often skip through a lot of extra garbage in