diff --git a/src/xenia/kernel/xam_content.cc b/src/xenia/kernel/xam_content.cc index 4b045c1dd..e5fd8913c 100644 --- a/src/xenia/kernel/xam_content.cc +++ b/src/xenia/kernel/xam_content.cc @@ -33,14 +33,17 @@ SHIM_CALL XamContentGetLicenseMask_shim( mask_ptr, overlapped_ptr); - assert_zero(overlapped_ptr); - // Arcade games seem to call this and check the result mask for random bits. // If we fail, the games seem to use a hardcoded mask, which is likely trial. // To be clever, let's just try setting all the bits. SHIM_SET_MEM_32(mask_ptr, 0xFFFFFFFF); - SHIM_SET_RETURN_32(X_ERROR_SUCCESS); + if (overlapped_ptr) { + state->CompleteOverlappedImmediate(overlapped_ptr, X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_IO_PENDING); + } else { + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); + } } diff --git a/src/xenia/kernel/xam_info.cc b/src/xenia/kernel/xam_info.cc index 3a05acab9..debb8b62b 100644 --- a/src/xenia/kernel/xam_info.cc +++ b/src/xenia/kernel/xam_info.cc @@ -125,10 +125,11 @@ SHIM_CALL XamEnumerate_shim( } if (item_count_ptr) { + assert_zero(overlapped_ptr); SHIM_SET_MEM_32(item_count_ptr, 0); } else if (overlapped_ptr) { - // TODO(benvanik): overlapped IO. - assert_zero(overlapped_ptr); + assert_zero(item_count_ptr); + state->CompleteOverlappedImmediate(overlapped_ptr, 0, 0); } else { assert_always(); } diff --git a/src/xenia/kernel/xam_msg.cc b/src/xenia/kernel/xam_msg.cc index f15efcaa3..fa24c6e05 100644 --- a/src/xenia/kernel/xam_msg.cc +++ b/src/xenia/kernel/xam_msg.cc @@ -11,6 +11,7 @@ #include #include +#include #include @@ -36,6 +37,9 @@ SHIM_CALL XMsgInProcessCall_shim( auto result = state->app_manager()->DispatchMessageSync( app, message, arg1, arg2); + if (result == X_ERROR_NOT_FOUND) { + XELOGE("XMsgStartIORequest: app not found"); + } SHIM_SET_RETURN_32(result); } @@ -56,6 +60,9 @@ SHIM_CALL XMsgStartIORequest_shim( auto result = state->app_manager()->DispatchMessageAsync( app, message, buffer, buffer_length); + if (result == X_ERROR_NOT_FOUND) { + XELOGE("XMsgStartIORequest: app not found"); + } SHIM_SET_RETURN_32(result); } @@ -69,8 +76,15 @@ SHIM_CALL XMsgCancelIORequest_shim( "XMsgCancelIORequest(%.8X, %d)", overlapped_ptr, wait); - // ? - XELOGW("XMsgCancelIORequest NOT IMPLEMENTED (wait?)"); + X_HANDLE event_handle = XOverlappedGetEvent(SHIM_MEM_ADDR(overlapped_ptr)); + if (event_handle && wait) { + XEvent* ev = nullptr; + if (XSUCCEEDED(state->object_table()->GetObject( + event_handle, reinterpret_cast(&ev)))) { + ev->Wait(0, 0, true, nullptr); + ev->Release(); + } + } SHIM_SET_RETURN_32(0); } diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index bf22088b8..7f9b7ce9b 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -141,6 +141,10 @@ SHIM_CALL XamUserReadProfileSettings_shim( // Title ID = 0 means us. // 0xfffe07d1 = profile? + if (user_index == 255) { + user_index = 0; + } + if (user_index) { // Only support user 0. SHIM_SET_RETURN_32(X_ERROR_NOT_FOUND); diff --git a/src/xenia/kernel/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl_threading.cc index 6aaa8b78c..17991b47a 100644 --- a/src/xenia/kernel/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl_threading.cc @@ -388,8 +388,8 @@ uint64_t xeKeQueryPerformanceFrequency() { SHIM_CALL KeQueryPerformanceFrequency_shim( PPCContext* ppc_state, KernelState* state) { - XELOGD( - "KeQueryPerformanceFrequency()"); + // XELOGD( + // "KeQueryPerformanceFrequency()"); uint64_t result = xeKeQueryPerformanceFrequency(); SHIM_SET_RETURN_64(result); @@ -410,9 +410,9 @@ SHIM_CALL KeDelayExecutionThread_shim( uint32_t interval_ptr = SHIM_GET_ARG_32(2); uint64_t interval = SHIM_MEM_64(interval_ptr); - XELOGD( - "KeDelayExecutionThread(%.8X, %d, %.8X(%.16llX)", - processor_mode, alertable, interval_ptr, interval); + // XELOGD( + // "KeDelayExecutionThread(%.8X, %d, %.8X(%.16llX)", + // processor_mode, alertable, interval_ptr, interval); X_STATUS result = xeKeDelayExecutionThread( processor_mode, alertable, interval);