mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-07 23:45:12 +00:00
split rpcs3 and hle libraries
merge rpcs3 utilities
This commit is contained in:
parent
b33e2662b6
commit
62ad27d1e2
1233 changed files with 7004 additions and 3819 deletions
63
rpcs3/Input/evdev_gun_handler.h
Normal file
63
rpcs3/Input/evdev_gun_handler.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#pragma once
|
||||
#ifdef HAVE_LIBEVDEV
|
||||
|
||||
#include <map>
|
||||
#include "util/mutex.h"
|
||||
|
||||
enum class gun_button
|
||||
{
|
||||
btn_left,
|
||||
btn_right,
|
||||
btn_middle,
|
||||
btn_1,
|
||||
btn_2,
|
||||
btn_3,
|
||||
btn_4,
|
||||
btn_5,
|
||||
btn_6,
|
||||
btn_7,
|
||||
btn_8
|
||||
};
|
||||
|
||||
class evdev_gun_handler
|
||||
{
|
||||
public:
|
||||
evdev_gun_handler();
|
||||
~evdev_gun_handler();
|
||||
|
||||
bool init();
|
||||
|
||||
bool is_init() const;
|
||||
u32 get_num_guns() const;
|
||||
int get_button(u32 gunno, gun_button button) const;
|
||||
int get_axis_x(u32 gunno) const;
|
||||
int get_axis_y(u32 gunno) const;
|
||||
int get_axis_x_max(u32 gunno) const;
|
||||
int get_axis_y_max(u32 gunno) const;
|
||||
|
||||
void poll(u32 index);
|
||||
|
||||
shared_mutex mutex;
|
||||
|
||||
private:
|
||||
atomic_t<bool> m_is_init{false};
|
||||
struct udev* m_udev = nullptr;
|
||||
|
||||
struct evdev_axis
|
||||
{
|
||||
int value = 0;
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
};
|
||||
|
||||
struct evdev_gun
|
||||
{
|
||||
struct libevdev* device = nullptr;
|
||||
std::map<int, int> buttons;
|
||||
std::map<int, evdev_axis> axis;
|
||||
};
|
||||
|
||||
std::vector<evdev_gun> m_devices;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue