2010-09-25 17:46:12 +02:00
|
|
|
#ifndef __GTK_CONTROL_H
|
|
|
|
#define __GTK_CONTROL_H
|
|
|
|
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
#include "gtk_binding.h"
|
|
|
|
#ifdef USE_JOYSTICK
|
|
|
|
#include "SDL.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NUM_JOYPADS
|
|
|
|
#define NUM_JOYPADS 10
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define JOY_MODE_GLOBAL 0
|
|
|
|
#define JOY_MODE_INDIVIDUAL 1
|
|
|
|
#define JOY_MODE_CALIBRATE 2
|
|
|
|
|
|
|
|
#define JOY_RELEASED 0
|
|
|
|
#define JOY_PRESSED 1
|
|
|
|
|
|
|
|
#define PORT_COMMAND_FULLSCREEN 1
|
|
|
|
#define PORT_COMMAND_SAVE_SPC 2
|
|
|
|
#define PORT_OPEN_ROM 3
|
|
|
|
#define PORT_PAUSE 4
|
|
|
|
#define PORT_SEEK_TO_FRAME 5
|
|
|
|
#define PORT_QUIT 6
|
|
|
|
#define PORT_SWAP_CONTROLLERS 7
|
2014-06-27 10:36:36 +02:00
|
|
|
#define PORT_REWIND 8
|
2018-06-21 21:23:43 +02:00
|
|
|
#define PORT_QUICKLOAD0 9
|
|
|
|
#define PORT_QUICKLOAD1 10
|
|
|
|
#define PORT_QUICKLOAD2 11
|
|
|
|
#define PORT_QUICKLOAD3 12
|
|
|
|
#define PORT_QUICKLOAD4 13
|
|
|
|
#define PORT_QUICKLOAD5 14
|
|
|
|
#define PORT_QUICKLOAD6 15
|
|
|
|
#define PORT_QUICKLOAD7 16
|
|
|
|
#define PORT_QUICKLOAD8 17
|
|
|
|
#define PORT_QUICKLOAD9 18
|
2010-09-25 17:46:12 +02:00
|
|
|
|
|
|
|
typedef struct BindingLink
|
|
|
|
{
|
|
|
|
const char *button_name;
|
|
|
|
const char *snes9x_name;
|
|
|
|
|
|
|
|
} BindingLink;
|
|
|
|
|
|
|
|
extern const BindingLink b_links[];
|
|
|
|
extern const int b_breaks[];
|
|
|
|
#define NUM_JOYPAD_LINKS 24
|
2017-04-25 21:45:30 +02:00
|
|
|
#define NUM_EMU_LINKS 55
|
2010-09-25 17:46:12 +02:00
|
|
|
|
|
|
|
typedef struct JoypadBinding
|
|
|
|
{
|
|
|
|
Binding data[NUM_JOYPAD_LINKS]; /* Avoid packing issues */
|
|
|
|
} JoypadBinding;
|
|
|
|
|
|
|
|
#ifdef USE_JOYSTICK
|
|
|
|
|
|
|
|
bool S9xGrabJoysticks (void);
|
|
|
|
void S9xReleaseJoysticks (void);
|
|
|
|
|
|
|
|
typedef struct JoyEvent
|
|
|
|
{
|
|
|
|
unsigned int parameter;
|
|
|
|
unsigned int state;
|
|
|
|
|
|
|
|
} JoyEvent;
|
|
|
|
|
|
|
|
typedef struct Calibration
|
|
|
|
{
|
|
|
|
int min;
|
|
|
|
int max;
|
|
|
|
int center;
|
|
|
|
} Calibration;
|
|
|
|
|
|
|
|
class JoyDevice
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
JoyDevice (unsigned int device_num);
|
|
|
|
~JoyDevice (void);
|
|
|
|
int get_event (JoyEvent *event);
|
|
|
|
void flush (void);
|
|
|
|
void handle_event (SDL_Event *event);
|
|
|
|
void register_centers (void);
|
|
|
|
|
|
|
|
SDL_Joystick *filedes;
|
|
|
|
Calibration *calibration;
|
|
|
|
std::queue<JoyEvent> queue;
|
|
|
|
int mode;
|
|
|
|
int joynum;
|
|
|
|
int num_axes;
|
|
|
|
int num_hats;
|
|
|
|
int *axis;
|
|
|
|
int *hat;
|
|
|
|
bool enabled;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
void poll_events (void);
|
2014-02-05 10:22:07 +01:00
|
|
|
void add_event (unsigned int parameter, unsigned int state);
|
2010-09-25 17:46:12 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void S9xDeinitInputDevices (void);
|
|
|
|
Binding S9xGetBindingByName (const char *name);
|
2010-09-26 11:19:15 +02:00
|
|
|
bool S9xIsMousePluggedIn (void);
|
2010-09-25 17:46:12 +02:00
|
|
|
|
|
|
|
#endif /* __GTK_CONTROL_H*/
|