From c996a4bbafcd47397a28605a897aab4f5b34a2ce Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 23 Oct 2013 00:05:50 -0700 Subject: [PATCH] Stubs for more XAM functions. --- src/xenia/kernel/modules/xam/sources.gypi | 6 ++ src/xenia/kernel/modules/xam/xam_content.cc | 49 +++++++++++++++ src/xenia/kernel/modules/xam/xam_content.h | 31 +++++++++ src/xenia/kernel/modules/xam/xam_input.cc | 49 +++++++++++++++ src/xenia/kernel/modules/xam/xam_input.h | 31 +++++++++ src/xenia/kernel/modules/xam/xam_module.cc | 3 + src/xenia/kernel/modules/xam/xam_private.h | 3 + src/xenia/kernel/modules/xam/xam_user.cc | 69 +++++++++++++++++++++ src/xenia/kernel/modules/xam/xam_user.h | 31 +++++++++ 9 files changed, 272 insertions(+) create mode 100644 src/xenia/kernel/modules/xam/xam_content.cc create mode 100644 src/xenia/kernel/modules/xam/xam_content.h create mode 100644 src/xenia/kernel/modules/xam/xam_input.cc create mode 100644 src/xenia/kernel/modules/xam/xam_input.h create mode 100644 src/xenia/kernel/modules/xam/xam_user.cc create mode 100644 src/xenia/kernel/modules/xam/xam_user.h diff --git a/src/xenia/kernel/modules/xam/sources.gypi b/src/xenia/kernel/modules/xam/sources.gypi index b5f78a6ea..1ec8c9841 100644 --- a/src/xenia/kernel/modules/xam/sources.gypi +++ b/src/xenia/kernel/modules/xam/sources.gypi @@ -1,8 +1,12 @@ # Copyright 2013 Ben Vanik. All Rights Reserved. { 'sources': [ + 'xam_content.cc', + 'xam_content.h', 'xam_info.cc', 'xam_info.h', + 'xam_input.cc', + 'xam_input.h', 'xam_module.cc', 'xam_module.h', 'xam_net.cc', @@ -12,6 +16,8 @@ 'xam_state.cc', 'xam_state.h', 'xam_table.inc', + 'xam_user.cc', + 'xam_user.h', 'xam_video.cc', 'xam_video.h', ], diff --git a/src/xenia/kernel/modules/xam/xam_content.cc b/src/xenia/kernel/modules/xam/xam_content.cc new file mode 100644 index 000000000..266388ac1 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_content.cc @@ -0,0 +1,49 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include +#include +#include + + +using namespace xe; +using namespace xe::kernel; +using namespace xe::kernel::xam; + + +namespace xe { +namespace kernel { +namespace xam { + + +SHIM_CALL XamContentGetLicenseMask_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t unk0_ptr = SHIM_GET_ARG_32(0); + uint32_t unk1_ptr = SHIM_GET_ARG_32(1); + + XELOGD( + "XamContentGetLicenseMask(%.8X, %.8X)", + unk0_ptr, + unk1_ptr); + + SHIM_SET_RETURN(X_STATUS_NOT_IMPLEMENTED); +} + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +void xe::kernel::xam::RegisterContentExports( + ExportResolver* export_resolver, XamState* state) { + SHIM_SET_MAPPING("xam.xex", XamContentGetLicenseMask, state); +} diff --git a/src/xenia/kernel/modules/xam/xam_content.h b/src/xenia/kernel/modules/xam/xam_content.h new file mode 100644 index 000000000..c5d0d4f05 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_content.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_MODULES_XAM_CONTENT_H_ +#define XENIA_KERNEL_MODULES_XAM_CONTENT_H_ + +#include +#include + +#include + + +namespace xe { +namespace kernel { +namespace xam { + + + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +#endif // XENIA_KERNEL_MODULES_XAM_CONTENT_H_ diff --git a/src/xenia/kernel/modules/xam/xam_input.cc b/src/xenia/kernel/modules/xam/xam_input.cc new file mode 100644 index 000000000..908b93f88 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_input.cc @@ -0,0 +1,49 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include +#include +#include + + +using namespace xe; +using namespace xe::kernel; +using namespace xe::kernel::xam; + + +namespace xe { +namespace kernel { +namespace xam { + + +SHIM_CALL XamInputGetState_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t user_index = SHIM_GET_ARG_32(0); + uint32_t state_ptr = SHIM_GET_ARG_32(1); + + XELOGD( + "XamInputGetState(%d, %.8X)", + user_index, + state_ptr); + + SHIM_SET_RETURN(X_STATUS_NOT_IMPLEMENTED); +} + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +void xe::kernel::xam::RegisterInputExports( + ExportResolver* export_resolver, XamState* state) { + SHIM_SET_MAPPING("xam.xex", XamInputGetState, state); +} diff --git a/src/xenia/kernel/modules/xam/xam_input.h b/src/xenia/kernel/modules/xam/xam_input.h new file mode 100644 index 000000000..8dd6a011e --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_input.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_MODULES_XAM_INPUT_H_ +#define XENIA_KERNEL_MODULES_XAM_INPUT_H_ + +#include +#include + +#include + + +namespace xe { +namespace kernel { +namespace xam { + + + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +#endif // XENIA_KERNEL_MODULES_XAM_INPUT_H_ diff --git a/src/xenia/kernel/modules/xam/xam_module.cc b/src/xenia/kernel/modules/xam/xam_module.cc index 260f82327..f25331020 100644 --- a/src/xenia/kernel/modules/xam/xam_module.cc +++ b/src/xenia/kernel/modules/xam/xam_module.cc @@ -41,8 +41,11 @@ XamModule::XamModule(Runtime* runtime) : shared_xam_state_ = xam_state.get(); // Register all exported functions. + RegisterContentExports(export_resolver_.get(), xam_state.get()); RegisterInfoExports(export_resolver_.get(), xam_state.get()); + RegisterInputExports(export_resolver_.get(), xam_state.get()); RegisterNetExports(export_resolver_.get(), xam_state.get()); + RegisterUserExports(export_resolver_.get(), xam_state.get()); RegisterVideoExports(export_resolver_.get(), xam_state.get()); } diff --git a/src/xenia/kernel/modules/xam/xam_private.h b/src/xenia/kernel/modules/xam/xam_private.h index ab455ea90..32375d540 100644 --- a/src/xenia/kernel/modules/xam/xam_private.h +++ b/src/xenia/kernel/modules/xam/xam_private.h @@ -30,8 +30,11 @@ extern XamState* shared_xam_state_; // Registration functions, one per file. +void RegisterContentExports(ExportResolver* export_resolver, XamState* state); void RegisterInfoExports(ExportResolver* export_resolver, XamState* state); +void RegisterInputExports(ExportResolver* export_resolver, XamState* state); void RegisterNetExports(ExportResolver* export_resolver, XamState* state); +void RegisterUserExports(ExportResolver* export_resolver, XamState* state); void RegisterVideoExports(ExportResolver* export_resolver, XamState* state); diff --git a/src/xenia/kernel/modules/xam/xam_user.cc b/src/xenia/kernel/modules/xam/xam_user.cc new file mode 100644 index 000000000..ef2a0730e --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_user.cc @@ -0,0 +1,69 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include +#include +#include + + +using namespace xe; +using namespace xe::kernel; +using namespace xe::kernel::xam; + + +namespace xe { +namespace kernel { +namespace xam { + + +SHIM_CALL XamUserGetXUID_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t user_index = SHIM_GET_ARG_32(0); + uint32_t xuid_ptr = SHIM_GET_ARG_32(1); + + XELOGD( + "XamUserGetXUID(%d, %.8X)", + user_index, + xuid_ptr); + + if (xuid_ptr) { + SHIM_SET_MEM_32(xuid_ptr, 0xBABEBABE); + } + + SHIM_SET_RETURN(0); +} + + +SHIM_CALL XamUserGetSigninState_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t user_index = SHIM_GET_ARG_32(0); + + XELOGD( + "XamUserGetSigninState(%d)", + user_index); + + SHIM_SET_RETURN(0); +} + + +// XamUserReadProfileSettings + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +void xe::kernel::xam::RegisterUserExports( + ExportResolver* export_resolver, XamState* state) { + SHIM_SET_MAPPING("xam.xex", XamUserGetXUID, state); + SHIM_SET_MAPPING("xam.xex", XamUserGetSigninState, state); +} diff --git a/src/xenia/kernel/modules/xam/xam_user.h b/src/xenia/kernel/modules/xam/xam_user.h new file mode 100644 index 000000000..a6382e5c0 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_user.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_MODULES_XAM_USER_H_ +#define XENIA_KERNEL_MODULES_XAM_USER_H_ + +#include +#include + +#include + + +namespace xe { +namespace kernel { +namespace xam { + + + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +#endif // XENIA_KERNEL_MODULES_XAM_USER_H_