diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/iphone/detect.py | 14 | ||||
-rw-r--r-- | platform/javascript/detect.py | 9 | ||||
-rw-r--r-- | platform/windows/joystick.cpp | 24 | ||||
-rw-r--r-- | platform/x11/detect.py | 18 | ||||
-rw-r--r-- | platform/x11/joystick_linux.cpp | 2 | ||||
-rw-r--r-- | platform/x11/joystick_linux.h | 2 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 6 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 2 |
8 files changed, 49 insertions, 28 deletions
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 137fcc56f5..9472f05e16 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -59,11 +59,11 @@ def configure(env): import string if (env["bits"]=="64"): #env['CCFLAGS'] = string.split('-arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -miphoneos-version-min=5.1.1 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-invalid-offsetof -ffast-math -m64 -DDEBUG -D_DEBUG -MMD -MT dependencies -isysroot $IPHONESDK') - env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') + env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) else: - env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') + env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') if (env["bits"]=="64"): env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1', @@ -116,12 +116,12 @@ def configure(env): if (env["target"]=="release"): - env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall']) - env.Append(LINKFLAGS=['-O3', '-ffast-math']) + env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math + env.Append(LINKFLAGS=['-O3']) # elif env["target"] == "release_debug": - env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) - env.Append(LINKFLAGS=['-Os', '-ffast-math']) + env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) + env.Append(LINKFLAGS=['-Os']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) elif (env["target"]=="debug"): @@ -131,7 +131,7 @@ def configure(env): elif (env["target"]=="profile"): - env.Append(CCFLAGS=['-g','-pg', '-Os', '-ffast-math']) + env.Append(CCFLAGS=['-g','-pg', '-Os']) env.Append(LINKFLAGS=['-pg']) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index ec21bf6ee4..0a6c8b1457 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -80,7 +80,7 @@ def configure(env): env.opus_fixed_point="yes" env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti']) - env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) + env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) env.Append(CPPFLAGS=['-DGLES2_ENABLED']) env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS']) env.Append(CPPFLAGS=['-s','ASM_JS=1']) @@ -98,3 +98,10 @@ def configure(env): #print "CCCOM is:", env.subst('$CCCOM') #print "P: ", env['p'], " Platofrm: ", env['platform'] + + import methods + + env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) diff --git a/platform/windows/joystick.cpp b/platform/windows/joystick.cpp index 68364ea8d5..bda092de53 100644 --- a/platform/windows/joystick.cpp +++ b/platform/windows/joystick.cpp @@ -100,6 +100,13 @@ int joystick_windows::check_free_joy_slot() const { // adapted from SDL2, works a lot better than the MSDN version bool joystick_windows::is_xinput_device(const GUID *p_guid) { + static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + + if (p_guid == &IID_ValveStreamingGamepad || p_guid == &IID_X360WiredGamepad || p_guid == &IID_X360WirelessGamepad) + return true; + PRAWINPUTDEVICELIST dev_list = NULL; unsigned int dev_list_count = 0; @@ -144,7 +151,7 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) { return false; d_joysticks[joystick_count] = dinput_gamepad(); - dinput_gamepad* joy = &d_joysticks[num]; + dinput_gamepad* joy = &d_joysticks[joystick_count]; const DWORD devtype = (instance->dwDevType & 0xFF); @@ -168,7 +175,8 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) { guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); - id_to_change = num; + id_to_change = joystick_count; + joy->di_joy->SetDataFormat(&c_dfDIJoystick2); joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND); joy->di_joy->EnumObjects(objectsCallback, this, NULL); @@ -218,7 +226,7 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i dinput_gamepad &joy = d_joysticks[p_joy_id]; - res = joy.di_joy->SetProperty(DIPROP_RANGE, &prop_range.diph); + res = IDirectInputDevice8_SetProperty(joy.di_joy, DIPROP_RANGE, &prop_range.diph); if (FAILED(res)) return; @@ -365,13 +373,13 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { IDirectInputDevice8_Acquire(joy->di_joy); joy->di_joy->Poll(); } - if (FAILED(hr = d_joysticks[i].di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) { + if (FAILED(hr = joy->di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) { //printf("failed to read joy #%d\n", i); continue; } - p_last_id = post_hat(p_last_id, i, js.rgdwPOV[0]); + p_last_id = post_hat(p_last_id, joy->id, js.rgdwPOV[0]); for (int j = 0; j < 128; j++) { @@ -379,7 +387,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { if (!joy->last_buttons[j]) { - p_last_id = input->joy_button(p_last_id, i, j, true); + p_last_id = input->joy_button(p_last_id, joy->id, j, true); joy->last_buttons[j] = true; } } @@ -387,7 +395,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { if (joy->last_buttons[j]) { - p_last_id = input->joy_button(p_last_id, i, j, false); + p_last_id = input->joy_button(p_last_id, joy->id, j, false); joy->last_buttons[j] = false; } } @@ -402,7 +410,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { for (int k=0; k<count; k++) { if (joy->joy_axis[j] == axes[k]) { - p_last_id = input->joy_axis(p_last_id, i, j, axis_correct(values[k])); + p_last_id = input->joy_axis(p_last_id, joy->id, j, axis_correct(values[k])); break; }; }; diff --git a/platform/x11/detect.py b/platform/x11/detect.py index c93905ed3c..0226c8b8c0 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -45,10 +45,6 @@ def can_build(): print("xinerama not found.. x11 disabled.") return False - x11_error=os.system("pkg-config libevdev --modversion > /dev/null ") - if (x11_error): - print("evdev not found.. x11 disabled.") - return False return True # X11 enabled @@ -133,7 +129,6 @@ def configure(env): env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xcursor --cflags --libs') - env.ParseConfig('pkg-config libevdev --cflags --libs') if (env["openssl"]=="yes"): env.ParseConfig('pkg-config openssl --cflags --libs') @@ -155,7 +150,18 @@ def configure(env): env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) if platform.system() == 'Linux': env.Append(CPPFLAGS=["-DALSA_ENABLED"]) - env.Append(LIBS=['asound', 'udev']) + env.Append(LIBS=['asound']) + + if not os.system("pkg-config --exists libudev"): + if not os.system("pkg-config --exists libevdev"): + print("Enabling udev/evdev") + env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"]) + env.ParseConfig('pkg-config libudev --cflags --libs') + env.ParseConfig('pkg-config libevdev --cflags --libs') + else: + print("libevdev development libraries not found, disabling gamepad support") + else: + print("libudev development libraries not found, disabling gamepad support") if (env["pulseaudio"]=="yes"): if not os.system("pkg-config --exists libpulse-simple"): diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp index e50916d2c2..cc806f6f78 100644 --- a/platform/x11/joystick_linux.cpp +++ b/platform/x11/joystick_linux.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ //author: Andreas Haas <hondres, liugam3@gmail.com> -#ifdef __linux__ +#ifdef JOYDEV_ENABLED #include "joystick_linux.h" #include "print_string.h" diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h index 339a5f239d..1064a6f841 100644 --- a/platform/x11/joystick_linux.h +++ b/platform/x11/joystick_linux.h @@ -30,7 +30,7 @@ //author: Andreas Haas <hondres, liugam3@gmail.com> #ifndef JOYSTICK_LINUX_H #define JOYSTICK_LINUX_H -#ifdef __linux__ +#ifdef JOYDEV_ENABLED #include "main/input_default.h" #include "os/thread.h" #include "os/mutex.h" diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d23994edd7..0afab6442b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -426,7 +426,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi physics_2d_server->init(); input = memnew( InputDefault ); -#ifdef __linux__ +#ifdef JOYDEV_ENABLED joystick = memnew( joystick_linux(input)); #endif _ensure_data_dir(); @@ -461,7 +461,7 @@ void OS_X11::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); -#ifdef __linux__ +#ifdef JOYDEV_ENABLED memdelete(joystick); #endif memdelete(input); @@ -1753,7 +1753,7 @@ void OS_X11::run() { while (!force_quit) { process_xevents(); // get rid of pending events -#ifdef __linux__ +#ifdef JOYDEV_ENABLED event_id = joystick->process_joysticks(event_id); #endif if (Main::iteration()==true) diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 02518189e0..eee3e40136 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -126,7 +126,7 @@ class OS_X11 : public OS_Unix { InputDefault *input; -#ifdef __linux__ +#ifdef JOYDEV_ENABLED joystick_linux *joystick; #endif |