summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-03-10 22:11:32 -0700
committerMichael Pavone <pavone@retrodev.com>2019-03-10 22:11:32 -0700
commit7627765cb6b379008132ddb35f7a5b22bee7df9e (patch)
treedf687462e9ef4198112b616d269adc19a576d75b
parenta87a964939461ee0630719c5efeb0eb4396e46f7 (diff)
Fix off-by-one error in evdev init code and allow ALSA device to be specified in config
-rwxr-xr-xrender_fbdev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/render_fbdev.c b/render_fbdev.c
index f5a10ba..5f84cb1 100755
--- a/render_fbdev.c
+++ b/render_fbdev.c
@@ -943,7 +943,8 @@ static char *vid_std_names[NUM_VID_STD] = {"ntsc", "pal"};
static void init_audio()
{
- int res = snd_pcm_open(&audio_handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
+ char *device_name = tern_find_path_default(config, "audio\0alsa_device\0", (tern_val){.ptrval="default"}, TVAL_PTR).ptrval;
+ int res = snd_pcm_open(&audio_handle, device_name, SND_PCM_STREAM_PLAYBACK, 0);
if (res < 0) {
fatal_error("Failed to open ALSA device: %s\n", snd_strerror(res));
}
@@ -1364,7 +1365,7 @@ void render_init(int width, int height, char * title, uint8_t fullscreen)
}
int to_check[] = {KEY_ENTER, BTN_MOUSE, BTN_GAMEPAD};
device_type dtype = DEV_NONE;
- for (int i = 0; i < 4; i++)
+ for (int i = 0; i < 3; i++)
{
if (1 & button_bits[to_check[i]/(8*sizeof(button_bits[0]))] >> to_check[i]%(8*sizeof(button_bits[0]))) {
dtype = i + 1;