Audio now works a bit better, but is still broken :/

This commit is contained in:
Ben Vanik
2015-05-28 02:15:30 -07:00
parent a93325434a
commit e419d314b3
4 changed files with 173 additions and 138 deletions

View File

@@ -889,21 +889,23 @@ SHIM_CALL KeWaitForMultipleObjects_shim(PPCContext* ppc_state,
X_STATUS result = X_STATUS_SUCCESS;
std::vector<object_ref<XObject>> objects(count);
std::vector<object_ref<XObject>> objects;
for (uint32_t n = 0; n < count; n++) {
uint32_t object_ptr_ptr = SHIM_MEM_32(objects_ptr + n * 4);
void* object_ptr = SHIM_MEM_ADDR(object_ptr_ptr);
objects[n] = XObject::GetNativeObject<XObject>(state, object_ptr);
if (!objects[n]) {
auto object_ref = XObject::GetNativeObject<XObject>(state, object_ptr);
if (!object_ref) {
SHIM_SET_RETURN_32(X_STATUS_INVALID_PARAMETER);
return;
}
objects.push_back(std::move(object_ref));
}
uint64_t timeout = timeout_ptr ? SHIM_MEM_64(timeout_ptr) : 0;
result = XObject::WaitMultiple(
count, reinterpret_cast<XObject**>(objects.data()), wait_type,
wait_reason, processor_mode, alertable, timeout_ptr ? &timeout : nullptr);
result = XObject::WaitMultiple(uint32_t(objects.size()),
reinterpret_cast<XObject**>(objects.data()),
wait_type, wait_reason, processor_mode,
alertable, timeout_ptr ? &timeout : nullptr);
SHIM_SET_RETURN_32(result);
}

View File

@@ -146,7 +146,7 @@ X_STATUS XObject::WaitMultiple(uint32_t count, XObject** objects,
uint32_t wait_type, uint32_t wait_reason,
uint32_t processor_mode, uint32_t alertable,
uint64_t* opt_timeout) {
void** wait_handles = (void**)alloca(sizeof(void*) * count);
HANDLE* wait_handles = (HANDLE*)alloca(sizeof(HANDLE) * count);
for (uint32_t n = 0; n < count; n++) {
wait_handles[n] = objects[n]->GetWaitHandle();
assert_not_null(wait_handles[n]);