diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc index 0fc5be3d5..07694e45b 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc @@ -80,9 +80,13 @@ DECLARE_XBOXKRNL_EXPORT2(XMAReleaseContext, kAudio, kImplemented, void StoreXmaContextIndexedRegister(KernelState* kernel_state, uint32_t base_reg, uint32_t context_ptr) { + uint32_t context_physical_address = + kernel_memory()->GetPhysicalAddress(context_ptr); + assert_true(context_physical_address != UINT32_MAX); auto xma_decoder = kernel_state->emulator()->audio_system()->xma_decoder(); - uint32_t hw_index = (context_ptr - xma_decoder->context_array_ptr()) / - sizeof(XMA_CONTEXT_DATA); + uint32_t hw_index = + (context_physical_address - xma_decoder->context_array_ptr()) / + sizeof(XMA_CONTEXT_DATA); uint32_t reg_num = base_reg + (hw_index >> 5) * 4; uint32_t reg_value = 1 << (hw_index & 0x1F); xma_decoder->WriteRegister(reg_num, xe::byte_swap(reg_value)); @@ -119,6 +123,9 @@ dword_result_t XMAInitializeContext(lpvoid_t context_ptr, XMA_CONTEXT_DATA context(context_ptr); + // input_buffer_0_ptr, input_buffer_1_ptr and output_buffer_ptr are physical + // already and good enough for us, checked in sk8er boi simulators skate. and + // Tony Hawk's American Wasteland. Can be 0 also (in THAW). context.input_buffer_0_ptr = context_init->input_buffer_0_ptr; context.input_buffer_0_packet_count = context_init->input_buffer_0_packet_count;