summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CMakeLists.txt6
-rw-r--r--src/core/announce_multiplayer_session.cpp164
-rw-r--r--src/core/announce_multiplayer_session.h98
-rw-r--r--src/core/core.cpp9
-rw-r--r--src/core/file_sys/system_archive/shared_font.cpp2
-rw-r--r--src/core/hid/emulated_controller.cpp35
-rw-r--r--src/core/hid/emulated_controller.h1
-rw-r--r--src/core/hle/service/acc/acc.cpp2
-rw-r--r--src/core/hle/service/am/am.cpp2
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.cpp2
-rw-r--r--src/core/hle/service/apm/apm_controller.cpp2
-rw-r--r--src/core/hle/service/hid/hid.cpp14
-rw-r--r--src/core/hle/service/ldn/ldn_types.h16
-rw-r--r--src/core/hle/service/mm/mm_u.cpp10
-rw-r--r--src/core/hle/service/ns/iplatform_service_manager.cpp (renamed from src/core/hle/service/ns/pl_u.cpp)34
-rw-r--r--src/core/hle/service/ns/iplatform_service_manager.h (renamed from src/core/hle/service/ns/pl_u.h)6
-rw-r--r--src/core/hle/service/ns/ns.cpp5
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp4
-rw-r--r--src/core/hle/service/sockets/bsd.cpp6
-rw-r--r--src/core/internal_network/socket_proxy.cpp8
20 files changed, 112 insertions, 314 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 8db9a3c65..806e7ff6c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -2,8 +2,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
add_library(core STATIC
- announce_multiplayer_session.cpp
- announce_multiplayer_session.h
arm/arm_interface.h
arm/arm_interface.cpp
arm/dynarmic/arm_dynarmic_32.cpp
@@ -540,14 +538,14 @@ add_library(core STATIC
hle/service/npns/npns.cpp
hle/service/npns/npns.h
hle/service/ns/errors.h
+ hle/service/ns/iplatform_service_manager.cpp
+ hle/service/ns/iplatform_service_manager.h
hle/service/ns/language.cpp
hle/service/ns/language.h
hle/service/ns/ns.cpp
hle/service/ns/ns.h
hle/service/ns/pdm_qry.cpp
hle/service/ns/pdm_qry.h
- hle/service/ns/pl_u.cpp
- hle/service/ns/pl_u.h
hle/service/nvdrv/devices/nvdevice.h
hle/service/nvdrv/devices/nvdisp_disp0.cpp
hle/service/nvdrv/devices/nvdisp_disp0.h
diff --git a/src/core/announce_multiplayer_session.cpp b/src/core/announce_multiplayer_session.cpp
deleted file mode 100644
index 6737ce85a..000000000
--- a/src/core/announce_multiplayer_session.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include <chrono>
-#include <future>
-#include <vector>
-#include "announce_multiplayer_session.h"
-#include "common/announce_multiplayer_room.h"
-#include "common/assert.h"
-#include "common/settings.h"
-#include "network/network.h"
-
-#ifdef ENABLE_WEB_SERVICE
-#include "web_service/announce_room_json.h"
-#endif
-
-namespace Core {
-
-// Time between room is announced to web_service
-static constexpr std::chrono::seconds announce_time_interval(15);
-
-AnnounceMultiplayerSession::AnnounceMultiplayerSession(Network::RoomNetwork& room_network_)
- : room_network{room_network_} {
-#ifdef ENABLE_WEB_SERVICE
- backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(),
- Settings::values.yuzu_username.GetValue(),
- Settings::values.yuzu_token.GetValue());
-#else
- backend = std::make_unique<AnnounceMultiplayerRoom::NullBackend>();
-#endif
-}
-
-WebService::WebResult AnnounceMultiplayerSession::Register() {
- auto room = room_network.GetRoom().lock();
- if (!room) {
- return WebService::WebResult{WebService::WebResult::Code::LibError,
- "Network is not initialized", ""};
- }
- if (room->GetState() != Network::Room::State::Open) {
- return WebService::WebResult{WebService::WebResult::Code::LibError, "Room is not open", ""};
- }
- UpdateBackendData(room);
- WebService::WebResult result = backend->Register();
- if (result.result_code != WebService::WebResult::Code::Success) {
- return result;
- }
- LOG_INFO(WebService, "Room has been registered");
- room->SetVerifyUID(result.returned_data);
- registered = true;
- return WebService::WebResult{WebService::WebResult::Code::Success, "", ""};
-}
-
-void AnnounceMultiplayerSession::Start() {
- if (announce_multiplayer_thread) {
- Stop();
- }
- shutdown_event.Reset();
- announce_multiplayer_thread =
- std::make_unique<std::thread>(&AnnounceMultiplayerSession::AnnounceMultiplayerLoop, this);
-}
-
-void AnnounceMultiplayerSession::Stop() {
- if (announce_multiplayer_thread) {
- shutdown_event.Set();
- announce_multiplayer_thread->join();
- announce_multiplayer_thread.reset();
- backend->Delete();
- registered = false;
- }
-}
-
-AnnounceMultiplayerSession::CallbackHandle AnnounceMultiplayerSession::BindErrorCallback(
- std::function<void(const WebService::WebResult&)> function) {
- std::lock_guard lock(callback_mutex);
- auto handle = std::make_shared<std::function<void(const WebService::WebResult&)>>(function);
- error_callbacks.insert(handle);
- return handle;
-}
-
-void AnnounceMultiplayerSession::UnbindErrorCallback(CallbackHandle handle) {
- std::lock_guard lock(callback_mutex);
- error_callbacks.erase(handle);
-}
-
-AnnounceMultiplayerSession::~AnnounceMultiplayerSession() {
- Stop();
-}
-
-void AnnounceMultiplayerSession::UpdateBackendData(std::shared_ptr<Network::Room> room) {
- Network::RoomInformation room_information = room->GetRoomInformation();
- std::vector<AnnounceMultiplayerRoom::Member> memberlist = room->GetRoomMemberList();
- backend->SetRoomInformation(room_information.name, room_information.description,
- room_information.port, room_information.member_slots,
- Network::network_version, room->HasPassword(),
- room_information.preferred_game);
- backend->ClearPlayers();
- for (const auto& member : memberlist) {
- backend->AddPlayer(member);
- }
-}
-
-void AnnounceMultiplayerSession::AnnounceMultiplayerLoop() {
- // Invokes all current bound error callbacks.
- const auto ErrorCallback = [this](WebService::WebResult result) {
- std::lock_guard lock(callback_mutex);
- for (auto callback : error_callbacks) {
- (*callback)(result);
- }
- };
-
- if (!registered) {
- WebService::WebResult result = Register();
- if (result.result_code != WebService::WebResult::Code::Success) {
- ErrorCallback(result);
- return;
- }
- }
-
- auto update_time = std::chrono::steady_clock::now();
- std::future<WebService::WebResult> future;
- while (!shutdown_event.WaitUntil(update_time)) {
- update_time += announce_time_interval;
- auto room = room_network.GetRoom().lock();
- if (!room) {
- break;
- }
- if (room->GetState() != Network::Room::State::Open) {
- break;
- }
- UpdateBackendData(room);
- WebService::WebResult result = backend->Update();
- if (result.result_code != WebService::WebResult::Code::Success) {
- ErrorCallback(result);
- }
- if (result.result_string == "404") {
- registered = false;
- // Needs to register the room again
- WebService::WebResult register_result = Register();
- if (register_result.result_code != WebService::WebResult::Code::Success) {
- ErrorCallback(register_result);
- }
- }
- }
-}
-
-AnnounceMultiplayerRoom::RoomList AnnounceMultiplayerSession::GetRoomList() {
- return backend->GetRoomList();
-}
-
-bool AnnounceMultiplayerSession::IsRunning() const {
- return announce_multiplayer_thread != nullptr;
-}
-
-void AnnounceMultiplayerSession::UpdateCredentials() {
- ASSERT_MSG(!IsRunning(), "Credentials can only be updated when session is not running");
-
-#ifdef ENABLE_WEB_SERVICE
- backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(),
- Settings::values.yuzu_username.GetValue(),
- Settings::values.yuzu_token.GetValue());
-#endif
-}
-
-} // namespace Core
diff --git a/src/core/announce_multiplayer_session.h b/src/core/announce_multiplayer_session.h
deleted file mode 100644
index db790f7d2..000000000
--- a/src/core/announce_multiplayer_session.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include <atomic>
-#include <functional>
-#include <memory>
-#include <mutex>
-#include <set>
-#include <thread>
-#include "common/announce_multiplayer_room.h"
-#include "common/common_types.h"
-#include "common/thread.h"
-
-namespace Network {
-class Room;
-class RoomNetwork;
-} // namespace Network
-
-namespace Core {
-
-/**
- * Instruments AnnounceMultiplayerRoom::Backend.
- * Creates a thread that regularly updates the room information and submits them
- * An async get of room information is also possible
- */
-class AnnounceMultiplayerSession {
-public:
- using CallbackHandle = std::shared_ptr<std::function<void(const WebService::WebResult&)>>;
- AnnounceMultiplayerSession(Network::RoomNetwork& room_network_);
- ~AnnounceMultiplayerSession();
-
- /**
- * Allows to bind a function that will get called if the announce encounters an error
- * @param function The function that gets called
- * @return A handle that can be used the unbind the function
- */
- CallbackHandle BindErrorCallback(std::function<void(const WebService::WebResult&)> function);
-
- /**
- * Unbind a function from the error callbacks
- * @param handle The handle for the function that should get unbind
- */
- void UnbindErrorCallback(CallbackHandle handle);
-
- /**
- * Registers a room to web services
- * @return The result of the registration attempt.
- */
- WebService::WebResult Register();
-
- /**
- * Starts the announce of a room to web services
- */
- void Start();
-
- /**
- * Stops the announce to web services
- */
- void Stop();
-
- /**
- * Returns a list of all room information the backend got
- * @param func A function that gets executed when the async get finished, e.g. a signal
- * @return a list of rooms received from the web service
- */
- AnnounceMultiplayerRoom::RoomList GetRoomList();
-
- /**
- * Whether the announce session is still running
- */
- bool IsRunning() const;
-
- /**
- * Recreates the backend, updating the credentials.
- * This can only be used when the announce session is not running.
- */
- void UpdateCredentials();
-
-private:
- void UpdateBackendData(std::shared_ptr<Network::Room> room);
- void AnnounceMultiplayerLoop();
-
- Common::Event shutdown_event;
- std::mutex callback_mutex;
- std::set<CallbackHandle> error_callbacks;
- std::unique_ptr<std::thread> announce_multiplayer_thread;
-
- /// Backend interface that logs fields
- std::unique_ptr<AnnounceMultiplayerRoom::Backend> backend;
-
- std::atomic_bool registered = false; ///< Whether the room has been registered
-
- Network::RoomNetwork& room_network;
-};
-
-} // namespace Core
diff --git a/src/core/core.cpp b/src/core/core.cpp
index ea32a4a8d..e651ce100 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -319,10 +319,19 @@ struct System::Impl {
if (app_loader->ReadTitle(name) != Loader::ResultStatus::Success) {
LOG_ERROR(Core, "Failed to read title for ROM (Error {})", load_result);
}
+
+ std::string title_version;
+ const FileSys::PatchManager pm(program_id, system.GetFileSystemController(),
+ system.GetContentProvider());
+ const auto metadata = pm.GetControlMetadata();
+ if (metadata.first != nullptr) {
+ title_version = metadata.first->GetVersionString();
+ }
if (auto room_member = room_network.GetRoomMember().lock()) {
Network::GameInfo game_info;
game_info.name = name;
game_info.id = program_id;
+ game_info.version = title_version;
room_member->SendGameInfo(game_info);
}
diff --git a/src/core/file_sys/system_archive/shared_font.cpp b/src/core/file_sys/system_archive/shared_font.cpp
index f841988ff..3210583f0 100644
--- a/src/core/file_sys/system_archive/shared_font.cpp
+++ b/src/core/file_sys/system_archive/shared_font.cpp
@@ -9,7 +9,7 @@
#include "core/file_sys/system_archive/data/font_standard.h"
#include "core/file_sys/system_archive/shared_font.h"
#include "core/file_sys/vfs_vector.h"
-#include "core/hle/service/ns/pl_u.h"
+#include "core/hle/service/ns/iplatform_service_manager.h"
namespace FileSys::SystemArchive {
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 049602e7d..f9f902c2d 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -101,8 +101,10 @@ void EmulatedController::ReloadFromSettings() {
// Other or debug controller should always be a pro controller
if (npad_id_type != NpadIdType::Other) {
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
+ original_npad_type = npad_type;
} else {
SetNpadStyleIndex(NpadStyleIndex::ProController);
+ original_npad_type = npad_type;
}
if (player.connected) {
@@ -354,6 +356,7 @@ void EmulatedController::DisableConfiguration() {
Disconnect();
}
SetNpadStyleIndex(tmp_npad_type);
+ original_npad_type = tmp_npad_type;
}
// Apply temporary connected status to the real controller
@@ -1004,13 +1007,27 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
if (!is_connected) {
return;
}
+
+ // Attempt to reconnect with the original type
+ if (npad_type != original_npad_type) {
+ Disconnect();
+ const auto current_npad_type = npad_type;
+ SetNpadStyleIndex(original_npad_type);
+ if (IsControllerSupported()) {
+ Connect();
+ return;
+ }
+ SetNpadStyleIndex(current_npad_type);
+ Connect();
+ }
+
if (IsControllerSupported()) {
return;
}
Disconnect();
- // Fallback fullkey controllers to Pro controllers
+ // Fallback Fullkey controllers to Pro controllers
if (IsControllerFullkey() && supported_style_tag.fullkey) {
LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
SetNpadStyleIndex(NpadStyleIndex::ProController);
@@ -1018,6 +1035,22 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
return;
}
+ // Fallback Dual joycon controllers to Pro controllers
+ if (npad_type == NpadStyleIndex::JoyconDual && supported_style_tag.fullkey) {
+ LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
+ SetNpadStyleIndex(NpadStyleIndex::ProController);
+ Connect();
+ return;
+ }
+
+ // Fallback Pro controllers to Dual joycon
+ if (npad_type == NpadStyleIndex::ProController && supported_style_tag.joycon_dual) {
+ LOG_WARNING(Service_HID, "Reconnecting controller type {} as Dual Joycons", npad_type);
+ SetNpadStyleIndex(NpadStyleIndex::JoyconDual);
+ Connect();
+ return;
+ }
+
LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller",
npad_type);
}
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index cbd7c26d3..c3aa8f9d3 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -440,6 +440,7 @@ private:
const NpadIdType npad_id_type;
NpadStyleIndex npad_type{NpadStyleIndex::None};
+ NpadStyleIndex original_npad_type{NpadStyleIndex::None};
NpadStyleTag supported_style_tag{NpadStyleSet::All};
bool is_connected{false};
bool is_configuring{false};
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index def105832..bb838e285 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -534,7 +534,7 @@ public:
private:
void CheckAvailability(Kernel::HLERequestContext& ctx) {
- LOG_WARNING(Service_ACC, "(STUBBED) called");
+ LOG_DEBUG(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(false); // TODO: Check when this is supposed to return true and when not
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 118f226e4..6fb7e198e 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -754,7 +754,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) {
}
void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
+ LOG_DEBUG(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp
index 4b804b78c..14aa6f69e 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.cpp
+++ b/src/core/hle/service/am/applets/applet_web_browser.cpp
@@ -21,7 +21,7 @@
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applets/applet_web_browser.h"
#include "core/hle/service/filesystem/filesystem.h"
-#include "core/hle/service/ns/pl_u.h"
+#include "core/hle/service/ns/iplatform_service_manager.h"
#include "core/loader/loader.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp
index 4e710491b..d6de84066 100644
--- a/src/core/hle/service/apm/apm_controller.cpp
+++ b/src/core/hle/service/apm/apm_controller.cpp
@@ -80,7 +80,7 @@ PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(Performa
}
void Controller::SetClockSpeed(u32 mhz) {
- LOG_INFO(Service_APM, "called, mhz={:08X}", mhz);
+ LOG_DEBUG(Service_APM, "called, mhz={:08X}", mhz);
// TODO(DarkLordZach): Actually signal core_timing to change clock speed.
// TODO(Rodrigo): Remove [[maybe_unused]] when core_timing is used.
}
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 7909141c0..3d3457160 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -819,12 +819,12 @@ void Hid::EnableSixAxisSensorUnalteredPassthrough(Kernel::HLERequestContext& ctx
const auto result = controller.EnableSixAxisSensorUnalteredPassthrough(
parameters.sixaxis_handle, parameters.enabled);
- LOG_WARNING(Service_HID,
- "(STUBBED) called, enabled={}, npad_type={}, npad_id={}, device_index={}, "
- "applet_resource_user_id={}",
- parameters.enabled, parameters.sixaxis_handle.npad_type,
- parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index,
- parameters.applet_resource_user_id);
+ LOG_DEBUG(Service_HID,
+ "(STUBBED) called, enabled={}, npad_type={}, npad_id={}, device_index={}, "
+ "applet_resource_user_id={}",
+ parameters.enabled, parameters.sixaxis_handle.npad_type,
+ parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index,
+ parameters.applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result);
@@ -846,7 +846,7 @@ void Hid::IsSixAxisSensorUnalteredPassthroughEnabled(Kernel::HLERequestContext&
const auto result = controller.IsSixAxisSensorUnalteredPassthroughEnabled(
parameters.sixaxis_handle, is_unaltered_sisxaxis_enabled);
- LOG_WARNING(
+ LOG_DEBUG(
Service_HID,
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
diff --git a/src/core/hle/service/ldn/ldn_types.h b/src/core/hle/service/ldn/ldn_types.h
index 0c07a7397..6231e936d 100644
--- a/src/core/hle/service/ldn/ldn_types.h
+++ b/src/core/hle/service/ldn/ldn_types.h
@@ -113,7 +113,7 @@ enum class LinkLevel : s8 {
Bad,
Low,
Good,
- Excelent,
+ Excellent,
};
struct NodeLatestUpdate {
@@ -145,11 +145,19 @@ struct NetworkId {
static_assert(sizeof(NetworkId) == 0x20, "NetworkId is an invalid size");
struct Ssid {
- u8 length;
- std::array<char, SsidLengthMax + 1> raw;
+ u8 length{};
+ std::array<char, SsidLengthMax + 1> raw{};
+
+ Ssid() = default;
+
+ explicit Ssid(std::string_view data) {
+ length = static_cast<u8>(std::min(data.size(), SsidLengthMax));
+ data.copy(raw.data(), length);
+ raw[length] = 0;
+ }
std::string GetStringValue() const {
- return std::string(raw.data(), length);
+ return std::string(raw.data());
}
};
static_assert(sizeof(Ssid) == 0x22, "Ssid is an invalid size");
diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp
index 5ebb124a7..ba8c0e230 100644
--- a/src/core/hle/service/mm/mm_u.cpp
+++ b/src/core/hle/service/mm/mm_u.cpp
@@ -46,7 +46,7 @@ private:
IPC::RequestParser rp{ctx};
min = rp.Pop<u32>();
max = rp.Pop<u32>();
- LOG_WARNING(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max);
+ LOG_DEBUG(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max);
current = min;
IPC::ResponseBuilder rb{ctx, 2};
@@ -54,7 +54,7 @@ private:
}
void GetOld(Kernel::HLERequestContext& ctx) {
- LOG_WARNING(Service_MM, "(STUBBED) called");
+ LOG_DEBUG(Service_MM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
@@ -81,8 +81,8 @@ private:
u32 input_id = rp.Pop<u32>();
min = rp.Pop<u32>();
max = rp.Pop<u32>();
- LOG_WARNING(Service_MM, "(STUBBED) called, input_id=0x{:X}, min=0x{:X}, max=0x{:X}",
- input_id, min, max);
+ LOG_DEBUG(Service_MM, "(STUBBED) called, input_id=0x{:X}, min=0x{:X}, max=0x{:X}", input_id,
+ min, max);
current = min;
IPC::ResponseBuilder rb{ctx, 2};
@@ -90,7 +90,7 @@ private:
}
void Get(Kernel::HLERequestContext& ctx) {
- LOG_WARNING(Service_MM, "(STUBBED) called");
+ LOG_DEBUG(Service_MM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/iplatform_service_manager.cpp
index cc11f3e08..fd047ff26 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/iplatform_service_manager.cpp
@@ -20,7 +20,7 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_memory.h"
#include "core/hle/service/filesystem/filesystem.h"
-#include "core/hle/service/ns/pl_u.h"
+#include "core/hle/service/ns/iplatform_service_manager.h"
namespace Service::NS {
@@ -99,7 +99,7 @@ static u32 GetU32Swapped(const u8* data) {
return Common::swap32(value);
}
-struct PL_U::Impl {
+struct IPlatformServiceManager::Impl {
const FontRegion& GetSharedFontRegion(std::size_t index) const {
if (index >= shared_font_regions.size() || shared_font_regions.empty()) {
// No font fallback
@@ -134,16 +134,16 @@ struct PL_U::Impl {
std::vector<FontRegion> shared_font_regions;
};
-PL_U::PL_U(Core::System& system_)
- : ServiceFramework{system_, "pl:u"}, impl{std::make_unique<Impl>()} {
+IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const char* service_name_)
+ : ServiceFramework{system_, service_name_}, impl{std::make_unique<Impl>()} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, &PL_U::RequestLoad, "RequestLoad"},
- {1, &PL_U::GetLoadState, "GetLoadState"},
- {2, &PL_U::GetSize, "GetSize"},
- {3, &PL_U::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"},
- {4, &PL_U::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"},
- {5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
+ {0, &IPlatformServiceManager::RequestLoad, "RequestLoad"},
+ {1, &IPlatformServiceManager::GetLoadState, "GetLoadState"},
+ {2, &IPlatformServiceManager::GetSize, "GetSize"},
+ {3, &IPlatformServiceManager::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"},
+ {4, &IPlatformServiceManager::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"},
+ {5, &IPlatformServiceManager::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
{6, nullptr, "GetSharedFontInOrderOfPriorityForSystem"},
{100, nullptr, "RequestApplicationFunctionAuthorization"},
{101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"},
@@ -206,9 +206,9 @@ PL_U::PL_U(Core::System& system_)
}
}
-PL_U::~PL_U() = default;
+IPlatformServiceManager::~IPlatformServiceManager() = default;
-void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) {
+void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u32 shared_font_type{rp.Pop<u32>()};
// Games don't call this so all fonts should be loaded
@@ -218,7 +218,7 @@ void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
-void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) {
+void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u32 font_id{rp.Pop<u32>()};
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
@@ -228,7 +228,7 @@ void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(static_cast<u32>(LoadState::Done));
}
-void PL_U::GetSize(Kernel::HLERequestContext& ctx) {
+void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u32 font_id{rp.Pop<u32>()};
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
@@ -238,7 +238,7 @@ void PL_U::GetSize(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(impl->GetSharedFontRegion(font_id).size);
}
-void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
+void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u32 font_id{rp.Pop<u32>()};
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
@@ -248,7 +248,7 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset);
}
-void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
+void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
// Map backing memory for the font data
LOG_DEBUG(Service_NS, "called");
@@ -261,7 +261,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
rb.PushCopyObjects(&kernel.GetFontSharedMem());
}
-void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
+void IPlatformServiceManager::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for
LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code);
diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/iplatform_service_manager.h
index 07d0ac934..ed6eda89f 100644
--- a/src/core/hle/service/ns/pl_u.h
+++ b/src/core/hle/service/ns/iplatform_service_manager.h
@@ -36,10 +36,10 @@ constexpr std::array<std::pair<FontArchives, const char*>, 7> SHARED_FONTS{
void DecryptSharedFontToTTF(const std::vector<u32>& input, std::vector<u8>& output);
void EncryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, std::size_t& offset);
-class PL_U final : public ServiceFramework<PL_U> {
+class IPlatformServiceManager final : public ServiceFramework<IPlatformServiceManager> {
public:
- explicit PL_U(Core::System& system_);
- ~PL_U() override;
+ explicit IPlatformServiceManager(Core::System& system_, const char* service_name_);
+ ~IPlatformServiceManager() override;
private:
void RequestLoad(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index aafc8fe03..f7318c3cb 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -9,10 +9,10 @@
#include "core/file_sys/vfs.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/ns/errors.h"
+#include "core/hle/service/ns/iplatform_service_manager.h"
#include "core/hle/service/ns/language.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/ns/pdm_qry.h"
-#include "core/hle/service/ns/pl_u.h"
#include "core/hle/service/set/set.h"
namespace Service::NS {
@@ -764,7 +764,8 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager);
- std::make_shared<PL_U>(system)->InstallAsService(service_manager);
+ std::make_shared<IPlatformServiceManager>(system, "pl:s")->InstallAsService(service_manager);
+ std::make_shared<IPlatformServiceManager>(system, "pl:u")->InstallAsService(service_manager);
}
} // namespace Service::NS
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 728bfa00b..d8518149d 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -198,7 +198,7 @@ NvResult nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output)
IocParamParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "(STUBBED) called type={}", params.param);
+ LOG_DEBUG(Service_NVDRV, "(STUBBED) called type={}", params.param);
auto object = GetObject(params.handle);
if (!object) {
@@ -243,7 +243,7 @@ NvResult nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) {
IocFreeParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "(STUBBED) called");
+ LOG_DEBUG(Service_NVDRV, "(STUBBED) called");
auto itr = handles.find(params.handle);
if (itr == handles.end()) {
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index e08c3cb67..cc679cc81 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -933,7 +933,11 @@ BSD::BSD(Core::System& system_, const char* name)
}
}
-BSD::~BSD() = default;
+BSD::~BSD() {
+ if (auto room_member = room_network.GetRoomMember().lock()) {
+ room_member->Unbind(proxy_packet_received);
+ }
+}
BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
// clang-format off
diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp
index 49d067f4c..0c746bd82 100644
--- a/src/core/internal_network/socket_proxy.cpp
+++ b/src/core/internal_network/socket_proxy.cpp
@@ -26,6 +26,12 @@ void ProxySocket::HandleProxyPacket(const ProxyPacket& packet) {
closed) {
return;
}
+
+ if (!broadcast && packet.broadcast) {
+ LOG_INFO(Network, "Received broadcast packet, but not configured for broadcast mode");
+ return;
+ }
+
std::lock_guard guard(packets_mutex);
received_packets.push(packet);
}
@@ -203,7 +209,7 @@ std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& mess
packet.local_endpoint = local_endpoint;
packet.remote_endpoint = *addr;
packet.protocol = protocol;
- packet.broadcast = broadcast;
+ packet.broadcast = broadcast && packet.remote_endpoint.ip[3] == 255;
auto& ip = local_endpoint.ip;
auto ipv4 = Network::GetHostIPv4Address();