From 60ef171ff2ff02cdd28f53b9ba41a99eaa5da567 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Tue, 22 Oct 2013 23:46:42 -0700 Subject: [PATCH] XNetStartup/WSAStartup stubs. --- src/xenia/kernel/modules/xam/sources.gypi | 2 + src/xenia/kernel/modules/xam/xam_module.cc | 1 + src/xenia/kernel/modules/xam/xam_net.cc | 76 ++++++++++++++++++++++ src/xenia/kernel/modules/xam/xam_net.h | 31 +++++++++ src/xenia/kernel/modules/xam/xam_private.h | 1 + 5 files changed, 111 insertions(+) create mode 100644 src/xenia/kernel/modules/xam/xam_net.cc create mode 100644 src/xenia/kernel/modules/xam/xam_net.h diff --git a/src/xenia/kernel/modules/xam/sources.gypi b/src/xenia/kernel/modules/xam/sources.gypi index 888018922..b5f78a6ea 100644 --- a/src/xenia/kernel/modules/xam/sources.gypi +++ b/src/xenia/kernel/modules/xam/sources.gypi @@ -5,6 +5,8 @@ 'xam_info.h', 'xam_module.cc', 'xam_module.h', + 'xam_net.cc', + 'xam_net.h', 'xam_ordinals.h', 'xam_private.h', 'xam_state.cc', diff --git a/src/xenia/kernel/modules/xam/xam_module.cc b/src/xenia/kernel/modules/xam/xam_module.cc index 34438569f..260f82327 100644 --- a/src/xenia/kernel/modules/xam/xam_module.cc +++ b/src/xenia/kernel/modules/xam/xam_module.cc @@ -42,6 +42,7 @@ XamModule::XamModule(Runtime* runtime) : // Register all exported functions. RegisterInfoExports(export_resolver_.get(), xam_state.get()); + RegisterNetExports(export_resolver_.get(), xam_state.get()); RegisterVideoExports(export_resolver_.get(), xam_state.get()); } diff --git a/src/xenia/kernel/modules/xam/xam_net.cc b/src/xenia/kernel/modules/xam/xam_net.cc new file mode 100644 index 000000000..4f946b259 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_net.cc @@ -0,0 +1,76 @@ +/** + ****************************************************************************** + * 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 NetDll_XNetStartup_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t one = SHIM_GET_ARG_32(0); + uint32_t params_ptr = SHIM_GET_ARG_32(1); + + XELOGD( + "NetDll_XNetStartup(%d, %.8X)", + one, + params_ptr); + + SHIM_SET_RETURN(0); +} + + +SHIM_CALL NetDll_WSAStartup_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t one = SHIM_GET_ARG_32(0); + uint32_t version = SHIM_GET_ARG_16(1); + uint32_t data_ptr = SHIM_GET_ARG_32(2); + + XELOGD( + "NetDll_WSAStartup(%d, %.4X, %.8X)", + one, + version, + data_ptr); + + if (data_ptr) { + SHIM_SET_MEM_16(data_ptr + 0x000, version); + SHIM_SET_MEM_16(data_ptr + 0x002, 0); + SHIM_SET_MEM_32(data_ptr + 0x004, 0); + SHIM_SET_MEM_32(data_ptr + 0x105, 0); + SHIM_SET_MEM_16(data_ptr + 0x186, 0); + SHIM_SET_MEM_16(data_ptr + 0x188, 0); + SHIM_SET_MEM_32(data_ptr + 0x190, 0); + } + + SHIM_SET_RETURN(0); +} + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +void xe::kernel::xam::RegisterNetExports( + ExportResolver* export_resolver, XamState* state) { + SHIM_SET_MAPPING("xam.xex", NetDll_XNetStartup, state); + SHIM_SET_MAPPING("xam.xex", NetDll_WSAStartup, state); +} diff --git a/src/xenia/kernel/modules/xam/xam_net.h b/src/xenia/kernel/modules/xam/xam_net.h new file mode 100644 index 000000000..24a31fa47 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_net.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_NET_H_ +#define XENIA_KERNEL_MODULES_XAM_NET_H_ + +#include +#include + +#include + + +namespace xe { +namespace kernel { +namespace xam { + + + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +#endif // XENIA_KERNEL_MODULES_XAM_NET_H_ diff --git a/src/xenia/kernel/modules/xam/xam_private.h b/src/xenia/kernel/modules/xam/xam_private.h index d15cf7265..ab455ea90 100644 --- a/src/xenia/kernel/modules/xam/xam_private.h +++ b/src/xenia/kernel/modules/xam/xam_private.h @@ -31,6 +31,7 @@ extern XamState* shared_xam_state_; // Registration functions, one per file. void RegisterInfoExports(ExportResolver* export_resolver, XamState* state); +void RegisterNetExports(ExportResolver* export_resolver, XamState* state); void RegisterVideoExports(ExportResolver* export_resolver, XamState* state);