From bde6cf0d8571be483d5a7cf7ba39939ec0341fab Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 11 Feb 2015 16:41:10 -0800 Subject: [PATCH] Stubs for XamSessionCreateHandler+co; enough to make games skip it. Fixes #150. --- src/xenia/kernel/apps/xgi_app.cc | 10 ++++++++++ src/xenia/kernel/xam_user.cc | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/xenia/kernel/apps/xgi_app.cc b/src/xenia/kernel/apps/xgi_app.cc index 816bad1f2..717d95c19 100644 --- a/src/xenia/kernel/apps/xgi_app.cc +++ b/src/xenia/kernel/apps/xgi_app.cc @@ -63,6 +63,16 @@ X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, achievements_ptr); return X_ERROR_SUCCESS; } + case 0x000B0010: { + assert_true(!buffer_length || buffer_length == 28); + // Sequence: + // - XamSessionCreateHandle + // - XamSessionRefObjByHandle + // - [this] + // - CloseHandle + XELOGD("XSessionCreateImpl(...)"); + return X_ERROR_FUNCTION_FAILED; + } case 0x000B0041: { assert_true(!buffer_length || buffer_length == 32); // 00000000 2789fecc 00000000 00000000 200491e0 00000000 200491f0 20049340 diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index 557c1170a..6cbcf28a4 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -416,6 +416,29 @@ SHIM_CALL XamWriteGamerTile_shim(PPCContext* ppc_state, KernelState* state) { } } +SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state, KernelState* state) { + uint32_t handle_ptr = SHIM_GET_ARG_32(0); + + XELOGD("XamSessionCreateHandle(%.8X)", handle_ptr); + + SHIM_SET_MEM_32(handle_ptr, 0xCAFEDEAD); + + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); +} + +SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_state, KernelState* state) { + uint32_t handle = SHIM_GET_ARG_32(0); + uint32_t obj_ptr = SHIM_GET_ARG_32(1); + + XELOGD("XamSessionRefObjByHandle(%.8X, %.8X)", handle, obj_ptr); + + assert_true(handle == 0xCAFEDEAD); + + SHIM_SET_MEM_32(obj_ptr, 0); + + SHIM_SET_RETURN_32(X_ERROR_FUNCTION_FAILED); +} + } // namespace kernel } // namespace xe @@ -434,4 +457,6 @@ void xe::kernel::xam::RegisterUserExports(ExportResolver* export_resolver, SHIM_SET_MAPPING("xam.xex", XamParseGamerTileKey, state); SHIM_SET_MAPPING("xam.xex", XamReadTileToTexture, state); SHIM_SET_MAPPING("xam.xex", XamWriteGamerTile, state); + SHIM_SET_MAPPING("xam.xex", XamSessionCreateHandle, state); + SHIM_SET_MAPPING("xam.xex", XamSessionRefObjByHandle, state); }