mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-28 00:18:23 +00:00
Minor fixes in cellNetCtl and cellSysutil
Also fixed a couple minor bugs relating to cache.
This commit is contained in:
parent
48def8fa5b
commit
8fd52666b7
@ -100,6 +100,12 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
|
|||||||
cellNetCtl.Error("cellNetCtlGetInfo(INFO_MTU): GetAdaptersAddresses buffer overflow.");
|
cellNetCtl.Error("cellNetCtlGetInfo(INFO_MTU): GetAdaptersAddresses buffer overflow.");
|
||||||
free(pAddresses);
|
free(pAddresses);
|
||||||
pAddresses = (PIP_ADAPTER_ADDRESSES)malloc(bufLen);
|
pAddresses = (PIP_ADAPTER_ADDRESSES)malloc(bufLen);
|
||||||
|
|
||||||
|
if (pAddresses == nullptr)
|
||||||
|
{
|
||||||
|
cellNetCtl.Error("cellNetCtlGetInfo(INFO_MTU): Unable to allocate memory for pAddresses.");
|
||||||
|
return CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX, nullptr, pAddresses, &bufLen);
|
ret = GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX, nullptr, pAddresses, &bufLen);
|
||||||
@ -182,6 +188,12 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
|
|||||||
cellNetCtl.Error("cellNetCtlGetInfo(IP_ADDRESS): GetAdaptersAddresses buffer overflow.");
|
cellNetCtl.Error("cellNetCtlGetInfo(IP_ADDRESS): GetAdaptersAddresses buffer overflow.");
|
||||||
free(pAdapterInfo);
|
free(pAdapterInfo);
|
||||||
pAdapterInfo = (IP_ADAPTER_INFO*)malloc(bufLen);
|
pAdapterInfo = (IP_ADAPTER_INFO*)malloc(bufLen);
|
||||||
|
|
||||||
|
if (pAdapterInfo == nullptr)
|
||||||
|
{
|
||||||
|
cellNetCtl.Error("cellNetCtlGetInfo(IP_ADDRESS): Unable to allocate memory for pAddresses.");
|
||||||
|
return CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = GetAdaptersInfo(pAdapterInfo, &bufLen);
|
ret = GetAdaptersInfo(pAdapterInfo, &bufLen);
|
||||||
@ -251,6 +263,12 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
|
|||||||
cellNetCtl.Error("cellNetCtlGetInfo(INFO_NETMASK): GetAdaptersAddresses buffer overflow.");
|
cellNetCtl.Error("cellNetCtlGetInfo(INFO_NETMASK): GetAdaptersAddresses buffer overflow.");
|
||||||
free(pAdapterInfo);
|
free(pAdapterInfo);
|
||||||
pAdapterInfo = (IP_ADAPTER_INFO*)malloc(bufLen);
|
pAdapterInfo = (IP_ADAPTER_INFO*)malloc(bufLen);
|
||||||
|
|
||||||
|
if (pAdapterInfo == nullptr)
|
||||||
|
{
|
||||||
|
cellNetCtl.Error("cellNetCtlGetInfo(INFO_NETMASK): Unable to allocate memory for pAddresses.");
|
||||||
|
return CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = GetAdaptersInfo(pAdapterInfo, &bufLen);
|
ret = GetAdaptersInfo(pAdapterInfo, &bufLen);
|
||||||
|
@ -206,7 +206,7 @@ s32 cellSysCacheClear(void)
|
|||||||
{
|
{
|
||||||
cellSysutil.Todo("cellSysCacheClear()");
|
cellSysutil.Todo("cellSysCacheClear()");
|
||||||
|
|
||||||
if (g_sysutil->cacheMounted.exchange(false))
|
if (!g_sysutil->cacheMounted)
|
||||||
{
|
{
|
||||||
return CELL_SYSCACHE_ERROR_NOTMOUNTED;
|
return CELL_SYSCACHE_ERROR_NOTMOUNTED;
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ s32 cellSysCacheClear(void)
|
|||||||
std::string localPath;
|
std::string localPath;
|
||||||
Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath);
|
Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath);
|
||||||
|
|
||||||
// TODO: Delete everything in the cache folder, except the README
|
// TODO: Write tests to figure out, what is deleted.
|
||||||
|
|
||||||
return CELL_SYSCACHE_RET_OK_CLEARED;
|
return CELL_SYSCACHE_RET_OK_CLEARED;
|
||||||
}
|
}
|
||||||
@ -229,6 +229,7 @@ s32 cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
|||||||
strncpy(param->getCachePath, ("/dev_hdd1/cache/" + std::string(id) + "/").c_str(), CELL_SYSCACHE_PATH_MAX);
|
strncpy(param->getCachePath, ("/dev_hdd1/cache/" + std::string(id) + "/").c_str(), CELL_SYSCACHE_PATH_MAX);
|
||||||
param->getCachePath[CELL_SYSCACHE_PATH_MAX - 1] = '\0';
|
param->getCachePath[CELL_SYSCACHE_PATH_MAX - 1] = '\0';
|
||||||
Emu.GetVFS().CreateDir(std::string(param->getCachePath));
|
Emu.GetVFS().CreateDir(std::string(param->getCachePath));
|
||||||
|
g_sysutil->cacheMounted.exchange(true);
|
||||||
|
|
||||||
return CELL_SYSCACHE_RET_OK_RELAYED;
|
return CELL_SYSCACHE_RET_OK_RELAYED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user