From 80bbbb6a7e0d0c57eaaddc0275d9032640f3253b Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 22 May 2004 07:31:38 +0000 Subject: [PATCH] fix crash/hang when using -nojoystick in linux version (d1x r1.5) --- ChangeLog | 3 +++ arch/linux/joystick.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6b365a2..30ab2c6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-05-22 Matthew Mueller + * arch/linux/joystick.c: fix crash/hang when using -nojoystick in + linux version (d1x r1.5) + * main/kconfig.c: make next axis config key skip currently allocated axes (d1x r1.11) diff --git a/arch/linux/joystick.c b/arch/linux/joystick.c index 034e399a..b76203bf 100644 --- a/arch/linux/joystick.c +++ b/arch/linux/joystick.c @@ -1,4 +1,4 @@ -/* $Id: joystick.c,v 1.4 2004-05-22 01:40:14 btb Exp $ */ +/* $Id: joystick.c,v 1.5 2004-05-22 07:31:38 btb Exp $ */ /* * * Linux joystick support @@ -181,7 +181,9 @@ void joy_flush () { ubyte joystick_read_raw_axis (ubyte mask, int *axes) { int i; - + + if (!joy_installed) + return 0; j_Update_state(); for (i = 0; i < j_num_axes; i++) { @@ -367,6 +369,8 @@ int joy_get_btns () { int joy_get_button_state (int btn) { + if (!joy_installed) + return 0; if(btn >= j_num_buttons) return 0; j_Update_state (); @@ -378,6 +382,8 @@ int joy_get_button_state (int btn) { int joy_get_button_down_cnt (int btn) { int downcount; + if (!joy_installed) + return 0; j_Update_state (); downcount = j_button[btn].downcount; @@ -390,6 +396,9 @@ int joy_get_button_down_cnt (int btn) { //changed 6/24/99 to finally squish the timedown bug - Owen Evans fix joy_get_button_down_time(int btn) { fix downtime; + + if (!joy_installed) + return 0; j_Update_state (); if (j_button[btn].state) { -- 2.39.2