Misc fixes (overlapped IO, etc).

This commit is contained in:
Ben Vanik 2014-08-03 22:25:38 -07:00
parent 0a9d936f1e
commit 35885f761c
5 changed files with 34 additions and 12 deletions

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -11,6 +11,7 @@
#include <xenia/kernel/kernel_state.h>
#include <xenia/kernel/xam_private.h>
#include <xenia/kernel/objects/xevent.h>
#include <xenia/kernel/util/shim_utils.h>
@ -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<XObject**>(&ev)))) {
ev->Wait(0, 0, true, nullptr);
ev->Release();
}
}
SHIM_SET_RETURN_32(0);
}

View File

@ -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);

View File

@ -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);