Auto formated using vs code to fix tab vs spaces indentation issues.
This commit is contained in:
parent
d6769d052c
commit
55bf88547c
|
@ -52,7 +52,6 @@ int NoWaiting = 0;
|
|||
extern Config *g_config;
|
||||
extern bool bindSavestate, frameAdvanceLagSkip, lagCounterDisplay;
|
||||
|
||||
|
||||
/* UsrInputType[] is user-specified. CurInputType[] is current
|
||||
(game loading can override user settings)
|
||||
*/
|
||||
|
@ -69,8 +68,7 @@ std::list <gamepad_function_key_t*> gpKeySeqList;
|
|||
/**
|
||||
* Necessary for proper GUI functioning (configuring when a game isn't loaded).
|
||||
*/
|
||||
void
|
||||
InputUserActiveFix ()
|
||||
void InputUserActiveFix()
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < 3; x++)
|
||||
|
@ -82,8 +80,7 @@ InputUserActiveFix ()
|
|||
/**
|
||||
* Parse game information and configure the input devices accordingly.
|
||||
*/
|
||||
void
|
||||
ParseGIInput (FCEUGI * gi)
|
||||
void ParseGIInput(FCEUGI *gi)
|
||||
{
|
||||
gametype = gi->type;
|
||||
|
||||
|
@ -122,7 +119,6 @@ int getInputSelection( int port, int *cur, int *usr )
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint8 QuizKingData = 0;
|
||||
static uint8 HyperShotData = 0;
|
||||
static uint32 MahjongData = 0;
|
||||
|
@ -202,7 +198,9 @@ class hotkey_t Hotkeys[HK_MAX];
|
|||
|
||||
hotkey_t::hotkey_t(void)
|
||||
{
|
||||
sdl.value = 0; sdl.modifier = 0; prevState = 0;
|
||||
sdl.value = 0;
|
||||
sdl.modifier = 0;
|
||||
prevState = 0;
|
||||
shortcut = nullptr;
|
||||
act = nullptr;
|
||||
configName = "";
|
||||
|
@ -252,7 +250,8 @@ int hotkey_t::readConfig(void)
|
|||
|
||||
void hotkey_t::conv2SDL(void)
|
||||
{
|
||||
if ( shortcut == nullptr ) return;
|
||||
if (shortcut == nullptr)
|
||||
return;
|
||||
|
||||
SDL_Keycode k = convQtKey2SDLKeyCode((Qt::Key)(shortcut->key()[0] & 0x01FFFFFF));
|
||||
SDL_Keymod m = convQtKey2SDLModifier((Qt::KeyboardModifier)(shortcut->key()[0] & 0xFE000000));
|
||||
|
@ -289,7 +288,6 @@ const char *hotkey_t::getConfigName(void)
|
|||
return configName;
|
||||
}
|
||||
|
||||
|
||||
int hotkey_t::getString(char *s)
|
||||
{
|
||||
s[0] = 0;
|
||||
|
@ -394,7 +392,8 @@ void hotkey_t::setModifierFromString( const char *s )
|
|||
int i, j;
|
||||
char id[128];
|
||||
|
||||
i=0; j=0;
|
||||
i = 0;
|
||||
j = 0;
|
||||
sdl.modifier = 0;
|
||||
|
||||
while (s[i] != 0)
|
||||
|
@ -402,11 +401,14 @@ void hotkey_t::setModifierFromString( const char *s )
|
|||
j = 0;
|
||||
while (isalnum(s[i]) || (s[i] == '_'))
|
||||
{
|
||||
id[j] = tolower(s[i]); j++; i++;
|
||||
id[j] = tolower(s[i]);
|
||||
j++;
|
||||
i++;
|
||||
}
|
||||
id[j] = 0;
|
||||
|
||||
if ( j == 0 ) break;
|
||||
if (j == 0)
|
||||
break;
|
||||
|
||||
if (strcmp(id, "ctrl") == 0)
|
||||
{
|
||||
|
@ -433,8 +435,7 @@ void hotkey_t::setModifierFromString( const char *s )
|
|||
}
|
||||
|
||||
// on every cycle of keyboardinput()
|
||||
void
|
||||
setHotKeys (void)
|
||||
void setHotKeys(void)
|
||||
{
|
||||
for (int i = 0; i < HK_MAX; i++)
|
||||
{
|
||||
|
@ -459,7 +460,6 @@ gamepad_function_key_t::gamepad_function_key_t(void)
|
|||
|
||||
gamepad_function_key_t::~gamepad_function_key_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void gamepad_function_key_t::sendKeyPressEvent(int idx)
|
||||
|
@ -517,15 +517,13 @@ void gamepad_function_key_t::updateStatus(void)
|
|||
sendKeyReleaseEvent(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* This function is a wrapper for FCEUI_ToggleEmulationPause that handles
|
||||
* releasing/capturing mouse pointer during pause toggles
|
||||
* */
|
||||
void
|
||||
TogglePause (void)
|
||||
void TogglePause(void)
|
||||
{
|
||||
FCEUI_ToggleEmulationPause();
|
||||
|
||||
|
@ -617,7 +615,6 @@ std::string GetUserText (const char *title)
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lets the user start a new .fm2 movie file
|
||||
**/
|
||||
|
@ -631,7 +628,6 @@ void FCEUD_MovieRecordTo (void)
|
|||
FCEUI_SaveMovie(fname.c_str(), MOVIE_FLAG_FROM_POWERON, author);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lets the user save a savestate to a specific file
|
||||
**/
|
||||
|
@ -693,7 +689,6 @@ static void FKB_CheckShortcutConflicts(void)
|
|||
shortcut->setEnabled(!fkbActv);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void toggleFamilyKeyboardFunc(void)
|
||||
|
@ -752,7 +747,6 @@ static void KeyboardCommands (void)
|
|||
// is_alt = 0;
|
||||
//}
|
||||
|
||||
|
||||
//if ( Hotkeys[HK_TOGGLE_BG].getRisingEdge() )
|
||||
//{
|
||||
// bool fgOn, bgOn;
|
||||
|
@ -895,7 +889,6 @@ static void KeyboardCommands (void)
|
|||
// }
|
||||
// }
|
||||
|
||||
|
||||
//if ( Hotkeys[HK_DECREASE_SPEED].getRisingEdge() )
|
||||
//{
|
||||
// DecreaseEmulationSpeed();
|
||||
|
@ -1285,7 +1278,6 @@ UpdatePhysicalInput ()
|
|||
//SDL_PumpEvents();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Begin configuring the buttons by placing the video and joystick
|
||||
* subsystems into a well-known state. Button configuration really
|
||||
|
@ -1306,8 +1298,7 @@ int ButtonConfigBegin ()
|
|||
* subsystems to their previous state. Button configuration really
|
||||
* needs to be cleaned up after the new config system is in place.
|
||||
*/
|
||||
void
|
||||
ButtonConfigEnd ()
|
||||
void ButtonConfigEnd()
|
||||
{
|
||||
buttonConfigInProgress = 0;
|
||||
}
|
||||
|
@ -1341,11 +1332,19 @@ DTestButton (ButtConfig * bc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define MK(x) {BUTTC_KEYBOARD,0,(x),0}
|
||||
#define MK(x) \
|
||||
{ \
|
||||
BUTTC_KEYBOARD, 0, (x), 0 \
|
||||
}
|
||||
//#define MK2(x1,x2) {BUTTC_KEYBOARD,0,MKK(x1)}
|
||||
#define MKZ() {0,0,-1,0}
|
||||
#define GPZ() {MKZ(), MKZ(), MKZ(), MKZ()}
|
||||
#define MKZ() \
|
||||
{ \
|
||||
0, 0, -1, 0 \
|
||||
}
|
||||
#define GPZ() \
|
||||
{ \
|
||||
MKZ(), MKZ(), MKZ(), MKZ() \
|
||||
}
|
||||
|
||||
//ButtConfig GamePadConfig[ GAMEPAD_NUM_DEVICES ][ GAMEPAD_NUM_BUTTONS ] =
|
||||
//{
|
||||
|
@ -1397,16 +1396,20 @@ UpdateGamepad(void)
|
|||
if (opposite_dirs == 0)
|
||||
{
|
||||
// test for left+right and up+down
|
||||
if(x == 4){
|
||||
if (x == 4)
|
||||
{
|
||||
up = true;
|
||||
}
|
||||
if((x == 5) && (up == true)){
|
||||
if ((x == 5) && (up == true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(x == 6){
|
||||
if (x == 6)
|
||||
{
|
||||
left = true;
|
||||
}
|
||||
if((x == 7) && (left == true)){
|
||||
if ((x == 7) && (left == true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1417,14 +1420,14 @@ UpdateGamepad(void)
|
|||
int four_button_exit;
|
||||
g_config->getOption("SDL.ABStartSelectExit", &four_button_exit);
|
||||
// if a+b+start+select is pressed, exit
|
||||
if (four_button_exit && JS == 15) {
|
||||
if (four_button_exit && JS == 15)
|
||||
{
|
||||
FCEUI_printf("all buttons pressed, exiting\n");
|
||||
CloseGame();
|
||||
FCEUI_Kill();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
// rapid-fire a, rapid-fire b
|
||||
for (x = 0; x < 2; x++)
|
||||
{
|
||||
|
@ -1451,17 +1454,14 @@ UpdateGamepad(void)
|
|||
}
|
||||
|
||||
static ButtConfig powerpadsc[2][12] = {
|
||||
{
|
||||
MK (SDLK_O), MK (SDLK_P), MK (SDLK_BRACKET_LEFT),
|
||||
{MK(SDLK_O), MK(SDLK_P), MK(SDLK_BRACKET_LEFT),
|
||||
MK(SDLK_BRACKET_RIGHT), MK(SDLK_K), MK(SDLK_L), MK(SDLK_SEMICOLON),
|
||||
MK(SDLK_APOSTROPHE),
|
||||
MK(SDLK_M), MK(SDLK_COMMA), MK(SDLK_PERIOD), MK(SDLK_SLASH)},
|
||||
{
|
||||
MK (SDLK_O), MK (SDLK_P), MK (SDLK_BRACKET_LEFT),
|
||||
{MK(SDLK_O), MK(SDLK_P), MK(SDLK_BRACKET_LEFT),
|
||||
MK(SDLK_BRACKET_RIGHT), MK(SDLK_K), MK(SDLK_L), MK(SDLK_SEMICOLON),
|
||||
MK(SDLK_APOSTROPHE),
|
||||
MK (SDLK_M), MK (SDLK_COMMA), MK (SDLK_PERIOD), MK (SDLK_SLASH)}
|
||||
};
|
||||
MK(SDLK_M), MK(SDLK_COMMA), MK(SDLK_PERIOD), MK(SDLK_SLASH)}};
|
||||
|
||||
static uint32 powerpadbuf[2] = {0, 0};
|
||||
|
||||
|
@ -1742,8 +1742,7 @@ static ButtConfig fkbmap[0x48] = {
|
|||
MK(SDLK_PERIOD), MK(SDLK_SLASH), MK(SDLK_RIGHTALT), MK(SDLK_RIGHTSHIFT), MK(SDLK_LEFTALT),
|
||||
MK(SDLK_SPACE),
|
||||
MK(SDLK_DELETE), MK(SDLK_END), MK(SDLK_PAGEDOWN),
|
||||
MK (SDLK_CURSORUP), MK (SDLK_CURSORLEFT), MK (SDLK_CURSORRIGHT), MK (SDLK_CURSORDOWN)
|
||||
};
|
||||
MK(SDLK_CURSORUP), MK(SDLK_CURSORLEFT), MK(SDLK_CURSORRIGHT), MK(SDLK_CURSORDOWN)};
|
||||
|
||||
/**
|
||||
* Update the status of the Family KeyBoard.
|
||||
|
@ -1764,8 +1763,7 @@ static void UpdateFKB ()
|
|||
}
|
||||
|
||||
static ButtConfig HyperShotButtons[4] = {
|
||||
MK (SDLK_Q), MK (SDLK_W), MK (SDLK_E), MK (SDLK_R)
|
||||
};
|
||||
MK(SDLK_Q), MK(SDLK_W), MK(SDLK_E), MK(SDLK_R)};
|
||||
|
||||
/**
|
||||
* Update the status of the HyperShot input device.
|
||||
|
@ -1788,8 +1786,7 @@ UpdateHyperShot ()
|
|||
static ButtConfig MahjongButtons[21] = {
|
||||
MK(SDLK_Q), MK(SDLK_W), MK(SDLK_E), MK(SDLK_R), MK(SDLK_T),
|
||||
MK(SDLK_A), MK(SDLK_S), MK(SDLK_D), MK(SDLK_F), MK(SDLK_G), MK(SDLK_H), MK(SDLK_J), MK(SDLK_K), MK(SDLK_L),
|
||||
MK (SDLK_Z), MK (SDLK_X), MK (SDLK_C), MK (SDLK_V), MK (SDLK_B), MK (SDLK_N), MK (SDLK_M)
|
||||
};
|
||||
MK(SDLK_Z), MK(SDLK_X), MK(SDLK_C), MK(SDLK_V), MK(SDLK_B), MK(SDLK_N), MK(SDLK_M)};
|
||||
|
||||
/**
|
||||
* Update the status of for the Mahjong input device.
|
||||
|
@ -1810,8 +1807,7 @@ UpdateMahjong ()
|
|||
}
|
||||
|
||||
static ButtConfig QuizKingButtons[6] = {
|
||||
MK (SDLK_Q), MK (SDLK_W), MK (SDLK_E), MK (SDLK_R), MK (SDLK_T), MK (SDLK_Y)
|
||||
};
|
||||
MK(SDLK_Q), MK(SDLK_W), MK(SDLK_E), MK(SDLK_R), MK(SDLK_T), MK(SDLK_Y)};
|
||||
|
||||
/**
|
||||
* Update the status of the QuizKing input device.
|
||||
|
@ -1833,8 +1829,7 @@ UpdateQuizKing ()
|
|||
}
|
||||
|
||||
static ButtConfig TopRiderButtons[8] = {
|
||||
MK (SDLK_Q), MK (SDLK_W), MK (SDLK_E), MK (SDLK_R), MK (SDLK_T), MK (SDLK_Y), MK (SDLK_U), MK (SDLK_I)
|
||||
};
|
||||
MK(SDLK_Q), MK(SDLK_W), MK(SDLK_E), MK(SDLK_R), MK(SDLK_T), MK(SDLK_Y), MK(SDLK_U), MK(SDLK_I)};
|
||||
|
||||
/**
|
||||
* Update the status of the TopRider input device.
|
||||
|
@ -1857,8 +1852,7 @@ static ButtConfig FTrainerButtons[12] = {
|
|||
MK(SDLK_O), MK(SDLK_P), MK(SDLK_BRACKET_LEFT),
|
||||
MK(SDLK_BRACKET_RIGHT), MK(SDLK_K), MK(SDLK_L), MK(SDLK_SEMICOLON),
|
||||
MK(SDLK_APOSTROPHE),
|
||||
MK (SDLK_M), MK (SDLK_COMMA), MK (SDLK_PERIOD), MK (SDLK_SLASH)
|
||||
};
|
||||
MK(SDLK_M), MK(SDLK_COMMA), MK(SDLK_PERIOD), MK(SDLK_SLASH)};
|
||||
|
||||
/**
|
||||
* Update the status of the FTrainer input device.
|
||||
|
@ -1981,7 +1975,6 @@ int DWaitButton (const uint8_t * text, ButtConfig * bc, int *buttonConfigStatus
|
|||
// will be the one we want.
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
while (1)
|
||||
|
@ -2022,8 +2015,7 @@ int DWaitButton (const uint8_t * text, ButtConfig * bc, int *buttonConfigStatus
|
|||
bc->ButtType = BUTTC_JOYSTICK;
|
||||
bc->DeviceNum = event.jhat.which;
|
||||
bc->ButtonNum =
|
||||
(0x2000 | ((event.jhat.hat & 0x1F) << 8) | event.
|
||||
jhat.value);
|
||||
(0x2000 | ((event.jhat.hat & 0x1F) << 8) | event.jhat.value);
|
||||
return (1);
|
||||
}
|
||||
break;
|
||||
|
@ -2039,15 +2031,15 @@ int DWaitButton (const uint8_t * text, ButtConfig * bc, int *buttonConfigStatus
|
|||
}
|
||||
else
|
||||
{
|
||||
if (abs
|
||||
(LastAx[event.jaxis.which][event.jaxis.axis] -
|
||||
if (abs(LastAx[event.jaxis.which][event.jaxis.axis] -
|
||||
event.jaxis.value) >= 8192)
|
||||
{
|
||||
bc->ButtType = BUTTC_JOYSTICK;
|
||||
bc->DeviceNum = event.jaxis.which;
|
||||
bc->ButtonNum = (0x8000 | event.jaxis.axis |
|
||||
((event.jaxis.value < 0)
|
||||
? 0x4000 : 0));
|
||||
? 0x4000
|
||||
: 0));
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
|
@ -2359,33 +2351,43 @@ int loadInputSettingsFromFile( const char *filename )
|
|||
{
|
||||
if (line[i] == '#')
|
||||
{
|
||||
line[i] = 0; break;
|
||||
line[i] = 0;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while ( isspace(line[i]) ) i++;
|
||||
while (isspace(line[i]))
|
||||
i++;
|
||||
|
||||
j = 0;
|
||||
while (isalnum(line[i]) || (line[i] == '_'))
|
||||
{
|
||||
id[j] = line[i]; i++; j++;
|
||||
id[j] = line[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
id[j] = 0;
|
||||
|
||||
if ( j == 0 ) continue;
|
||||
if (j == 0)
|
||||
continue;
|
||||
|
||||
while ( isspace(line[i]) ) i++;
|
||||
while (isspace(line[i]))
|
||||
i++;
|
||||
|
||||
if ( line[i] == '=' ) i++;
|
||||
if (line[i] == '=')
|
||||
i++;
|
||||
|
||||
while ( isspace(line[i]) ) i++;
|
||||
while (isspace(line[i]))
|
||||
i++;
|
||||
|
||||
j = 0;
|
||||
while (line[i] && !isspace(line[i]))
|
||||
{
|
||||
val[j] = line[i]; i++; j++;
|
||||
val[j] = line[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
val[j] = 0;
|
||||
|
||||
|
@ -2435,8 +2437,7 @@ int loadInputSettingsFromFile( const char *filename )
|
|||
* configuration management. Will probably want to change this in the
|
||||
* future - soules.
|
||||
*/
|
||||
void
|
||||
UpdateInput (Config * config)
|
||||
void UpdateInput(Config *config)
|
||||
{
|
||||
char buf[64];
|
||||
std::string device, prefix, guid, mapping;
|
||||
|
@ -2727,8 +2728,7 @@ UpdateInput (Config * config)
|
|||
// Definitions from main.h:
|
||||
// GamePad defaults
|
||||
const char *GamePadNames[GAMEPAD_NUM_BUTTONS] = {"A", "B", "Select", "Start",
|
||||
"Up", "Down", "Left", "Right", "TurboA", "TurboB"
|
||||
};
|
||||
"Up", "Down", "Left", "Right", "TurboA", "TurboB"};
|
||||
const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] =
|
||||
{"Keyboard", "None", "None", "None"};
|
||||
const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
|
||||
|
@ -2736,8 +2736,7 @@ const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
|
|||
SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
|
||||
};
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
|
||||
|
||||
// PowerPad defaults
|
||||
const char *PowerPadNames[POWERPAD_NUM_BUTTONS] =
|
||||
|
@ -2748,8 +2747,7 @@ const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS] =
|
|||
{{SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET,
|
||||
SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE,
|
||||
SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
|
||||
// QuizKing defaults
|
||||
const char *QuizKingNames[QUIZKING_NUM_BUTTONS] =
|
||||
|
@ -2769,15 +2767,13 @@ const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS] =
|
|||
const char *MahjongNames[MAHJONG_NUM_BUTTONS] =
|
||||
{"00", "01", "02", "03", "04", "05", "06", "07",
|
||||
"08", "09", "10", "11", "12", "13", "14", "15",
|
||||
"16", "17", "18", "19", "20"
|
||||
};
|
||||
"16", "17", "18", "19", "20"};
|
||||
|
||||
const char *DefaultMahjongDevice = "Keyboard";
|
||||
const int DefaultMahjong[MAHJONG_NUM_BUTTONS] =
|
||||
{SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_a, SDLK_s, SDLK_d,
|
||||
SDLK_f, SDLK_g, SDLK_h, SDLK_j, SDLK_k, SDLK_l, SDLK_z, SDLK_x,
|
||||
SDLK_c, SDLK_v, SDLK_b, SDLK_n, SDLK_m
|
||||
};
|
||||
SDLK_c, SDLK_v, SDLK_b, SDLK_n, SDLK_m};
|
||||
|
||||
// TopRider defaults
|
||||
const char *TopRiderNames[TOPRIDER_NUM_BUTTONS] =
|
||||
|
@ -2793,8 +2789,7 @@ const char *DefaultFTrainerDevice = "Keyboard";
|
|||
const int DefaultFTrainer[FTRAINER_NUM_BUTTONS] =
|
||||
{SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET,
|
||||
SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE,
|
||||
SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH
|
||||
};
|
||||
SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH};
|
||||
|
||||
// FamilyKeyBoard defaults
|
||||
const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] =
|
||||
|
@ -2808,8 +2803,7 @@ const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] =
|
|||
"LEFTSHIFT", "Z", "X", "C", "V", "B", "N", "M", "COMMA",
|
||||
"PERIOD", "SLASH", "RIGHTALT", "RIGHTSHIFT", "LEFTALT", "SPACE",
|
||||
"DELETE", "END", "PAGEDOWN",
|
||||
"CURSORUP", "CURSORLEFT", "CURSORRIGHT", "CURSORDOWN"
|
||||
};
|
||||
"CURSORUP", "CURSORLEFT", "CURSORRIGHT", "CURSORDOWN"};
|
||||
|
||||
const char *DefaultFamilyKeyBoardDevice = "Keyboard";
|
||||
const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS] =
|
||||
|
@ -2824,5 +2818,4 @@ const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS] =
|
|||
SDLK_INSERT, SDLK_LSHIFT, SDLK_z, SDLK_x, SDLK_c, SDLK_v, SDLK_b,
|
||||
SDLK_n, SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH, SDLK_RALT,
|
||||
SDLK_RSHIFT, SDLK_LALT, SDLK_SPACE, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN,
|
||||
SDLK_UP, SDLK_LEFT, SDLK_RIGHT, SDLK_DOWN
|
||||
};
|
||||
SDLK_UP, SDLK_LEFT, SDLK_RIGHT, SDLK_DOWN};
|
||||
|
|
|
@ -46,8 +46,7 @@ static const char *buttonNames[ GAMEPAD_NUM_BUTTONS ] =
|
|||
{
|
||||
"a", "b", "back", "start",
|
||||
"dpup", "dpdown", "dpleft", "dpright",
|
||||
"turboA","turboB"
|
||||
};
|
||||
"turboA", "turboB"};
|
||||
|
||||
//********************************************************************************
|
||||
// Joystick Device
|
||||
|
@ -64,13 +63,16 @@ int jsDev_t::close(void)
|
|||
{
|
||||
if (gc)
|
||||
{
|
||||
SDL_GameControllerClose( gc ); gc = NULL; js = NULL;
|
||||
SDL_GameControllerClose(gc);
|
||||
gc = NULL;
|
||||
js = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (js)
|
||||
{
|
||||
SDL_JoystickClose( js ); js = NULL;
|
||||
SDL_JoystickClose(js);
|
||||
js = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -226,7 +228,6 @@ nesGamePadMap_t::nesGamePadMap_t(void)
|
|||
//********************************************************************************
|
||||
nesGamePadMap_t::~nesGamePadMap_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
//********************************************************************************
|
||||
void nesGamePadMap_t::clearMapping(void)
|
||||
|
@ -248,34 +249,43 @@ int nesGamePadMap_t::parseMapping( const char *map )
|
|||
|
||||
clearMapping();
|
||||
|
||||
i=0; j=0; k=0;
|
||||
i = 0;
|
||||
j = 0;
|
||||
k = 0;
|
||||
|
||||
while (map[i])
|
||||
{
|
||||
while ( isspace(map[i]) ) i++;
|
||||
while (isspace(map[i]))
|
||||
i++;
|
||||
|
||||
j = 0;
|
||||
while ((map[i] != 0) && (map[i] != ',') && (map[i] != ':'))
|
||||
{
|
||||
id[k][j] = map[i]; i++; j++;
|
||||
id[k][j] = map[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
id[k][j] = 0;
|
||||
val[k][0] = 0;
|
||||
|
||||
if (map[i] == ':')
|
||||
{
|
||||
i++; j=0;
|
||||
i++;
|
||||
j = 0;
|
||||
|
||||
while ((map[i] != 0) && (map[i] != ','))
|
||||
{
|
||||
val[k][j] = map[i]; i++; j++;
|
||||
val[k][j] = map[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
val[k][j] = 0;
|
||||
}
|
||||
|
||||
if (map[i] == ',')
|
||||
{
|
||||
k++; i++;
|
||||
k++;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -319,7 +329,6 @@ GamePad_t::GamePad_t(void)
|
|||
//********************************************************************************
|
||||
GamePad_t::~GamePad_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
//********************************************************************************
|
||||
int GamePad_t::init(int port, const char *guid, const char *profile)
|
||||
|
@ -430,7 +439,8 @@ static int sdlButton2NesGpIdx( const char *id )
|
|||
{
|
||||
if (strcmp(id, buttonNames[i]) == 0)
|
||||
{
|
||||
idx = i; break;
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,11 +502,13 @@ int GamePad_t::setMapping( nesGamePadMap_t *gpm )
|
|||
l = 0;
|
||||
if (gpm->btn[i][l] == '-')
|
||||
{
|
||||
axisSign = 1; l++;
|
||||
axisSign = 1;
|
||||
l++;
|
||||
}
|
||||
else if (gpm->btn[i][l] == '+')
|
||||
{
|
||||
axisSign = 0; l++;
|
||||
axisSign = 0;
|
||||
l++;
|
||||
}
|
||||
|
||||
if (gpm->btn[i][l] == 'a')
|
||||
|
@ -507,15 +519,18 @@ int GamePad_t::setMapping( nesGamePadMap_t *gpm )
|
|||
{
|
||||
axisIdx = atoi(&gpm->btn[i][l]);
|
||||
|
||||
while ( isdigit(gpm->btn[i][l]) ) l++;
|
||||
while (isdigit(gpm->btn[i][l]))
|
||||
l++;
|
||||
}
|
||||
if (gpm->btn[i][l] == '-')
|
||||
{
|
||||
axisSign = 1; l++;
|
||||
axisSign = 1;
|
||||
l++;
|
||||
}
|
||||
else if (gpm->btn[i][l] == '+')
|
||||
{
|
||||
axisSign = 0; l++;
|
||||
axisSign = 0;
|
||||
l++;
|
||||
}
|
||||
bmap[i].ButtType = BUTTC_JOYSTICK;
|
||||
bmap[i].DeviceNum = devIdx;
|
||||
|
@ -556,23 +571,30 @@ int GamePad_t::getMapFromFile( const char *filename, char *out )
|
|||
{
|
||||
if (line[i] == '#')
|
||||
{
|
||||
line[i] = 0; break;
|
||||
line[i] = 0;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( i < 32 ) continue; // need at least 32 chars for a valid line entry
|
||||
if (i < 32)
|
||||
continue; // need at least 32 chars for a valid line entry
|
||||
|
||||
i=0; j=0;
|
||||
while ( isspace(line[i]) ) i++;
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (isspace(line[i]))
|
||||
i++;
|
||||
|
||||
while (line[i] != 0)
|
||||
{
|
||||
out[j] = line[i]; i++; j++;
|
||||
out[j] = line[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
out[j] = 0;
|
||||
|
||||
if ( j < 34 ) continue;
|
||||
if (j < 34)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -623,7 +645,8 @@ int GamePad_t::getDefaultMap( char *out, const char *guid )
|
|||
|
||||
sdlMapping = SDL_GameControllerMapping(jsDev[devIdx].gc);
|
||||
|
||||
if ( sdlMapping == NULL ) return -1;
|
||||
if (sdlMapping == NULL)
|
||||
return -1;
|
||||
|
||||
strcpy(out, sdlMapping);
|
||||
|
||||
|
@ -865,8 +888,7 @@ jsDev_t *getJoystickDevice( int devNum )
|
|||
/**
|
||||
* Tests if the given button is active on the joystick.
|
||||
*/
|
||||
int
|
||||
DTestButtonJoy(ButtConfig *bc)
|
||||
int DTestButtonJoy(ButtConfig *bc)
|
||||
{
|
||||
SDL_Joystick *js;
|
||||
|
||||
|
@ -931,7 +953,6 @@ DTestButtonJoy(ButtConfig *bc)
|
|||
}
|
||||
//********************************************************************************
|
||||
|
||||
|
||||
//static void printJoystick( SDL_Joystick *js )
|
||||
//{
|
||||
// char guidStr[64];
|
||||
|
@ -956,12 +977,12 @@ DTestButtonJoy(ButtConfig *bc)
|
|||
/**
|
||||
* Shutdown the SDL joystick subsystem.
|
||||
*/
|
||||
int
|
||||
KillJoysticks(void)
|
||||
int KillJoysticks(void)
|
||||
{
|
||||
int n; /* joystick index */
|
||||
|
||||
if (!s_jinited) {
|
||||
if (!s_jinited)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1048,13 +1069,13 @@ int RemoveJoystick( int which )
|
|||
/**
|
||||
* Initialize the SDL joystick subsystem.
|
||||
*/
|
||||
int
|
||||
InitJoysticks(void)
|
||||
int InitJoysticks(void)
|
||||
{
|
||||
int n; /* joystick index */
|
||||
int total;
|
||||
|
||||
if (s_jinited) {
|
||||
if (s_jinited)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
|
||||
|
|
|
@ -55,7 +55,6 @@ struct jsDev_t
|
|||
class GamePad_t
|
||||
{
|
||||
public:
|
||||
|
||||
ButtConfig bmap[GAMEPAD_NUM_BUTTONS];
|
||||
|
||||
GamePad_t(void);
|
||||
|
@ -82,7 +81,6 @@ class GamePad_t
|
|||
private:
|
||||
int devIdx;
|
||||
int portNum;
|
||||
|
||||
};
|
||||
|
||||
extern GamePad_t GamePad[4];
|
||||
|
|
Loading…
Reference in New Issue