[NET] Link up XNet again

This commit is contained in:
Dr. Chat 2020-12-10 20:32:03 -06:00
parent 82793a1085
commit fbff939832
3 changed files with 16 additions and 10 deletions

View File

@ -16,6 +16,7 @@
#include "xenia/kernel/kernel_module.h" #include "xenia/kernel/kernel_module.h"
#include "xenia/kernel/kernel_state.h" #include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xam/xam_ordinals.h" #include "xenia/kernel/xam/xam_ordinals.h"
#include "xenia/kernel/xnet.h"
namespace xe { namespace xe {
namespace kernel { namespace kernel {
@ -40,8 +41,12 @@ class XamModule : public KernelModule {
const LoaderData& loader_data() const { return loader_data_; } const LoaderData& loader_data() const { return loader_data_; }
LoaderData& loader_data() { return loader_data_; } LoaderData& loader_data() { return loader_data_; }
XNet* xnet() { return xnet_.get(); }
void set_xnet(XNet* net) { xnet_.reset(net); }
private: private:
LoaderData loader_data_; LoaderData loader_data_;
std::unique_ptr<XNet> xnet_;
}; };
} // namespace xam } // namespace xam

View File

@ -247,8 +247,6 @@ dword_result_t NetDll_WSAStartup(dword_t caller, word_t version,
} }
#endif #endif
// DEBUG
/*
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex"); auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
if (!xam->xnet()) { if (!xam->xnet()) {
auto xnet = new XNet(kernel_state()); 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); xam->set_xnet(xnet);
} }
*/
return ret; return ret;
} }
@ -503,15 +500,17 @@ dword_result_t NetDll_XNetSetSystemLinkPort(dword_t caller, dword_t port) {
DECLARE_XAM_EXPORT1(NetDll_XNetSetSystemLinkPort, kNetworking, kStub); DECLARE_XAM_EXPORT1(NetDll_XNetSetSystemLinkPort, kNetworking, kStub);
// https://github.com/ILOVEPIE/Cxbx-Reloaded/blob/master/src/CxbxKrnl/EmuXOnline.h#L39 // https://github.com/ILOVEPIE/Cxbx-Reloaded/blob/master/src/CxbxKrnl/EmuXOnline.h#L39
struct XEthernetStatus { enum XEthernetStatus {
static const uint32_t XNET_ETHERNET_LINK_ACTIVE = 0x01; XNET_ETHERNET_LINK_ACTIVE = 0x01,
static const uint32_t XNET_ETHERNET_LINK_100MBPS = 0x02; XNET_ETHERNET_LINK_100MBPS = 0x02,
static const uint32_t XNET_ETHERNET_LINK_10MBPS = 0x04; XNET_ETHERNET_LINK_10MBPS = 0x04,
static const uint32_t XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08; XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08,
static const uint32_t XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10; 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); DECLARE_XAM_EXPORT1(NetDll_XNetGetEthernetLinkStatus, kNetworking, kStub);
dword_result_t NetDll_XNetDnsLookup(dword_t caller, lpstring_t host, dword_result_t NetDll_XNetDnsLookup(dword_t caller, lpstring_t host,

View File

@ -179,6 +179,7 @@ X_STATUS XNet::Initialize() {
GenerateLANKeys(lan_key_hdr->key); GenerateLANKeys(lan_key_hdr->key);
// Now listen for packets from our little utility // Now listen for packets from our little utility
/*
proxy_socket_ = Socket::Connect("127.0.0.1", 45981); proxy_socket_ = Socket::Connect("127.0.0.1", 45981);
if (!proxy_socket_) { if (!proxy_socket_) {
xe::FatalError(__FILE__ ": DEBUG - Could not connect to network proxy!"); xe::FatalError(__FILE__ ": DEBUG - Could not connect to network proxy!");
@ -187,6 +188,7 @@ X_STATUS XNet::Initialize() {
proxy_recv_thread_ = std::make_unique<XHostThread>( proxy_recv_thread_ = std::make_unique<XHostThread>(
kernel_state_, 0, 0, std::bind(&XNet::ProxyRecvThreadEntry, this)); kernel_state_, 0, 0, std::bind(&XNet::ProxyRecvThreadEntry, this));
proxy_recv_thread_->Create(); proxy_recv_thread_->Create();
*/
// Test // Test
// SendPacket(nullptr, nullptr, game_data, sizeof(game_data)); // SendPacket(nullptr, nullptr, game_data, sizeof(game_data));