mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 06:55:09 +00:00
replace bs_t with rx::EnumBitSet
This commit is contained in:
parent
3f14b99f24
commit
2965aaf3e3
46 changed files with 600 additions and 809 deletions
|
|
@ -124,7 +124,7 @@ enum class lv2_mp_flag {
|
|||
strict_get_block_size,
|
||||
cache,
|
||||
|
||||
__bitset_enum_max
|
||||
bitset_last = cache,
|
||||
};
|
||||
|
||||
enum class lv2_file_type {
|
||||
|
|
@ -140,7 +140,7 @@ struct lv2_fs_mount_point {
|
|||
const u32 sector_size = 512;
|
||||
const u64 sector_count = 256;
|
||||
const u32 block_size = 4096;
|
||||
const bs_t<lv2_mp_flag> flags{};
|
||||
const rx::EnumBitSet<lv2_mp_flag> flags{};
|
||||
lv2_fs_mount_point *const next = nullptr;
|
||||
|
||||
mutable shared_mutex mutex;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/bit_set.h"
|
||||
#include "util/mutex.h"
|
||||
|
||||
#include "Emu/Cell/ErrorCodes.h"
|
||||
#include "Emu/Memory/vm_ptr.h"
|
||||
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
// Error codes
|
||||
enum sys_net_error : s32 {
|
||||
SYS_NET_ENOENT = 2,
|
||||
|
|
@ -54,7 +46,7 @@ enum sys_net_error : s32 {
|
|||
};
|
||||
|
||||
static constexpr sys_net_error operator-(sys_net_error v) {
|
||||
return sys_net_error{-+v};
|
||||
return sys_net_error{-static_cast<s32>(v)};
|
||||
}
|
||||
|
||||
// Socket types (prefixed with SYS_NET_)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#include "Emu/IdManager.h"
|
||||
#include "Emu/NP/ip_address.h"
|
||||
#include "cellos/sys_net.h"
|
||||
#include "rx/EnumBitSet.hpp"
|
||||
#include "util/atomic_bit_set.h"
|
||||
#include "util/mutex.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
@ -32,7 +34,7 @@ public:
|
|||
write,
|
||||
error,
|
||||
|
||||
__bitset_enum_max
|
||||
bitset_last
|
||||
};
|
||||
|
||||
union sockopt_data {
|
||||
|
|
@ -62,10 +64,10 @@ public:
|
|||
std::unique_lock<shared_mutex> lock();
|
||||
|
||||
void set_lv2_id(u32 id);
|
||||
bs_t<poll_t> get_events() const;
|
||||
void set_poll_event(bs_t<poll_t> event);
|
||||
void poll_queue(shared_ptr<ppu_thread> ppu, bs_t<poll_t> event,
|
||||
std::function<bool(bs_t<poll_t>)> poll_cb);
|
||||
rx::EnumBitSet<poll_t> get_events() const;
|
||||
void set_poll_event(rx::EnumBitSet<poll_t> event);
|
||||
void poll_queue(shared_ptr<ppu_thread> ppu, rx::EnumBitSet<poll_t> event,
|
||||
std::function<bool(rx::EnumBitSet<poll_t>)> poll_cb);
|
||||
u32 clear_queue(ppu_thread *);
|
||||
void handle_events(const pollfd &native_fd, bool unset_connecting = false);
|
||||
void queue_wake(ppu_thread *ppu);
|
||||
|
|
@ -110,7 +112,7 @@ public:
|
|||
virtual s32 shutdown(s32 how) = 0;
|
||||
|
||||
virtual s32 poll(sys_net_pollfd &sn_pfd, pollfd &native_pfd) = 0;
|
||||
virtual std::tuple<bool, bool, bool> select(bs_t<poll_t> selected,
|
||||
virtual std::tuple<bool, bool, bool> select(rx::EnumBitSet<poll_t> selected,
|
||||
pollfd &native_pfd) = 0;
|
||||
|
||||
error_code abort_socket(s32 flags);
|
||||
|
|
@ -137,8 +139,8 @@ protected:
|
|||
atomic_bs_t<poll_t> events{};
|
||||
|
||||
// Event processing workload (pair of thread id and the processing function)
|
||||
std::vector<
|
||||
std::pair<shared_ptr<ppu_thread>, std::function<bool(bs_t<poll_t>)>>>
|
||||
std::vector<std::pair<shared_ptr<ppu_thread>,
|
||||
std::function<bool(rx::EnumBitSet<poll_t>)>>>
|
||||
queue;
|
||||
|
||||
// Socket options value keepers
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
bool is_lock = true) override;
|
||||
|
||||
s32 poll(sys_net_pollfd &sn_pfd, pollfd &native_pfd) override;
|
||||
std::tuple<bool, bool, bool> select(bs_t<poll_t> selected,
|
||||
std::tuple<bool, bool, bool> select(rx::EnumBitSet<poll_t> selected,
|
||||
pollfd &native_pfd) override;
|
||||
|
||||
bool is_socket_connected();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "lv2_socket.h"
|
||||
#include <queue>
|
||||
|
||||
class lv2_socket_p2p : public lv2_socket {
|
||||
public:
|
||||
|
|
@ -38,7 +39,7 @@ public:
|
|||
s32 shutdown(s32 how) override;
|
||||
|
||||
s32 poll(sys_net_pollfd &sn_pfd, pollfd &native_pfd) override;
|
||||
std::tuple<bool, bool, bool> select(bs_t<poll_t> selected,
|
||||
std::tuple<bool, bool, bool> select(rx::EnumBitSet<poll_t> selected,
|
||||
pollfd &native_pfd) override;
|
||||
|
||||
void handle_new_data(sys_net_sockaddr_in_p2p p2p_addr,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
#ifdef _WIN32
|
||||
#include <WS2tcpip.h>
|
||||
#include <winsock2.h>
|
||||
|
|
@ -101,7 +102,7 @@ public:
|
|||
s32 shutdown(s32 how) override;
|
||||
|
||||
s32 poll(sys_net_pollfd &sn_pfd, pollfd &native_pfd) override;
|
||||
std::tuple<bool, bool, bool> select(bs_t<poll_t> selected,
|
||||
std::tuple<bool, bool, bool> select(rx::EnumBitSet<poll_t> selected,
|
||||
pollfd &native_pfd) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,6 @@ public:
|
|||
s32 shutdown(s32 how) override;
|
||||
|
||||
s32 poll(sys_net_pollfd &sn_pfd, pollfd &native_pfd) override;
|
||||
std::tuple<bool, bool, bool> select(bs_t<poll_t> selected,
|
||||
std::tuple<bool, bool, bool> select(rx::EnumBitSet<poll_t> selected,
|
||||
pollfd &native_pfd) override;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue