Implement/Fix more SOC related functions (#6267)

* Implement SOC_U::GetHostByName and partial SOC_U::GetNetworkOpt

* Implement AC::GetWifiStatus, and get proper network interface.

* Minor fixes

* More minor fixes

* Even more fixes

* Fix Get/Set SockOpt

* Implement SendToOther

* Apply suggestions and fix timer advance

* Fix variable name

* Add more sockopt values and fix send/recv flags.

* Fix dontwait logic

* Add missing header for linux

* Remove TCP_STDURG

* Fix poll and add more 3ds <-> platform conversions

* Finish implementing all platform <-> 3ds conversion.

* Disable UDP connreset and fix poll again.

* Fix compile issues

* Apply suggestions

* Fix compiler issues

* Fix compiler errors (again)

* Fix GetAddrInfo

* Use IPC::MakeHeader instead of raw hardcoded value.
This commit is contained in:
PabloMK7 2023-05-22 04:01:08 +02:00 committed by GitHub
parent fa8c530e10
commit 5c45c97ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 983 additions and 234 deletions

View file

@ -6,6 +6,7 @@
#include "common/archives.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h"
@ -15,6 +16,7 @@
#include "core/hle/service/ac/ac.h"
#include "core/hle/service/ac/ac_i.h"
#include "core/hle/service/ac/ac_u.h"
#include "core/hle/service/soc_u.h"
#include "core/memory.h"
namespace Service::AC {
@ -91,15 +93,19 @@ void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xD, 0, 0);
bool can_reach_internet = false;
// TODO(purpasmart96): This function is only a stub,
// it returns a valid result without implementing full functionality.
std::shared_ptr<SOC::SOC_U> socu_module = SOC::GetService(Core::System::GetInstance());
if (socu_module) {
can_reach_internet = socu_module->GetDefaultInterfaceInfo().has_value();
}
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); // Connection type set to none
LOG_WARNING(Service_AC, "(STUBBED) called");
rb.Push<u32>(static_cast<u32>(can_reach_internet ? (Settings::values.is_new_3ds
? WifiStatus::STATUS_CONNECTED_N3DS
: WifiStatus::STATUS_CONNECTED_O3DS)
: WifiStatus::STATUS_DISCONNECTED));
}
void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {

View file

@ -142,6 +142,12 @@ public:
};
protected:
enum class WifiStatus {
STATUS_DISCONNECTED = 0,
STATUS_CONNECTED_O3DS = 1,
STATUS_CONNECTED_N3DS = 2,
};
struct ACConfig {
std::array<u8, 0x200> data;
};