From fbff939832cc89c8d27a7a892e638c428c1399c2 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Thu, 10 Dec 2020 20:32:03 -0600 Subject: [PATCH] [NET] Link up XNet again --- src/xenia/kernel/xam/xam_module.h | 5 +++++ src/xenia/kernel/xam/xam_net.cc | 19 +++++++++---------- src/xenia/kernel/xnet.cc | 2 ++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/xenia/kernel/xam/xam_module.h b/src/xenia/kernel/xam/xam_module.h index 6c5d88cbb..10f877bd2 100644 --- a/src/xenia/kernel/xam/xam_module.h +++ b/src/xenia/kernel/xam/xam_module.h @@ -16,6 +16,7 @@ #include "xenia/kernel/kernel_module.h" #include "xenia/kernel/kernel_state.h" #include "xenia/kernel/xam/xam_ordinals.h" +#include "xenia/kernel/xnet.h" namespace xe { namespace kernel { @@ -40,8 +41,12 @@ class XamModule : public KernelModule { const LoaderData& loader_data() const { return loader_data_; } LoaderData& loader_data() { return loader_data_; } + XNet* xnet() { return xnet_.get(); } + void set_xnet(XNet* net) { xnet_.reset(net); } + private: LoaderData loader_data_; + std::unique_ptr xnet_; }; } // namespace xam diff --git a/src/xenia/kernel/xam/xam_net.cc b/src/xenia/kernel/xam/xam_net.cc index 7b37e2b94..48d07b485 100644 --- a/src/xenia/kernel/xam/xam_net.cc +++ b/src/xenia/kernel/xam/xam_net.cc @@ -247,8 +247,6 @@ dword_result_t NetDll_WSAStartup(dword_t caller, word_t version, } #endif - // DEBUG - /* auto xam = kernel_state()->GetKernelModule("xam.xex"); if (!xam->xnet()) { auto xnet = new XNet(kernel_state()); @@ -256,7 +254,6 @@ dword_result_t NetDll_WSAStartup(dword_t caller, word_t version, xam->set_xnet(xnet); } - */ return ret; } @@ -503,15 +500,17 @@ dword_result_t NetDll_XNetSetSystemLinkPort(dword_t caller, dword_t port) { DECLARE_XAM_EXPORT1(NetDll_XNetSetSystemLinkPort, kNetworking, kStub); // https://github.com/ILOVEPIE/Cxbx-Reloaded/blob/master/src/CxbxKrnl/EmuXOnline.h#L39 -struct XEthernetStatus { - static const uint32_t XNET_ETHERNET_LINK_ACTIVE = 0x01; - static const uint32_t XNET_ETHERNET_LINK_100MBPS = 0x02; - static const uint32_t XNET_ETHERNET_LINK_10MBPS = 0x04; - static const uint32_t XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08; - static const uint32_t XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10; +enum XEthernetStatus { + XNET_ETHERNET_LINK_ACTIVE = 0x01, + XNET_ETHERNET_LINK_100MBPS = 0x02, + XNET_ETHERNET_LINK_10MBPS = 0x04, + XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08, + XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10, }; -dword_result_t NetDll_XNetGetEthernetLinkStatus(dword_t caller) { return 0; } +dword_result_t NetDll_XNetGetEthernetLinkStatus(dword_t caller) { + return XNET_ETHERNET_LINK_ACTIVE | XNET_ETHERNET_LINK_100MBPS | XNET_ETHERNET_LINK_FULL_DUPLEX; +} DECLARE_XAM_EXPORT1(NetDll_XNetGetEthernetLinkStatus, kNetworking, kStub); dword_result_t NetDll_XNetDnsLookup(dword_t caller, lpstring_t host, diff --git a/src/xenia/kernel/xnet.cc b/src/xenia/kernel/xnet.cc index 4c9d062ec..07c194944 100644 --- a/src/xenia/kernel/xnet.cc +++ b/src/xenia/kernel/xnet.cc @@ -179,6 +179,7 @@ X_STATUS XNet::Initialize() { GenerateLANKeys(lan_key_hdr->key); // Now listen for packets from our little utility + /* proxy_socket_ = Socket::Connect("127.0.0.1", 45981); if (!proxy_socket_) { xe::FatalError(__FILE__ ": DEBUG - Could not connect to network proxy!"); @@ -187,6 +188,7 @@ X_STATUS XNet::Initialize() { proxy_recv_thread_ = std::make_unique( kernel_state_, 0, 0, std::bind(&XNet::ProxyRecvThreadEntry, this)); proxy_recv_thread_->Create(); + */ // Test // SendPacket(nullptr, nullptr, game_data, sizeof(game_data));