most of the SDL hotkeys can now be mapped in the config file under SDL.Hotkeys.*
This commit is contained in:
parent
f206b4c76a
commit
832f346fc8
|
@ -254,6 +254,23 @@ InitConfig()
|
||||||
DefaultFamilyKeyBoard[j]);
|
DefaultFamilyKeyBoard[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hotkeys
|
||||||
|
prefix = "SDL.Hotkeys.";
|
||||||
|
config->addOption(prefix + "CheatMenu", SDLK_F2);
|
||||||
|
config->addOption(prefix + "RenderBG", SDLK_F4);
|
||||||
|
config->addOption(prefix + "SaveState", SDLK_F5);
|
||||||
|
config->addOption(prefix + "LoadState", SDLK_F7);
|
||||||
|
config->addOption(prefix + "Screenshot", SDLK_F9);
|
||||||
|
config->addOption(prefix + "Reset", SDLK_F10);
|
||||||
|
config->addOption(prefix + "Power", SDLK_F11);
|
||||||
|
config->addOption(prefix + "Quit", SDLK_ESCAPE);
|
||||||
|
config->addOption(prefix + "Pause", SDLK_BACKSLASH);
|
||||||
|
config->addOption(prefix + "DecraseSpeed", SDLK_MINUS);
|
||||||
|
config->addOption(prefix + "IncreaseSpeed", SDLK_EQUALS);
|
||||||
|
config->addOption(prefix + "FrameAdvance", SDLK_RCTRL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// All mouse devices
|
// All mouse devices
|
||||||
config->addOption("SDL.OekaKids.0.DeviceType", "Mouse");
|
config->addOption("SDL.OekaKids.0.DeviceType", "Mouse");
|
||||||
config->addOption("SDL.OekaKids.0.DeviceNum", 0);
|
config->addOption("SDL.OekaKids.0.DeviceNum", 0);
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "dface.h"
|
#include "dface.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "sdl-video.h"
|
#include "sdl-video.h"
|
||||||
|
|
||||||
|
@ -34,6 +36,8 @@
|
||||||
|
|
||||||
/** GLOBALS **/
|
/** GLOBALS **/
|
||||||
int NoWaiting=1;
|
int NoWaiting=1;
|
||||||
|
extern Config *g_config;
|
||||||
|
|
||||||
|
|
||||||
/* UsrInputType[] is user-specified. InputType[] is current
|
/* UsrInputType[] is user-specified. InputType[] is current
|
||||||
(game loading can override user settings)
|
(game loading can override user settings)
|
||||||
|
@ -144,7 +148,7 @@ static int g_fkbEnabled = 0;
|
||||||
static void
|
static void
|
||||||
KeyboardCommands()
|
KeyboardCommands()
|
||||||
{
|
{
|
||||||
int is_shift, is_alt;
|
int is_shift, is_alt, key;
|
||||||
|
|
||||||
// get the keyboard input
|
// get the keyboard input
|
||||||
g_keyState = SDL_GetKeyState(NULL);
|
g_keyState = SDL_GetKeyState(NULL);
|
||||||
|
@ -165,12 +169,12 @@ KeyboardCommands()
|
||||||
is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
|
is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
|
||||||
is_alt = KEY(LEFTALT) | KEY(RIGHTALT);
|
is_alt = KEY(LEFTALT) | KEY(RIGHTALT);
|
||||||
|
|
||||||
// f4 controls rendering
|
g_config->getOption("SDL.Hotkeys.RenderBG", &key);
|
||||||
if(keyonly(F4)) {
|
if(g_keyState[key]) {
|
||||||
if(is_shift) {
|
if(is_shift) {
|
||||||
FCEUI_SetRenderPlanes(true, false);
|
FCEUI_SetRenderPlanes(true, false);
|
||||||
} else {
|
} else {
|
||||||
FCEUI_SetRenderPlanes(false, true);
|
FCEUI_SetRenderPlanes(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,20 +199,23 @@ KeyboardCommands()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// f9 is save snapshot key
|
|
||||||
if(keyonly(F9)) {
|
|
||||||
|
g_config->getOption("SDL.Hotkeys.Screenshot", &key);
|
||||||
|
if(g_keyState[key]) {
|
||||||
FCEUI_SaveSnapshot();
|
FCEUI_SaveSnapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if not NES Sound Format
|
// if not NES Sound Format
|
||||||
if(gametype != GIT_NSF) {
|
if(gametype != GIT_NSF) {
|
||||||
// f2 to enable cheats
|
|
||||||
if(keyonly(F2)) {
|
g_config->getOption("SDL.Hotkeys.CheatMenu", &key);
|
||||||
|
if(g_keyState[key]) {
|
||||||
DoCheatSeq();
|
DoCheatSeq();
|
||||||
}
|
}
|
||||||
|
|
||||||
// f5 to save state, Shift-f5 to save movie
|
g_config->getOption("SDL.Hotkeys.SaveState", &key);
|
||||||
if(keyonly(F5)) {
|
if(g_keyState[key]) {
|
||||||
if(is_shift) {
|
if(is_shift) {
|
||||||
FCEUI_SaveMovie(NULL,MOVIE_FLAG_NONE);
|
FCEUI_SaveMovie(NULL,MOVIE_FLAG_NONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -216,8 +223,9 @@ KeyboardCommands()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_config->getOption("SDL.Hotkeys.LoadState", &key);
|
||||||
// f7 to load state, Shift-f7 to load movie
|
// f7 to load state, Shift-f7 to load movie
|
||||||
if(keyonly(F7)) {
|
if(g_keyState[key]) {
|
||||||
if(is_shift) {
|
if(is_shift) {
|
||||||
//mbg merge 7/23/06 loadmovie takes another arg now
|
//mbg merge 7/23/06 loadmovie takes another arg now
|
||||||
FCEUI_LoadMovie(NULL, false, false, false);
|
FCEUI_LoadMovie(NULL, false, false, false);
|
||||||
|
@ -227,41 +235,42 @@ KeyboardCommands()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// f1 to toggle tile view
|
|
||||||
/*
|
|
||||||
if(keyonly(F1)) {
|
|
||||||
FCEUI_ToggleTileView();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// - to decrease speed, = to increase speed
|
g_config->getOption("SDL.Hotkeys.DecreaseSpeed", &key);
|
||||||
if(keyonly(MINUS)) {
|
if(g_keyState[key]) {
|
||||||
|
// this doesn't seem to work right now
|
||||||
DecreaseEmulationSpeed();
|
DecreaseEmulationSpeed();
|
||||||
}
|
}
|
||||||
if(keyonly(EQUAL)) {
|
g_config->getOption("SDL.Hotkeys.IncreaseSpeed", &key);
|
||||||
|
if(g_keyState[key]) {
|
||||||
|
// this seems quite sporadic
|
||||||
IncreaseEmulationSpeed();
|
IncreaseEmulationSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyonly(BACKSPACE)) {
|
if(keyonly(BACKSPACE)) {
|
||||||
FCEUI_MovieToggleFrameDisplay();
|
FCEUI_MovieToggleFrameDisplay();
|
||||||
}
|
}
|
||||||
if(keyonly(BACKSLASH)) {
|
g_config->getOption("SDL.Hotkeys.Pause", &key);
|
||||||
|
if(g_keyState[key]) {
|
||||||
FCEUI_ToggleEmulationPause();
|
FCEUI_ToggleEmulationPause();
|
||||||
}
|
}
|
||||||
if(keyonly(RIGHTCONTROL)) {
|
g_config->getOption("SDL.Hotkeys.FrameAdvance", &key);
|
||||||
FCEUI_FrameAdvance();
|
if(g_keyState[key]) {
|
||||||
|
// this currently crashes fceu for me, is this broken?
|
||||||
|
//FCEUI_FrameAdvance();
|
||||||
}
|
}
|
||||||
|
|
||||||
// f10 reset, f11 power
|
|
||||||
if(keyonly(F10)) {
|
g_config->getOption("SDL.Hotkeys.Reset", &key);
|
||||||
|
if(g_keyState[key]) {
|
||||||
FCEUI_ResetNES();
|
FCEUI_ResetNES();
|
||||||
}
|
}
|
||||||
if(keyonly(F11)) {
|
g_config->getOption("SDL.Hotkeys.Power", &key);
|
||||||
|
if(g_keyState[key]) {
|
||||||
FCEUI_PowerNES();
|
FCEUI_PowerNES();
|
||||||
}
|
}
|
||||||
|
g_config->getOption("SDL.Hotkeys.Quit", &key);
|
||||||
// F12 or Esc close game
|
if(g_keyState[key]) {
|
||||||
if(KEY(F12) || KEY(ESCAPE)) {
|
|
||||||
FCEUI_CloseGame();
|
FCEUI_CloseGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue