diff --git a/src/xenia/gpu/gl4/gl4_shader.cc b/src/xenia/gpu/gl4/gl4_shader.cc index 3f5aba911..da834faf0 100644 --- a/src/xenia/gpu/gl4/gl4_shader.cc +++ b/src/xenia/gpu/gl4/gl4_shader.cc @@ -105,7 +105,8 @@ bool GL4Shader::PrepareVertexArrayObject() { : GL_UNSIGNED_INT_2_10_10_10_REV; break; case VertexFormat::k_10_11_11: - assert_false(el.is_signed); + // assert_false(el.is_signed); + XELOGW("Signed k_10_11_11 vertex format not supported by GL"); comp_type = GL_UNSIGNED_INT_10F_11F_11F_REV; break; /*case VertexFormat::k_11_11_10: diff --git a/src/xenia/kernel/apps/apps.cc b/src/xenia/kernel/apps/apps.cc index 9fa4a6057..6e8395d0b 100644 --- a/src/xenia/kernel/apps/apps.cc +++ b/src/xenia/kernel/apps/apps.cc @@ -9,6 +9,7 @@ #include "xenia/kernel/apps/apps.h" +#include "xenia/kernel/apps/xgi_app.h" #include "xenia/kernel/apps/xmp_app.h" namespace xe { @@ -16,6 +17,7 @@ namespace kernel { namespace apps { void RegisterApps(KernelState* kernel_state, XAppManager* manager) { + manager->RegisterApp(std::make_unique(kernel_state)); manager->RegisterApp(std::make_unique(kernel_state)); } diff --git a/src/xenia/kernel/apps/sources.gypi b/src/xenia/kernel/apps/sources.gypi index 26c6663e2..d253e242e 100644 --- a/src/xenia/kernel/apps/sources.gypi +++ b/src/xenia/kernel/apps/sources.gypi @@ -3,6 +3,8 @@ 'sources': [ 'apps.cc', 'apps.h', + 'xgi_app.cc', + 'xgi_app.h', 'xmp_app.cc', 'xmp_app.h', ], diff --git a/src/xenia/kernel/apps/xgi_app.cc b/src/xenia/kernel/apps/xgi_app.cc new file mode 100644 index 000000000..0d2d4b546 --- /dev/null +++ b/src/xenia/kernel/apps/xgi_app.cc @@ -0,0 +1,77 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include "xenia/kernel/apps/xgi_app.h" + +#include "poly/threading.h" + +namespace xe { +namespace kernel { +namespace apps { + +XXGIApp::XXGIApp(KernelState* kernel_state) : XApp(kernel_state, 0xFB) {} + +// http://mb.mirage.org/bugzilla/xliveless/main.c + +X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, + uint32_t buffer_length) { + // NOTE: buffer_length may be zero or valid. + switch (message) { + case 0x000B0006: { + assert_true(!buffer_length || buffer_length == 24); + // dword r3 user index + // dword (unwritten?) + // qword 0 + // dword r4 context enum + // dword r5 value + uint32_t user_index = + poly::load_and_swap(membase_ + buffer_ptr + 0); + uint32_t context_id = + poly::load_and_swap(membase_ + buffer_ptr + 16); + uint32_t context_value = + poly::load_and_swap(membase_ + buffer_ptr + 20); + XELOGD("XUserSetContextEx(%.8X, %.8X, %.8X)", user_index, context_id, + context_value); + return X_ERROR_SUCCESS; + } + case 0x000B0007: { + // TODO(benvanik): reverse. + assert_always(); + XELOGD("XUserSetPropertyEx(...) - XGI 0x000B0007, unimplemented"); + return X_ERROR_SUCCESS; + } + case 0x000B0008: { + assert_true(!buffer_length || buffer_length == 8); + uint32_t achievement_count = + poly::load_and_swap(membase_ + buffer_ptr + 0); + uint32_t achievements_ptr = + poly::load_and_swap(membase_ + buffer_ptr + 4); + XELOGD("XUserWriteAchievements(%.8X, %.8X)", achievement_count, + achievements_ptr); + return X_ERROR_SUCCESS; + } + case 0x000B0041: { + // TODO(benvanik): reverse. + assert_always(); + XELOGD("XUserGetContext(...) - XGI 0x000B0041, unimplemented"); + return X_ERROR_SUCCESS; + } + case 0x000B0071: { + XELOGD("XGI 0x000B0071, unimplemented"); + return X_ERROR_SUCCESS; + } + } + XELOGE("Unimplemented XMsg message app=%.8X, msg=%.8X, arg1=%.8X, arg2=%.8X", + app_id(), message, buffer_ptr, buffer_length); + return X_ERROR_NOT_FOUND; +} + +} // namespace apps +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/apps/xgi_app.h b/src/xenia/kernel/apps/xgi_app.h new file mode 100644 index 000000000..d376e6add --- /dev/null +++ b/src/xenia/kernel/apps/xgi_app.h @@ -0,0 +1,35 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_ +#define XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_ + +#include "xenia/common.h" +#include "xenia/kernel/app.h" +#include "xenia/kernel/kernel_state.h" + +namespace xe { +namespace kernel { +namespace apps { + +class XXGIApp : public XApp { + public: + XXGIApp(KernelState* kernel_state); + + X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, + uint32_t buffer_length) override; + + private: +}; + +} // namespace apps +} // namespace kernel +} // namespace xe + +#endif // XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_ diff --git a/src/xenia/kernel/xam_msg.cc b/src/xenia/kernel/xam_msg.cc index e51f8f5ff..a2d36f273 100644 --- a/src/xenia/kernel/xam_msg.cc +++ b/src/xenia/kernel/xam_msg.cc @@ -43,13 +43,15 @@ SHIM_CALL XMsgStartIORequest_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("XMsgStartIORequest(%.8X, %.8X, %.8X, %.8X, %d)", app, message, overlapped_ptr, buffer, buffer_length); - assert_zero(overlapped_ptr); - auto result = state->app_manager()->DispatchMessageAsync(app, message, buffer, buffer_length); if (result == X_ERROR_NOT_FOUND) { XELOGE("XMsgStartIORequest: app %.8X undefined", app); } + if (overlapped_ptr) { + state->CompleteOverlappedImmediate(overlapped_ptr, result); + result = X_ERROR_IO_PENDING; + } SHIM_SET_RETURN_32(result); } @@ -64,13 +66,15 @@ SHIM_CALL XMsgStartIORequestEx_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("XMsgStartIORequestEx(%.8X, %.8X, %.8X, %.8X, %d, %.8X)", app, message, overlapped_ptr, buffer, buffer_length, unknown_ptr); - assert_zero(overlapped_ptr); - auto result = state->app_manager()->DispatchMessageAsync(app, message, buffer, buffer_length); if (result == X_ERROR_NOT_FOUND) { XELOGE("XMsgStartIORequestEx: app %.8X undefined", app); } + if (overlapped_ptr) { + state->CompleteOverlappedImmediate(overlapped_ptr, result); + result = X_ERROR_IO_PENDING; + } SHIM_SET_RETURN_32(result); }