mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-24 19:38:32 -06:00
Clean up code using mutable + const when possible
This commit is contained in:
parent
43799762c7
commit
2f3b66985e
@ -884,7 +884,7 @@ static s16 fetch_sdl_as_axis(SDL_Joystick* joystick, const sdl_mapping& mapping)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s16 fetch_sdl_axis_avg(std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
static s16 fetch_sdl_axis_avg(const std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
{
|
||||
constexpr s16 MAX = 0x7FFF;
|
||||
constexpr s16 MIN = -0x8000;
|
||||
@ -910,7 +910,7 @@ static s16 fetch_sdl_axis_avg(std::map<u64, std::vector<SDL_Joystick*>>& joystic
|
||||
return std::clamp<s16>(sdl_joysticks_total_value / static_cast<s32>(joysticks_of_type->second.size()), MIN, MAX);
|
||||
}
|
||||
|
||||
static bool sdl_to_logitech_g27_button(std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
static bool sdl_to_logitech_g27_button(const std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
{
|
||||
auto joysticks_of_type = joysticks.find(mapping.device_type_id);
|
||||
if (joysticks_of_type == joysticks.end())
|
||||
@ -931,21 +931,21 @@ static bool sdl_to_logitech_g27_button(std::map<u64, std::vector<SDL_Joystick*>>
|
||||
return pressed;
|
||||
}
|
||||
|
||||
static u16 sdl_to_logitech_g27_steering(std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
static u16 sdl_to_logitech_g27_steering(const std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
{
|
||||
const s16 avg = fetch_sdl_axis_avg(joysticks, mapping);
|
||||
const u16 unsigned_avg = avg + 0x8000;
|
||||
return unsigned_avg * (0xFFFF >> 2) / 0xFFFF;
|
||||
}
|
||||
|
||||
static u8 sdl_to_logitech_g27_pedal(std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
static u8 sdl_to_logitech_g27_pedal(const std::map<u64, std::vector<SDL_Joystick*>>& joysticks, const sdl_mapping& mapping)
|
||||
{
|
||||
const s16 avg = fetch_sdl_axis_avg(joysticks, mapping);
|
||||
const u16 unsigned_avg = avg + 0x8000;
|
||||
return unsigned_avg * 0xFF / 0xFFFF;
|
||||
}
|
||||
|
||||
void usb_device_logitech_g27::transfer_dfex(u32 buf_size, u8* buf, UsbTransfer* transfer)
|
||||
void usb_device_logitech_g27::transfer_dfex(u32 buf_size, u8* buf, UsbTransfer* transfer) const
|
||||
{
|
||||
DFEX_data data{};
|
||||
ensure(buf_size >= sizeof(data));
|
||||
@ -979,7 +979,7 @@ void usb_device_logitech_g27::transfer_dfex(u32 buf_size, u8* buf, UsbTransfer*
|
||||
std::memcpy(buf, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void usb_device_logitech_g27::transfer_dfp(u32 buf_size, u8* buf, UsbTransfer* transfer)
|
||||
void usb_device_logitech_g27::transfer_dfp(u32 buf_size, u8* buf, UsbTransfer* transfer) const
|
||||
{
|
||||
DFP_data data{};
|
||||
ensure(buf_size >= sizeof(data));
|
||||
@ -1015,7 +1015,7 @@ void usb_device_logitech_g27::transfer_dfp(u32 buf_size, u8* buf, UsbTransfer* t
|
||||
std::memcpy(buf, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void usb_device_logitech_g27::transfer_dfgt(u32 buf_size, u8* buf, UsbTransfer* transfer)
|
||||
void usb_device_logitech_g27::transfer_dfgt(u32 buf_size, u8* buf, UsbTransfer* transfer) const
|
||||
{
|
||||
DFGT_data data{};
|
||||
ensure(buf_size >= sizeof(data));
|
||||
@ -1057,7 +1057,7 @@ void usb_device_logitech_g27::transfer_dfgt(u32 buf_size, u8* buf, UsbTransfer*
|
||||
std::memcpy(buf, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void usb_device_logitech_g27::transfer_g25(u32 buf_size, u8* buf, UsbTransfer* transfer)
|
||||
void usb_device_logitech_g27::transfer_g25(u32 buf_size, u8* buf, UsbTransfer* transfer) const
|
||||
{
|
||||
G25_data data{};
|
||||
ensure(buf_size >= sizeof(data));
|
||||
@ -1105,7 +1105,7 @@ void usb_device_logitech_g27::transfer_g25(u32 buf_size, u8* buf, UsbTransfer* t
|
||||
std::memcpy(buf, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void usb_device_logitech_g27::transfer_g27(u32 buf_size, u8* buf, UsbTransfer* transfer)
|
||||
void usb_device_logitech_g27::transfer_g27(u32 buf_size, u8* buf, UsbTransfer* transfer) const
|
||||
{
|
||||
G27_data data{};
|
||||
ensure(buf_size >= sizeof(data));
|
||||
|
||||
@ -121,11 +121,11 @@ public:
|
||||
private:
|
||||
void sdl_refresh();
|
||||
void set_personality(logitech_personality personality, bool reconnect = false);
|
||||
void transfer_dfex(u32 buf_size, u8* buf, UsbTransfer* transfer);
|
||||
void transfer_dfp(u32 buf_size, u8* buf, UsbTransfer* transfer);
|
||||
void transfer_dfgt(u32 buf_size, u8* buf, UsbTransfer* transfer);
|
||||
void transfer_g25(u32 buf_size, u8* buf, UsbTransfer* transfer);
|
||||
void transfer_g27(u32 buf_size, u8* buf, UsbTransfer* transfer);
|
||||
void transfer_dfex(u32 buf_size, u8* buf, UsbTransfer* transfer) const;
|
||||
void transfer_dfp(u32 buf_size, u8* buf, UsbTransfer* transfer) const;
|
||||
void transfer_dfgt(u32 buf_size, u8* buf, UsbTransfer* transfer) const;
|
||||
void transfer_g25(u32 buf_size, u8* buf, UsbTransfer* transfer) const;
|
||||
void transfer_g27(u32 buf_size, u8* buf, UsbTransfer* transfer) const;
|
||||
|
||||
u32 m_controller_index = 0;
|
||||
|
||||
@ -134,7 +134,7 @@ private:
|
||||
logitech_g27_sdl_mapping m_mapping {};
|
||||
bool m_reverse_effects = false;
|
||||
|
||||
std::mutex m_sdl_handles_mutex;
|
||||
mutable std::mutex m_sdl_handles_mutex;
|
||||
SDL_Joystick* m_led_joystick_handle = nullptr;
|
||||
SDL_Haptic* m_haptic_handle = nullptr;
|
||||
std::map<u64, std::vector<SDL_Joystick*>> m_joysticks;
|
||||
|
||||
@ -125,7 +125,7 @@ namespace np
|
||||
rooms[room_id].opt_param = *sce_opt_param;
|
||||
}
|
||||
|
||||
std::pair<error_code, std::optional<SceNpMatching2RoomSlotInfo>> cache_manager::get_slots(SceNpMatching2RoomId room_id)
|
||||
std::pair<error_code, std::optional<SceNpMatching2RoomSlotInfo>> cache_manager::get_slots(SceNpMatching2RoomId room_id) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
@ -134,7 +134,7 @@ namespace np
|
||||
return {SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND, {}};
|
||||
}
|
||||
|
||||
const auto& room = rooms[room_id];
|
||||
const auto& room = ::at32(rooms, room_id);
|
||||
|
||||
SceNpMatching2RoomSlotInfo slots{};
|
||||
|
||||
@ -166,7 +166,7 @@ namespace np
|
||||
return {CELL_OK, slots};
|
||||
}
|
||||
|
||||
std::pair<error_code, std::vector<SceNpMatching2RoomMemberId>> cache_manager::get_memberids(u64 room_id, s32 sort_method)
|
||||
std::pair<error_code, std::vector<SceNpMatching2RoomMemberId>> cache_manager::get_memberids(u64 room_id, s32 sort_method) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
@ -175,7 +175,7 @@ namespace np
|
||||
return {SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND, {}};
|
||||
}
|
||||
|
||||
const auto& room = rooms[room_id];
|
||||
const auto& room = ::at32(rooms, room_id);
|
||||
|
||||
std::vector<SceNpMatching2RoomMemberId> vec_memberids;
|
||||
|
||||
@ -211,7 +211,7 @@ namespace np
|
||||
return {CELL_OK, vec_memberids};
|
||||
}
|
||||
|
||||
std::pair<error_code, std::optional<SceNpMatching2SessionPassword>> cache_manager::get_password(SceNpMatching2RoomId room_id)
|
||||
std::pair<error_code, std::optional<SceNpMatching2SessionPassword>> cache_manager::get_password(SceNpMatching2RoomId room_id) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
@ -220,15 +220,17 @@ namespace np
|
||||
return {SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND, {}};
|
||||
}
|
||||
|
||||
if (!rooms[room_id].owner)
|
||||
const auto& room = ::at32(rooms, room_id);
|
||||
|
||||
if (!room.owner)
|
||||
{
|
||||
return {SCE_NP_MATCHING2_ERROR_NOT_ALLOWED, {}};
|
||||
}
|
||||
|
||||
return {CELL_OK, rooms[room_id].password};
|
||||
return {CELL_OK, room.password};
|
||||
}
|
||||
|
||||
std::pair<error_code, std::optional<SceNpMatching2SignalingOptParam>> cache_manager::get_opt_param(SceNpMatching2RoomId room_id)
|
||||
std::pair<error_code, std::optional<SceNpMatching2SignalingOptParam>> cache_manager::get_opt_param(SceNpMatching2RoomId room_id) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
@ -237,10 +239,10 @@ namespace np
|
||||
return {SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND, {}};
|
||||
}
|
||||
|
||||
return {CELL_OK, rooms[room_id].opt_param};
|
||||
return {CELL_OK, ::at32(rooms, room_id).opt_param};
|
||||
}
|
||||
|
||||
error_code cache_manager::get_member_and_attrs(SceNpMatching2RoomId room_id, SceNpMatching2RoomMemberId member_id, const std::vector<SceNpMatching2AttributeId>& binattrs_list, SceNpMatching2RoomMemberDataInternal* ptr_member, u32 addr_data, u32 size_data, bool include_onlinename, bool include_avatarurl)
|
||||
error_code cache_manager::get_member_and_attrs(SceNpMatching2RoomId room_id, SceNpMatching2RoomMemberId member_id, const std::vector<SceNpMatching2AttributeId>& binattrs_list, SceNpMatching2RoomMemberDataInternal* ptr_member, u32 addr_data, u32 size_data, bool include_onlinename, bool include_avatarurl) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
@ -249,7 +251,7 @@ namespace np
|
||||
return SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!rooms[room_id].members.contains(member_id))
|
||||
if (!::at32(rooms, room_id).members.contains(member_id))
|
||||
{
|
||||
return SCE_NP_MATCHING2_ERROR_ROOM_MEMBER_NOT_FOUND;
|
||||
}
|
||||
@ -352,7 +354,7 @@ namespace np
|
||||
return not_an_error(needed_data_size);
|
||||
}
|
||||
|
||||
std::pair<error_code, std::optional<SceNpId>> cache_manager::get_npid(u64 room_id, u16 member_id)
|
||||
std::pair<error_code, std::optional<SceNpId>> cache_manager::get_npid(u64 room_id, u16 member_id) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
@ -371,7 +373,7 @@ namespace np
|
||||
return {CELL_OK, ::at32(::at32(rooms, room_id).members, member_id).userInfo.npId};
|
||||
}
|
||||
|
||||
std::optional<u16> cache_manager::get_memberid(u64 room_id, const SceNpId& npid)
|
||||
std::optional<u16> cache_manager::get_memberid(u64 room_id, const SceNpId& npid) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
|
||||
@ -74,16 +74,16 @@ namespace np
|
||||
void update_password(SceNpMatching2RoomId room_id, const std::optional<SceNpMatching2SessionPassword>& password);
|
||||
void update_opt_param(SceNpMatching2RoomId room_id, const SceNpMatching2SignalingOptParam* sce_opt_param);
|
||||
|
||||
std::pair<error_code, std::optional<SceNpMatching2RoomSlotInfo>> get_slots(SceNpMatching2RoomId room_id);
|
||||
std::pair<error_code, std::vector<SceNpMatching2RoomMemberId>> get_memberids(u64 room_id, s32 sort_method);
|
||||
std::pair<error_code, std::optional<SceNpMatching2SessionPassword>> get_password(SceNpMatching2RoomId room_id);
|
||||
std::pair<error_code, std::optional<SceNpMatching2SignalingOptParam>> get_opt_param(SceNpMatching2RoomId room_id);
|
||||
error_code get_member_and_attrs(SceNpMatching2RoomId room_id, SceNpMatching2RoomMemberId member_id, const std::vector<SceNpMatching2AttributeId>& binattrs_list, SceNpMatching2RoomMemberDataInternal* ptr_member, u32 addr_data, u32 size_data, bool include_onlinename, bool include_avatarurl);
|
||||
std::pair<error_code, std::optional<SceNpId>> get_npid(u64 room_id, u16 member_id);
|
||||
std::optional<u16> get_memberid(u64 room_id, const SceNpId& npid);
|
||||
std::pair<error_code, std::optional<SceNpMatching2RoomSlotInfo>> get_slots(SceNpMatching2RoomId room_id) const;
|
||||
std::pair<error_code, std::vector<SceNpMatching2RoomMemberId>> get_memberids(u64 room_id, s32 sort_method) const;
|
||||
std::pair<error_code, std::optional<SceNpMatching2SessionPassword>> get_password(SceNpMatching2RoomId room_id) const;
|
||||
std::pair<error_code, std::optional<SceNpMatching2SignalingOptParam>> get_opt_param(SceNpMatching2RoomId room_id) const;
|
||||
error_code get_member_and_attrs(SceNpMatching2RoomId room_id, SceNpMatching2RoomMemberId member_id, const std::vector<SceNpMatching2AttributeId>& binattrs_list, SceNpMatching2RoomMemberDataInternal* ptr_member, u32 addr_data, u32 size_data, bool include_onlinename, bool include_avatarurl) const;
|
||||
std::pair<error_code, std::optional<SceNpId>> get_npid(u64 room_id, u16 member_id) const;
|
||||
std::optional<u16> get_memberid(u64 room_id, const SceNpId& npid) const;
|
||||
|
||||
private:
|
||||
shared_mutex mutex;
|
||||
mutable shared_mutex mutex;
|
||||
std::map<SceNpMatching2RoomId, room_cache> rooms;
|
||||
};
|
||||
} // namespace np
|
||||
|
||||
@ -25,7 +25,7 @@ generic_async_transaction_context::~generic_async_transaction_context()
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<s32> generic_async_transaction_context::get_transaction_status()
|
||||
std::optional<s32> generic_async_transaction_context::get_transaction_status() const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
return result;
|
||||
|
||||
@ -20,12 +20,12 @@ struct generic_async_transaction_context
|
||||
|
||||
generic_async_transaction_context(const SceNpCommunicationId& communicationId, const SceNpCommunicationPassphrase& passphrase, u64 timeout);
|
||||
|
||||
std::optional<s32> get_transaction_status();
|
||||
std::optional<s32> get_transaction_status() const;
|
||||
void abort_transaction();
|
||||
error_code wait_for_completion();
|
||||
void set_result_and_wake(error_code err);
|
||||
|
||||
shared_mutex mutex;
|
||||
mutable shared_mutex mutex;
|
||||
std::condition_variable_any wake_cond, completion_cond;
|
||||
std::optional<error_code> result;
|
||||
SceNpCommunicationId communicationId;
|
||||
|
||||
@ -63,7 +63,7 @@ namespace np
|
||||
np_gui_cache.error("Cache mismatch: tried to remove a member but it wasn't in the room");
|
||||
}
|
||||
|
||||
error_code gui_cache_manager::get_room_member_list(const SceNpRoomId& room_id, u32 buf_len, vm::ptr<void> data)
|
||||
error_code gui_cache_manager::get_room_member_list(const SceNpRoomId& room_id, u32 buf_len, vm::ptr<void> data) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
|
||||
@ -45,10 +45,10 @@ namespace np
|
||||
void add_member(const SceNpRoomId& room_id, const SceNpMatchingRoomMember* user_info, bool new_member);
|
||||
void del_member(const SceNpRoomId& room_id, const SceNpMatchingRoomMember* user_info);
|
||||
|
||||
error_code get_room_member_list(const SceNpRoomId& room_id, u32 buf_len, vm::ptr<void> data);
|
||||
error_code get_room_member_list(const SceNpRoomId& room_id, u32 buf_len, vm::ptr<void> data) const;
|
||||
|
||||
private:
|
||||
shared_mutex mutex;
|
||||
mutable shared_mutex mutex;
|
||||
std::map<SceNpRoomId, gui_room_cache> rooms;
|
||||
};
|
||||
} // namespace np
|
||||
|
||||
@ -1441,7 +1441,7 @@ namespace np
|
||||
return req_id;
|
||||
}
|
||||
|
||||
u32 np_handler::get_players_history_count(u32 options)
|
||||
u32 np_handler::get_players_history_count(u32 options) const
|
||||
{
|
||||
const bool all_history = (options == SCE_NP_BASIC_PLAYERS_HISTORY_OPTIONS_ALL);
|
||||
|
||||
@ -1459,7 +1459,7 @@ namespace np
|
||||
}));
|
||||
}
|
||||
|
||||
bool np_handler::get_player_history_entry(u32 options, u32 index, SceNpId* npid)
|
||||
bool np_handler::get_player_history_entry(u32 options, u32 index, SceNpId* npid) const
|
||||
{
|
||||
const bool all_history = (options == SCE_NP_BASIC_PLAYERS_HISTORY_OPTIONS_ALL);
|
||||
|
||||
|
||||
@ -261,8 +261,8 @@ namespace np
|
||||
ticket get_clan_ticket() const;
|
||||
void add_player_to_history(const SceNpId* npid, const char* description);
|
||||
u32 add_players_to_history(const SceNpId* npids, const char* description, u32 count);
|
||||
u32 get_players_history_count(u32 options);
|
||||
bool get_player_history_entry(u32 options, u32 index, SceNpId* npid);
|
||||
u32 get_players_history_count(u32 options) const;
|
||||
bool get_player_history_entry(u32 options, u32 index, SceNpId* npid) const;
|
||||
SceNpMatching2MemoryInfo get_memory_info() const;
|
||||
error_code abort_request(u32 req_id);
|
||||
|
||||
@ -518,7 +518,7 @@ namespace np
|
||||
player_history& get_player_and_set_timestamp(const SceNpId& npid, u64 timestamp);
|
||||
void save_players_history();
|
||||
|
||||
shared_mutex mutex_history;
|
||||
mutable shared_mutex mutex_history;
|
||||
std::map<std::string, player_history> players_history; // npid / history
|
||||
|
||||
struct
|
||||
|
||||
@ -3180,7 +3180,7 @@ namespace rpcn
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<shared_ptr<std::pair<std::string, message_data>>> rpcn_client::get_message(u64 id)
|
||||
std::optional<shared_ptr<std::pair<std::string, message_data>>> rpcn_client::get_message(u64 id) const
|
||||
{
|
||||
{
|
||||
std::lock_guard lock(mutex_messages);
|
||||
@ -3238,21 +3238,21 @@ namespace rpcn
|
||||
active_messages.erase(id);
|
||||
}
|
||||
|
||||
u32 rpcn_client::get_num_friends()
|
||||
u32 rpcn_client::get_num_friends() const
|
||||
{
|
||||
std::lock_guard lock(mutex_friends);
|
||||
|
||||
return ::size32(friend_infos.friends);
|
||||
}
|
||||
|
||||
u32 rpcn_client::get_num_blocks()
|
||||
u32 rpcn_client::get_num_blocks() const
|
||||
{
|
||||
std::lock_guard lock(mutex_friends);
|
||||
|
||||
return ::size32(friend_infos.blocked);
|
||||
}
|
||||
|
||||
std::optional<std::string> rpcn_client::get_friend_by_index(u32 index)
|
||||
std::optional<std::string> rpcn_client::get_friend_by_index(u32 index) const
|
||||
{
|
||||
std::lock_guard lock(mutex_friends);
|
||||
|
||||
@ -3270,7 +3270,7 @@ namespace rpcn
|
||||
return it->first;
|
||||
}
|
||||
|
||||
std::optional<std::pair<std::string, friend_online_data>> rpcn_client::get_friend_presence_by_index(u32 index)
|
||||
std::optional<std::pair<std::string, friend_online_data>> rpcn_client::get_friend_presence_by_index(u32 index) const
|
||||
{
|
||||
std::lock_guard lock(mutex_friends);
|
||||
|
||||
@ -3284,7 +3284,7 @@ namespace rpcn
|
||||
return std::optional(*it);
|
||||
}
|
||||
|
||||
std::optional<std::pair<std::string, friend_online_data>> rpcn_client::get_friend_presence_by_npid(const std::string& npid)
|
||||
std::optional<std::pair<std::string, friend_online_data>> rpcn_client::get_friend_presence_by_npid(const std::string& npid) const
|
||||
{
|
||||
std::lock_guard lock(mutex_friends);
|
||||
const auto it = friend_infos.friends.find(npid);
|
||||
|
||||
@ -242,7 +242,7 @@ namespace rpcn
|
||||
std::mutex mutex_packets_to_send;
|
||||
|
||||
// Friends related
|
||||
shared_mutex mutex_friends;
|
||||
mutable shared_mutex mutex_friends;
|
||||
std::set<std::pair<friend_cb_func, void*>> friend_cbs;
|
||||
friend_data friend_infos;
|
||||
|
||||
@ -304,11 +304,11 @@ namespace rpcn
|
||||
std::optional<ErrorType> add_friend(const std::string& friend_username);
|
||||
bool remove_friend(const std::string& friend_username);
|
||||
|
||||
u32 get_num_friends();
|
||||
u32 get_num_blocks();
|
||||
std::optional<std::string> get_friend_by_index(u32 index);
|
||||
std::optional<std::pair<std::string, friend_online_data>> get_friend_presence_by_index(u32 index);
|
||||
std::optional<std::pair<std::string, friend_online_data>> get_friend_presence_by_npid(const std::string& npid);
|
||||
u32 get_num_friends() const;
|
||||
u32 get_num_blocks() const;
|
||||
std::optional<std::string> get_friend_by_index(u32 index) const;
|
||||
std::optional<std::pair<std::string, friend_online_data>> get_friend_presence_by_index(u32 index) const;
|
||||
std::optional<std::pair<std::string, friend_online_data>> get_friend_presence_by_npid(const std::string& npid) const;
|
||||
|
||||
std::vector<std::pair<rpcn::NotificationType, std::vector<u8>>> get_notifications();
|
||||
std::map<u32, std::pair<rpcn::CommandType, std::vector<u8>>> get_replies();
|
||||
@ -316,7 +316,7 @@ namespace rpcn
|
||||
std::map<std::string, friend_online_data> get_presence_states();
|
||||
|
||||
std::vector<u64> get_new_messages();
|
||||
std::optional<shared_ptr<std::pair<std::string, message_data>>> get_message(u64 id);
|
||||
std::optional<shared_ptr<std::pair<std::string, message_data>>> get_message(u64 id) const;
|
||||
std::vector<std::pair<u64, shared_ptr<std::pair<std::string, message_data>>>> get_messages_and_register_cb(SceNpBasicMessageMainType type, bool include_bootable, message_cb_func cb_func, void* cb_param);
|
||||
void remove_message_cb(message_cb_func cb_func, void* cb_param);
|
||||
void mark_message_used(u64 id);
|
||||
@ -445,7 +445,7 @@ namespace rpcn
|
||||
return (void_cb_func < void_other_cb_func) || ((!(void_other_cb_func < void_cb_func)) && (cb_param < other.cb_param));
|
||||
}
|
||||
};
|
||||
shared_mutex mutex_messages;
|
||||
mutable shared_mutex mutex_messages;
|
||||
std::set<message_cb_t> message_cbs;
|
||||
std::unordered_map<u64, shared_ptr<std::pair<std::string, message_data>>> messages; // msg id / (sender / message)
|
||||
std::set<u64> active_messages; // msg id of messages that have not been discarded
|
||||
|
||||
@ -832,7 +832,7 @@ u32 signaling_handler::init_sig2(const SceNpId& npid, u64 room_id, u16 member_id
|
||||
return conn_id;
|
||||
}
|
||||
|
||||
std::optional<u32> signaling_handler::get_conn_id_from_npid(const SceNpId& npid)
|
||||
std::optional<u32> signaling_handler::get_conn_id_from_npid(const SceNpId& npid) const
|
||||
{
|
||||
std::lock_guard lock(data_mutex);
|
||||
|
||||
@ -843,7 +843,7 @@ std::optional<u32> signaling_handler::get_conn_id_from_npid(const SceNpId& npid)
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<signaling_info> signaling_handler::get_sig_infos(u32 conn_id)
|
||||
std::optional<signaling_info> signaling_handler::get_sig_infos(u32 conn_id) const
|
||||
{
|
||||
std::lock_guard lock(data_mutex);
|
||||
if (sig_peers.contains(conn_id))
|
||||
@ -852,7 +852,7 @@ std::optional<signaling_info> signaling_handler::get_sig_infos(u32 conn_id)
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<u32> signaling_handler::get_conn_id_from_addr(u32 addr, u16 port)
|
||||
std::optional<u32> signaling_handler::get_conn_id_from_addr(u32 addr, u16 port) const
|
||||
{
|
||||
std::lock_guard lock(data_mutex);
|
||||
|
||||
|
||||
@ -63,9 +63,9 @@ public:
|
||||
|
||||
u32 init_sig1(const SceNpId& npid);
|
||||
u32 init_sig2(const SceNpId& npid, u64 room_id, u16 member_id);
|
||||
std::optional<signaling_info> get_sig_infos(u32 conn_id);
|
||||
std::optional<u32> get_conn_id_from_npid(const SceNpId& npid);
|
||||
std::optional<u32> get_conn_id_from_addr(u32 addr, u16 port);
|
||||
std::optional<signaling_info> get_sig_infos(u32 conn_id) const;
|
||||
std::optional<u32> get_conn_id_from_npid(const SceNpId& npid) const;
|
||||
std::optional<u32> get_conn_id_from_addr(u32 addr, u16 port) const;
|
||||
|
||||
void add_sig_ctx(u32 ctx_id);
|
||||
void remove_sig_ctx(u32 ctx_id);
|
||||
@ -128,7 +128,7 @@ private:
|
||||
void retire_all_packets(std::shared_ptr<signaling_info>& si);
|
||||
void stop_sig_nl(u32 conn_id, bool forceful);
|
||||
|
||||
shared_mutex data_mutex;
|
||||
mutable shared_mutex data_mutex;
|
||||
atomic_t<u32> wakey = 0;
|
||||
|
||||
signaling_packet sig_packet{};
|
||||
|
||||
@ -68,7 +68,7 @@ namespace rsx
|
||||
m_list_mutex.unlock_shared();
|
||||
}
|
||||
|
||||
std::shared_ptr<overlay> display_manager::get(u32 uid)
|
||||
std::shared_ptr<overlay> display_manager::get(u32 uid) const
|
||||
{
|
||||
reader_lock lock(m_list_mutex);
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ namespace rsx
|
||||
std::vector<std::shared_ptr<overlay>> m_iface_list;
|
||||
std::vector<std::shared_ptr<overlay>> m_dirty_list;
|
||||
|
||||
shared_mutex m_list_mutex;
|
||||
mutable shared_mutex m_list_mutex;
|
||||
lf_queue<u32> m_uids_to_remove;
|
||||
lf_queue<u32> m_type_ids_to_remove;
|
||||
atomic_t<u32> m_pending_removals_count = 0;
|
||||
@ -130,11 +130,11 @@ namespace rsx
|
||||
void dispose(const std::vector<u32>& uids);
|
||||
|
||||
// Returns pointer to the object matching the given uid
|
||||
std::shared_ptr<overlay> get(u32 uid);
|
||||
std::shared_ptr<overlay> get(u32 uid) const;
|
||||
|
||||
// Returns pointer to the first object matching the given type
|
||||
template <typename T>
|
||||
std::shared_ptr<T> get()
|
||||
std::shared_ptr<T> get() const
|
||||
{
|
||||
reader_lock lock(m_list_mutex);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user