input_buffer_*_block_count -> input_buffer_*_packet_count

This commit is contained in:
Dr. Chat 2015-05-30 23:52:22 -05:00
parent 493b06a48a
commit 93763c166f
3 changed files with 17 additions and 17 deletions

View File

@ -389,7 +389,7 @@ void AudioSystem::ProcessXmaContext(XMAContext& context, XMAContextData& data) {
// Sometimes the decoder will fail on a packet. I think it's
// looking for cross-packet frames and failing. If you run it again
// on the same packet it'll work though.
XELOGAPU("APU failed to decode packet (returned %.8X)", -read_bytes);
XELOGAPU("AudioSystem: libav failed to decode packet (returned %.8X)", -read_bytes);
--decode_attempts_remaining;
}
}
@ -426,10 +426,8 @@ void AudioSystem::ProcessXmaContext(XMAContext& context, XMAContextData& data) {
// See if we've finished with the input.
// Block count is in packets, so expand by packet size.
uint32_t input_size_0_bytes =
(data.input_buffer_0_block_count) * 2048;
uint32_t input_size_1_bytes =
(data.input_buffer_1_block_count) * 2048;
uint32_t input_size_0_bytes = (data.input_buffer_0_packet_count) * 2048;
uint32_t input_size_1_bytes = (data.input_buffer_1_packet_count) * 2048;
// Total input size
uint32_t input_size_bytes = input_size_0_bytes + input_size_1_bytes;
@ -529,10 +527,9 @@ void AudioSystem::WriteRegister(uint32_t addr, uint64_t value) {
auto context_ptr = memory()->TranslateVirtual(context.guest_ptr);
XMAContextData data(context_ptr);
XELOGAPU(
"AudioSystem: kicking context %d (%d/%d bytes)", context_id,
XELOGAPU("AudioSystem: kicking context %d (%d/%d bytes)", context_id,
(data.input_buffer_read_offset & ~0x7FF) / 8,
(data.input_buffer_0_block_count + data.input_buffer_1_block_count)
(data.input_buffer_0_packet_count + data.input_buffer_1_packet_count)
* XMAContextData::kBytesPerBlock);
// Reset valid flags so our audio decoder knows to process this one.

View File

@ -44,9 +44,8 @@ struct XMAContextData {
static const uint32_t kSamplesPerSubframe = 128;
// DWORD 0
uint32_t input_buffer_0_block_count : 12; // XMASetInputBuffer0, number of
// 2KB blocks. AKA SizeRead0
// Maximum 4095 packets.
uint32_t input_buffer_0_packet_count : 12; // XMASetInputBuffer0, number of
// 2KB packets. Max 4095 packets.
uint32_t loop_count : 8; // +12bit, XMASetLoopData NumLoops
uint32_t input_buffer_0_valid : 1; // +20bit, XMAIsInputBuffer0Valid
uint32_t input_buffer_1_valid : 1; // +21bit, XMAIsInputBuffer1Valid
@ -56,8 +55,8 @@ struct XMAContextData {
// AKA OffsetWrite
// DWORD 1
uint32_t input_buffer_1_block_count : 12; // XMASetInputBuffer1, number of
// 2KB blocks.
uint32_t input_buffer_1_packet_count : 12; // XMASetInputBuffer1, number of
// 2KB packets. Max 4095 packets.
uint32_t loop_subframe_end : 2; // +12bit, XMASetLoopData
uint32_t unk_dword_1_a : 3; // ? might be loop_subframe_skip
uint32_t loop_subframe_skip : 3; // +17bit, XMASetLoopData might be

View File

@ -104,9 +104,9 @@ SHIM_CALL XMAInitializeContext_shim(PPCContext* ppc_context,
XMAContextData context(SHIM_MEM_ADDR(context_ptr));
context.input_buffer_0_ptr = SHIM_MEM_32(context_init_ptr + 0 * 4);
context.input_buffer_0_block_count = SHIM_MEM_32(context_init_ptr + 1 * 4);
context.input_buffer_0_packet_count = SHIM_MEM_32(context_init_ptr + 1 * 4);
context.input_buffer_1_ptr = SHIM_MEM_32(context_init_ptr + 2 * 4);
context.input_buffer_1_block_count = SHIM_MEM_32(context_init_ptr + 3 * 4);
context.input_buffer_1_packet_count = SHIM_MEM_32(context_init_ptr + 3 * 4);
context.input_buffer_read_offset = SHIM_MEM_32(context_init_ptr + 4 * 4);
context.output_buffer_ptr = SHIM_MEM_32(context_init_ptr + 5 * 4);
context.output_buffer_block_count = SHIM_MEM_32(context_init_ptr + 6 * 4);
@ -191,7 +191,7 @@ SHIM_CALL XMASetInputBuffer0_shim(PPCContext* ppc_context,
XMAContextData context(SHIM_MEM_ADDR(context_ptr));
context.input_buffer_0_ptr = buffer_ptr;
context.input_buffer_0_block_count = block_count;
context.input_buffer_0_packet_count = block_count;
context.input_buffer_read_offset = 32; // in bits
context.input_buffer_0_valid = buffer_ptr ? 1 : 0;
@ -240,7 +240,7 @@ SHIM_CALL XMASetInputBuffer1_shim(PPCContext* ppc_context,
XMAContextData context(SHIM_MEM_ADDR(context_ptr));
context.input_buffer_1_ptr = buffer_ptr;
context.input_buffer_1_block_count = block_count;
context.input_buffer_1_packet_count = block_count;
context.input_buffer_read_offset = 32; // in bits
context.input_buffer_1_valid = buffer_ptr ? 1 : 0;
@ -419,17 +419,21 @@ void xe::kernel::xboxkrnl::RegisterAudioXmaExports(
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetLoopData, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAGetInputBufferReadOffset, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetInputBufferReadOffset, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetInputBuffer0, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAIsInputBuffer0Valid, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetInputBuffer0Valid, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetInputBuffer1, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAIsInputBuffer1Valid, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetInputBuffer1Valid, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAIsOutputBufferValid, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetOutputBufferValid, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMASetOutputBufferReadOffset, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAGetOutputBufferReadOffset, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAGetOutputBufferWriteOffset, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAGetPacketMetadata, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAEnableContext, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMADisableContext, state);