Merge remote-tracking branch 'GliniakRepo/experimentals' into canary_experimental

This commit is contained in:
Gliniak
2022-05-19 10:51:44 +02:00
12 changed files with 64 additions and 20 deletions

View File

@@ -34,6 +34,10 @@
// and let the normal AudioSystem handling take it, to prevent duplicate
// implementations. They can be found in xboxkrnl_audio_xma.cc
DEFINE_uint32(
max_queued_frames, 64,
"Allows changing max buffered audio frames to reduce audio delay.", "APU");
namespace xe {
namespace apu {
@@ -45,8 +49,7 @@ AudioSystem::AudioSystem(cpu::Processor* processor)
for (size_t i = 0; i < kMaximumClientCount; ++i) {
client_semaphores_[i] =
xe::threading::Semaphore::Create(0, kMaximumQueuedFrames);
assert_not_null(client_semaphores_[i]);
xe::threading::Semaphore::Create(0, cvars::max_queued_frames);
wait_handles_[i] = client_semaphores_[i].get();
}
shutdown_event_ = xe::threading::Event::CreateAutoResetEvent(false);
@@ -176,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(kMaximumQueuedFrames, nullptr);
auto ret = client_semaphore->Release(cvars::max_queued_frames, nullptr);
assert_true(ret);
AudioDriver* driver;
@@ -279,7 +282,7 @@ bool AudioSystem::Restore(ByteStream* stream) {
client.in_use = true;
auto client_semaphore = client_semaphores_[id].get();
auto ret = client_semaphore->Release(kMaximumQueuedFrames, nullptr);
auto ret = client_semaphore->Release(cvars::max_queued_frames, nullptr);
assert_true(ret);
AudioDriver* driver = nullptr;

View File

@@ -348,6 +348,9 @@ void XmaContext::Decode(XMA_CONTEXT_DATA* data) {
data->input_buffer_read_offset, data->current_buffer,
current_input_buffer);
if (!current_input_buffer) {
return;
}
size_t input_buffer_0_size =
data->input_buffer_0_packet_count * kBytesPerPacket;
size_t input_buffer_1_size =
@@ -602,6 +605,9 @@ void XmaContext::Decode(XMA_CONTEXT_DATA* data) {
*/
if (ret < 0) {
XELOGE("XmaContext {}: Error during decoding", id());
data->input_buffer_0_valid = 0;
data->input_buffer_1_valid = 0;
assert_always();
return; // TODO bail out
}

View File

@@ -347,6 +347,8 @@ void XmaDecoder::WriteRegister(uint32_t addr, uint32_t value) {
// 0601h (1804h) is written to with 0x02000000 and 0x03000000 around a lock
// operation
switch (r) {
case 0x601:
break;
default: {
const auto register_info = register_file_.GetRegisterInfo(r);
if (register_info) {