Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move g_Joystick to SystemGlobals.cpp

  • Loading branch information...
commit e00733fbdb336fb02aa4a32cc8389abb1b7a210a 1 parent 2773173
@Karlson2k Karlson2k authored
View
10 xbmc/SystemGlobals.cpp
@@ -41,6 +41,13 @@
#ifdef HAS_PYTHON
#include "interfaces/python/XBPython.h"
#endif
+#if defined(TARGET_WINDOWS)
+#include "input/windows/WINJoystick.h"
+#elif defined(HAS_SDL_JOYSTICK) || defined(HAS_EVENT_SERVER)
+#include "input/SDLJoystick.h"
+#endif
+
+
CGUISettings g_guiSettings;
CSettings g_settings;
@@ -57,6 +64,9 @@
CGUITextureManager g_TextureManager;
CGUILargeTextureManager g_largeTextureManager;
CMouseStat g_Mouse;
+#if defined(HAS_SDL_JOYSTICK) || defined(HAS_EVENT_SERVER)
+ CJoystick g_Joystick;
+#endif
CGUIPassword g_passwordManager;
CGUIInfoManager g_infoManager;
View
2  xbmc/input/SDLJoystick.cpp
@@ -32,8 +32,6 @@
using namespace std;
-CJoystick g_Joystick; // global
-
CJoystick::CJoystick()
{
Reset(true);
View
2  xbmc/input/windows/WINJoystick.cpp
@@ -31,8 +31,6 @@
using namespace std;
-CJoystick g_Joystick; // global
-
extern HWND g_hWnd;
#define MAX_AXISAMOUNT 32768

12 comments on commit e00733f

@gyunaev
Collaborator

This breaks the configurations with --disable-joystick:

CPP xbmc/SystemGlobals.o
SystemGlobals.cpp:68:3: error: ‘CJoystick’ does not name a type

@jmarshallnz
Owner

Looks like just the || defined HAS_EVENT_SERVER needs removing on the include and g_Joystick?

@gyunaev
Collaborator

That indeed fixed it for me and so far the compiled binary seem to work fine. Is there any other reason for having the HAS_EVENT_SERVER there?

@jmarshallnz
Owner
@davilla
Collaborator

HAS_EVENT_SERVER is there because the apple remote uses the joystick interface. If you break that, then the Apple remote will not work anymore if --disable-joystick is used which ios does in configure.in

arm-apple-darwin*)
use_joystick=no

@jmarshallnz
Owner

Doesn't it just use the joystick translation stuff, not the actual joystick object (g_Joystick) ?

@davilla
Collaborator

was that moved out ? from what I remember, there are functions there that the eventserver called which is why there was an || HAS_EVENT_SERVER

and it's osx not ios that uses the joystick/eventserver. other eventclients might also be using it.

@Karlson2k
Collaborator

Looks like "|| HAS_EVENT_SERVER" could be removed from SystemGlobals.cpp and from Application.cpp.
Now SystemGlobals just reflect include schema from Application.cpp.
CApplication::ProcessEventServer calls CApplication::ProcessJoystickEvent which one calls g_Joystick.Reset() (only ifdef HAS_SDL_JOYSTICK) and calls CButtonTranslator::GetInstance().TranslateJoystickString which one is using only defines JACTIVE_ from WIN/SDLJoystick.h
So now it doesn't break anything, but could be optimized.
Could someone test compilation on MacOS/iOS and Linux platforms to be sure?

@gyunaev
Collaborator

I can confirm that Linux builds and works fine with || HASEVENT_SERVER removed when configured with --disabled-joystick (my standard build configuration)

@Karlson2k
Collaborator

@gyunaev thanks!
Still need MacOS/iOS confirmation.

@Memphiz
Owner

Confirmed - removing the || HASEVENT_SERVER fixes compilation on ios/osx too.

@Karlson2k
Collaborator

Created PR #1140

Please sign in to comment.
Something went wrong with that request. Please try again.