Make cellNetCtlGetInfo returns the correct value in disconnected mode

This commit is contained in:
scribam 2018-02-04 22:43:22 +01:00 committed by Ivan
parent 6e8ccbcf17
commit 31cee7e4c8

View File

@ -125,20 +125,25 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
{ {
cellNetCtl.todo("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code, InfoCodeToName(code), info); cellNetCtl.todo("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code, InfoCodeToName(code), info);
if (code == CELL_NET_CTL_INFO_ETHER_ADDR)
{
// dummy values set
std::memset(info->ether_addr.data, 0xFF, sizeof(info->ether_addr.data));
return CELL_OK;
}
if (g_cfg.net.net_status == CELL_NET_CTL_STATE_Disconnected)
{
return CELL_NET_CTL_ERROR_NOT_CONNECTED;
}
if (code == CELL_NET_CTL_INFO_MTU) if (code == CELL_NET_CTL_INFO_MTU)
{ {
info->mtu = 1500; info->mtu = 1500;
} }
else if (code == CELL_NET_CTL_INFO_LINK) else if (code == CELL_NET_CTL_INFO_LINK)
{ {
if (g_cfg.net.net_status != CELL_NET_CTL_STATE_Disconnected) info->link = CELL_NET_CTL_LINK_CONNECTED;
{
info->link = CELL_NET_CTL_LINK_CONNECTED;
}
else
{
info->link = CELL_NET_CTL_LINK_DISCONNECTED;
}
} }
else if (code == CELL_NET_CTL_INFO_IP_ADDRESS) else if (code == CELL_NET_CTL_INFO_IP_ADDRESS)
{ {