diff --git a/include/core/joystickapi.hpp b/include/core/joystickapi.hpp index 13adb445..4e584eec 100644 --- a/include/core/joystickapi.hpp +++ b/include/core/joystickapi.hpp @@ -1,6 +1,12 @@ #ifndef _joystickapi__hpp__included__ #define _joystickapi__hpp__included__ +#ifdef JOYSTICK_WEAK +#define JOYSTICK_DRV_ATTRIBUTE __attribute__((weak)) +#else +#define JOYSTICK_DRV_ATTRIBUTE +#endif + /** * Joystick initialization function. * @@ -8,7 +14,7 @@ * - The call occurs in the main thread. * - Implemented by the joystick plugin. */ -void joystick_driver_init() throw(); +void joystick_driver_init() throw() JOYSTICK_DRV_ATTRIBUTE ; /** * Joystick quit function. * @@ -16,21 +22,21 @@ void joystick_driver_init() throw(); * - The call occurs in the main thread. * - Implemented by the joystick plugin. */ -void joystick_driver_quit() throw(); +void joystick_driver_quit() throw() JOYSTICK_DRV_ATTRIBUTE ; /** * This thread becomes the joystick polling thread. * * - Called in joystick polling thread. */ -void joystick_driver_thread_fn() throw(); +void joystick_driver_thread_fn() throw() JOYSTICK_DRV_ATTRIBUTE ; /** * Signal the joystick thread to quit. */ -void joystick_driver_signal() throw(); +void joystick_driver_signal() throw() JOYSTICK_DRV_ATTRIBUTE ; /** * Identification for joystick plugin. */ -const char* joystick_driver_name; +extern const char* joystick_driver_name JOYSTICK_DRV_ATTRIBUTE ; #endif diff --git a/src/dummy/joystick.cpp b/src/core/dummyjoy.cpp similarity index 92% rename from src/dummy/joystick.cpp rename to src/core/dummyjoy.cpp index 1abda40e..1b87595f 100644 --- a/src/dummy/joystick.cpp +++ b/src/core/dummyjoy.cpp @@ -1,3 +1,4 @@ +#define JOYSTICK_WEAK #include "core/joystickapi.hpp" void joystick_driver_init() throw() diff --git a/src/platform/dummy/Makefile b/src/platform/dummy/Makefile index d5b3819b..231bc2f5 100644 --- a/src/platform/dummy/Makefile +++ b/src/platform/dummy/Makefile @@ -2,9 +2,6 @@ OBJECTS= ifeq ($(SOUND),DUMMY) OBJECTS += sound.$(OBJECT_SUFFIX) endif -ifeq ($(JOYSTICK),DUMMY) -OBJECTS += joystick.$(OBJECT_SUFFIX) -endif .PRECIOUS: %.$(OBJECT_SUFFIX) %.files diff --git a/src/platform/dummy/joystick.cpp b/src/platform/dummy/joystick.cpp deleted file mode 100644 index 1abda40e..00000000 --- a/src/platform/dummy/joystick.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "core/joystickapi.hpp" - -void joystick_driver_init() throw() -{ -} - -void joystick_driver_quit() throw() -{ -} - -void joystick_driver_thread_fn() throw() -{ -} - -void joystick_driver_signal() throw() -{ -} - -const char* joystick_driver_name = "Dummy joystick plugin";