From 7627765cb6b379008132ddb35f7a5b22bee7df9e Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 10 Mar 2019 22:11:32 -0700 Subject: Fix off-by-one error in evdev init code and allow ALSA device to be specified in config --- render_fbdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'render_fbdev.c') 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; -- cgit v1.2.3