* Applied (cleaned up) patch by Stefano to fix bug #4742.
* Note while this fixed running BeOS apps using BJoystick, it breaks all apps (and SDL) that have been compiled for Haiku R1/alpha1. It's really bad that r27171 went through unnoticed. We should really try harder next time (and try to get the ABI change detection script working in an automated way). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33520 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,13 +5,10 @@
|
|||||||
#ifndef _JOYSTICK_H
|
#ifndef _JOYSTICK_H
|
||||||
#define _JOYSTICK_H
|
#define _JOYSTICK_H
|
||||||
|
|
||||||
#include <BeBuild.h>
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
#include <stdio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class BList;
|
class BList;
|
||||||
class BString;
|
class BString;
|
||||||
@@ -20,6 +17,7 @@ struct entry_ref;
|
|||||||
struct _extended_joystick;
|
struct _extended_joystick;
|
||||||
struct _joystick_info;
|
struct _joystick_info;
|
||||||
|
|
||||||
|
|
||||||
class BJoystick {
|
class BJoystick {
|
||||||
public:
|
public:
|
||||||
BJoystick();
|
BJoystick();
|
||||||
@@ -35,7 +33,7 @@ public:
|
|||||||
bigtime_t timestamp;
|
bigtime_t timestamp;
|
||||||
int16 horizontal;
|
int16 horizontal;
|
||||||
int16 vertical;
|
int16 vertical;
|
||||||
|
|
||||||
bool button1;
|
bool button1;
|
||||||
bool button2;
|
bool button2;
|
||||||
|
|
||||||
@@ -58,12 +56,12 @@ public:
|
|||||||
int32 forStick = 0);
|
int32 forStick = 0);
|
||||||
status_t GetAxisNameAt(int32 index,
|
status_t GetAxisNameAt(int32 index,
|
||||||
BString* outName);
|
BString* outName);
|
||||||
|
|
||||||
int32 CountHats();
|
int32 CountHats();
|
||||||
status_t GetHatValues(uint8* outHats,
|
status_t GetHatValues(uint8* outHats,
|
||||||
int32 forStick = 0);
|
int32 forStick = 0);
|
||||||
status_t GetHatNameAt(int32 index, BString* outName);
|
status_t GetHatNameAt(int32 index, BString* outName);
|
||||||
|
|
||||||
int32 CountButtons();
|
int32 CountButtons();
|
||||||
|
|
||||||
uint32 ButtonValues(int32 forStick = 0);
|
uint32 ButtonValues(int32 forStick = 0);
|
||||||
@@ -80,16 +78,20 @@ friend class _BJoystickTweaker;
|
|||||||
status_t GatherEnhanced_info(const entry_ref* ref = NULL);
|
status_t GatherEnhanced_info(const entry_ref* ref = NULL);
|
||||||
status_t SaveConfig(const entry_ref* ref = NULL);
|
status_t SaveConfig(const entry_ref* ref = NULL);
|
||||||
|
|
||||||
|
void _ReservedJoystick1();
|
||||||
|
virtual void _ReservedJoystick2();
|
||||||
|
virtual void _ReservedJoystick3();
|
||||||
|
virtual status_t _Reserved_Joystick_4(void *, ...);
|
||||||
|
virtual status_t _Reserved_Joystick_5(void *, ...);
|
||||||
|
virtual status_t _Reserved_Joystick_6(void *, ...);
|
||||||
|
|
||||||
bool fBeBoxMode;
|
bool fBeBoxMode;
|
||||||
bool fReservedBool;
|
bool fReservedBool;
|
||||||
int ffd;
|
int ffd;
|
||||||
BList* fDevices;
|
BList* fDevices;
|
||||||
_joystick_info* fJoystickInfo;
|
_joystick_info* fJoystickInfo;
|
||||||
char* fDevName;
|
char* fDevName;
|
||||||
#if DEBUG
|
uint32 _reserved_Joystick_[10];
|
||||||
public:
|
|
||||||
static FILE* sLogFile;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _JOYSTICK_H
|
#endif // _JOYSTICK_H
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include "Joystick.h"
|
#include "Joystick.h"
|
||||||
|
|
||||||
@@ -30,8 +31,11 @@ LOG(const char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
fputs(buf, BJoystick::sLogFile); fflush(BJoystick::sLogFile);
|
fputs(buf, BJoystick::sLogFile); fflush(BJoystick::sLogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
# define LOG_ERR(text...) LOG(text)
|
# define LOG_ERR(text...) LOG(text)
|
||||||
FILE *BJoystick::sLogFile = NULL;
|
|
||||||
|
static FILE *sLogFile = NULL;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define LOG(text...)
|
# define LOG(text...)
|
||||||
# define LOG_ERR(text...) fprintf(stderr, text)
|
# define LOG_ERR(text...) fprintf(stderr, text)
|
||||||
@@ -112,14 +116,14 @@ BJoystick::Open(const char *portName, bool enter_enhanced)
|
|||||||
//Read the Joystick Description file for this port/joystick
|
//Read the Joystick Description file for this port/joystick
|
||||||
_BJoystickTweaker jt(*this);
|
_BJoystickTweaker jt(*this);
|
||||||
jt.GetInfo(fJoystickInfo, portName);
|
jt.GetInfo(fJoystickInfo, portName);
|
||||||
|
|
||||||
LOG("ioctl - %d\n", fJoystickInfo->num_buttons);
|
LOG("ioctl - %d\n", fJoystickInfo->num_buttons);
|
||||||
ioctl(ffd, B_JOYSTICK_SET_DEVICE_MODULE, fJoystickInfo);
|
ioctl(ffd, B_JOYSTICK_SET_DEVICE_MODULE, fJoystickInfo);
|
||||||
ioctl(ffd, B_JOYSTICK_GET_DEVICE_MODULE, fJoystickInfo);
|
ioctl(ffd, B_JOYSTICK_GET_DEVICE_MODULE, fJoystickInfo);
|
||||||
LOG("ioctl - %d\n", fJoystickInfo->num_buttons);
|
LOG("ioctl - %d\n", fJoystickInfo->num_buttons);
|
||||||
|
|
||||||
return ffd;
|
return ffd;
|
||||||
} else
|
} else
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +156,7 @@ BJoystick::CountDevices()
|
|||||||
|
|
||||||
// Refresh devices list
|
// Refresh devices list
|
||||||
ScanDevices(true);
|
ScanDevices(true);
|
||||||
|
|
||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
if (fDevices != NULL)
|
if (fDevices != NULL)
|
||||||
count = fDevices->CountItems();
|
count = fDevices->CountItems();
|
||||||
@@ -361,3 +365,13 @@ BJoystick::SaveConfig(const entry_ref *ref)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - FBC protection
|
||||||
|
|
||||||
|
|
||||||
|
void BJoystick::_ReservedJoystick1() {}
|
||||||
|
void BJoystick::_ReservedJoystick2() {}
|
||||||
|
void BJoystick::_ReservedJoystick3() {}
|
||||||
|
status_t BJoystick::_Reserved_Joystick_4(void*, ...) { return B_ERROR; }
|
||||||
|
status_t BJoystick::_Reserved_Joystick_5(void*, ...) { return B_ERROR; }
|
||||||
|
status_t BJoystick::_Reserved_Joystick_6(void*, ...) { return B_ERROR; }
|
||||||
|
|||||||
Reference in New Issue
Block a user