diff --git a/general.h b/general.h index 3b86a831cd..1a5a2acfd7 100644 --- a/general.h +++ b/general.h @@ -63,6 +63,7 @@ struct settings int save_state_key; int load_state_key; int toggle_fullscreen_key; + int exit_emulator_key; float axis_threshold; } input; }; diff --git a/settings.c b/settings.c index af2a886ff1..307cf6b73b 100644 --- a/settings.c +++ b/settings.c @@ -97,6 +97,7 @@ static void set_defaults(void) g_settings.input.load_state_key = LOAD_STATE_KEY; g_settings.input.toggle_fullscreen_key = TOGGLE_FULLSCREEN; g_settings.input.axis_threshold = AXIS_THRESHOLD; + g_settings.input.exit_emulator_key = GLFW_KEY_ESC; } void parse_config(void) @@ -317,7 +318,23 @@ static const struct glfw_map glfw_map[] = { { "down", GLFW_KEY_DOWN }, { "enter", GLFW_KEY_ENTER }, { "rshift", GLFW_KEY_RSHIFT }, - { "space", GLFW_KEY_SPACE } + { "shift", GLFW_KEY_LSHIFT }, + { "ctrl", GLFW_KEY_LCTRL }, + { "alt", GLFW_KEY_LALT }, + { "space", GLFW_KEY_SPACE }, + { "escape", GLFW_KEY_ESC }, + { "f1", GLFW_KEY_F1 }, + { "f2", GLFW_KEY_F2 }, + { "f3", GLFW_KEY_F3 }, + { "f4", GLFW_KEY_F4 }, + { "f5", GLFW_KEY_F5 }, + { "f6", GLFW_KEY_F6 }, + { "f7", GLFW_KEY_F7 }, + { "f8", GLFW_KEY_F8 }, + { "f9", GLFW_KEY_F9 }, + { "f10", GLFW_KEY_F10 }, + { "f11", GLFW_KEY_F11 }, + { "f12", GLFW_KEY_F12 }, }; static struct snes_keybind *find_snes_bind(unsigned port, int id) @@ -421,6 +438,13 @@ static void read_keybinds(config_file_t *conf) g_settings.input.load_state_key = key; free(tmp_str); } + if (config_get_string(conf, "input_exit_emulator", &tmp_str)) + { + int key = find_glfw_key(tmp_str); + if (key >= 0) + g_settings.input.exit_emulator_key = key; + free(tmp_str); + } } diff --git a/ssnes.cfg b/ssnes.cfg index 3edf4a0ff0..f2c70d5a7d 100644 --- a/ssnes.cfg +++ b/ssnes.cfg @@ -2,63 +2,101 @@ #### Video -# video_xscale = -# video_yscale = -# video_fullscreen_x = -# video_fullscreen_y = -# video_fullscreen = -# video_vsync = -# video_smooth = -# video_force_aspect = -# video_cg_shader = -# video_filter = +# Windowed xscale and yscale (Real x res: 296 * xscale, real y scale: 224 * xscale) +# video_xscale = 3.0 +# video_yscale = 3.0 + +# Fullscreen resolution +# video_fullscreen_x = 1280 +# video_fullscreen_y = 720 + +# Start in fullscreen. Can be changed at runtime. +# video_fullscreen = false + +# Video vsync. +# video_vsync = true + +# Smoothens picture with bilinear filtering. Should be disabled if using Cg shaders. +# video_smooth = true + +# Forces rendering area to stay 4:3. +# video_force_aspect = true + +# Path to Cg shader. If enabled +# video_cg_shader = "/path/to/cg/shader.cg" + +# CPU-based filter. Valid ones are: hq2x, hq4x, grayscale, bleed, ntsc. +# video_filter = ntsc #### Audio -# audio_enable = -# audio_out_rate = -# audio_in_rate = -# audio_driver = +# Enable audio. +# audio_enable = true + +# Audio output samplerate. +# audio_out_rate = 48000 + +# Audio input samplerate from libsnes. +# Lower this (slightly) if you are experiencing frequent audio dropouts while vsync is enabled. +# Conversely, increase this slightly if you are experiencing good audio, +# but lots of dropped frames. Reasonable values for this is 32000 +/- 100 Hz. +# audio_in_rate = 31950 + +# Audio driver backend. Depending on configuration possible candidates are: alsa, oss, rsound, roar, openal +# audio_driver = alsa + +# Override the default audio device the audio_driver uses. # audio_device = -# audio_sync = -# audio_latency = + +# Will sync (block) on audio. Recommended. +# audio_sync = true + +# Desired audio latency in milliseconds. Might not be honored if driver can't provide given latency. +# audio_latency = 64 + +# libsamplerate quality. Valid values are from 1 to 5. These values map to zero_order_hold, linear, sinc_fastest, sinc_medium and sinc_best. # audio_src_quality = ### Input -# input_axis_threshold = +# Defines axis threshold. Possible values are [0.0, 1.0] +# input_axis_threshold = 0.6 -# input_player1_a = t -# input_player1_b = y -# input_player1_y = -# input_player1_x = -# input_player1_start = -# input_player1_select = -# input_player1_l = -# input_player1_r = -# input_player1_left = -# input_player1_right = -# input_player1_up = -# input_player1_down = +# Keyboard input. Will recognize normal keypresses and special keys like "left", "right", and so on. +# input_player1_a = x +# input_player1_b = z +# input_player1_y = a +# input_player1_x = s +# input_player1_start = enter +# input_player1_select = rshift +# input_player1_l = q +# input_player1_r = w +# input_player1_left = left +# input_player1_right = right +# input_player1_up = up +# input_player1_down = down -# input_player1_a_btn = -# input_player1_b_btn = -# input_player1_y_btn = -# input_player1_x_btn = -# input_player1_start_btn = -# input_player1_select_btn = -# input_player1_l_btn = -# input_player1_r_btn = -# input_player1_left_btn = -# input_player1_right_btn = -# input_player1_up_btn = -# input_player1_down_btn = +# Joypad buttons. Figure these out by looking at jstest /dev/input/js0 output. +# input_player1_a_btn = 1 +# input_player1_b_btn = 0 +# input_player1_y_btn = 2 +# input_player1_x_btn = 3 +# input_player1_start_btn = 7 +# input_player1_select_btn = 6 +# input_player1_l_btn = 4 +# input_player1_r_btn = 5 +# input_player1_left_btn = 11 +# input_player1_right_btn = 12 +# input_player1_up_btn = 13 +# input_player1_down_btn = 14 -# input_player1_left_axis = -# input_player1_right_axis = -# input_player1_up_axis = -# input_player1_down_axis = +# Axis for DPAD. Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number. +# input_player1_left_axis = -0 +# input_player1_right_axis = +0 +# input_player1_up_axis = +1 +# input_player1_down_axis = -1 +# Same stuff, just for player two. # input_player2_a = # input_player2_b = # input_player2_y = @@ -72,27 +110,36 @@ # input_player2_up = # input_player2_down = -# input_player2_a_btn = -# input_player2_b_btn = -# input_player2_y_btn = -# input_player2_x_btn = -# input_player2_start_btn = -# input_player2_select_btn = -# input_player2_l_btn = -# input_player2_r_btn = -# input_player2_left_btn = -# input_player2_right_btn = -# input_player2_up_btn = -# input_player2_down_btn = +# input_player2_a_btn = 1 +# input_player2_b_btn = 0 +# input_player2_y_btn = 2 +# input_player2_x_btn = 3 +# input_player2_start_btn = 7 +# input_player2_select_btn = 6 +# input_player2_l_btn = 4 +# input_player2_r_btn = 5 +# input_player2_left_btn = 11 +# input_player2_right_btn = 12 +# input_player2_up_btn = 13 +# input_player2_down_btn = 14 -# input_player2_left_axis = -# input_player2_right_axis = -# input_player2_up_axis = -# input_player2_down_axis = -# input_toggle_fullscreen = -# input_save_state = -# input_load_state = +# input_player2_left_axis = -0 +# input_player2_right_axis = +0 +# input_player2_up_axis = +1 +# input_player2_down_axis = -1 -# input_toggle_fast_forward = -# input_toggle_fast_forward_btn = +# Toggles fullscreen. +# input_toggle_fullscreen = f +# Saves state. +# input_save_state = f2 +# Loads state. +# input_load_state = f4 + +# Toggles between fast-forwarding and normal speed. +# input_toggle_fast_forward = space +# Same, just mapping to a joypad button. +# input_toggle_fast_forward_btn = 10 + +# Key to exit emulator cleanly. +# input_exit_emulator = escape