1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
#ifndef _INPUT_H_
#define _INPUT_H_
#define NUMGAMEPADS 2
#define NUMBUTTONS 10
#define TOTALBUTTONS (NUMGAMEPADS*NUMBUTTONS)
#define DEADZONE (32768/3)
#include <SDL.h>
#include "core/api/NstApiInput.hpp"
#include "core/api/NstApiVideo.hpp"
#include "core/api/NstApiNsf.hpp"
using namespace Nes::Api;
typedef struct {
SDL_Scancode qsave1;
SDL_Scancode qsave2;
SDL_Scancode qload1;
SDL_Scancode qload2;
SDL_Scancode screenshot;
SDL_Scancode fdsflip;
SDL_Scancode fdsswitch;
SDL_Scancode insertcoin1;
SDL_Scancode insertcoin2;
SDL_Scancode reset;
SDL_Scancode altspeed;
SDL_Scancode rwstart;
SDL_Scancode rwstop;
SDL_Scancode fullscreen;
SDL_Scancode filter;
SDL_Scancode scalefactor;
} uiinput_t;
typedef struct {
SDL_Scancode u;
SDL_Scancode d;
SDL_Scancode l;
SDL_Scancode r;
SDL_Scancode select;
SDL_Scancode start;
SDL_Scancode a;
SDL_Scancode b;
SDL_Scancode ta;
SDL_Scancode tb;
SDL_Event ju;
SDL_Event jd;
SDL_Event jl;
SDL_Event jr;
SDL_Event jselect;
SDL_Event jstart;
SDL_Event ja;
SDL_Event jb;
SDL_Event jta;
SDL_Event jtb;
} gamepad_t;
typedef struct {
// User Interface
char *qsave1;
char *qsave2;
char *qload1;
char *qload2;
char *screenshot;
char *fdsflip;
char *fdsswitch;
char *insertcoin1;
char *insertcoin2;
char *reset;
char *altspeed;
char *rwstart;
char *rwstop;
char *fullscreen;
char *filter;
char *scalefactor;
// Player 1
char *kb_p1u;
char *kb_p1d;
char *kb_p1l;
char *kb_p1r;
char *kb_p1select;
char *kb_p1start;
char *kb_p1a;
char *kb_p1b;
char *kb_p1ta;
char *kb_p1tb;
char *js_p1u;
char *js_p1d;
char *js_p1l;
char *js_p1r;
char *js_p1select;
char *js_p1start;
char *js_p1a;
char *js_p1b;
char *js_p1ta;
char *js_p1tb;
// Player 2
char *kb_p2u;
char *kb_p2d;
char *kb_p2l;
char *kb_p2r;
char *kb_p2select;
char *kb_p2start;
char *kb_p2a;
char *kb_p2b;
char *kb_p2ta;
char *kb_p2tb;
char *js_p2u;
char *js_p2d;
char *js_p2l;
char *js_p2r;
char *js_p2select;
char *js_p2start;
char *js_p2a;
char *js_p2b;
char *js_p2ta;
char *js_p2tb;
} inputsettings_t;
typedef struct {
unsigned char player;
unsigned char nescode;
unsigned char pressed;
unsigned char turboa;
unsigned char turbob;
} nesinput_t;
typedef struct {
int p1a;
int p1b;
int p2a;
int p2b;
} turbo_t;
void input_init();
void input_joysticks_detect();
void input_joysticks_close();
void input_process(Input::Controllers *controllers, SDL_Event event);
void input_pulse_turbo(Input::Controllers *controllers);
void input_inject(Input::Controllers *controllers, nesinput_t input);
void input_match_joystick(Input::Controllers *controllers, SDL_Event event);
void input_match_keyboard(Input::Controllers *controllers, SDL_Event event);
void input_match_mouse(Input::Controllers *controllers, SDL_Event event);
char* input_translate_event(SDL_Event event);
SDL_Event input_translate_string(char *string);
int input_checksign(int axisvalue);
void input_config_read_new();
void input_config_read();
void input_config_write();
void input_set_default();
static int input_config_match(void* user, const char* section, const char* name, const char* value);
int input_configure_item(int pnum, int bnum, int type);
void input_set_item(SDL_Event event, int type, int pnum, int counter);
#endif
|