From 783f600711c469f6ed1a9110dfbdcc7caf57a2ee Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Sat, 20 Aug 2011 12:17:47 +0000 Subject: [PATCH] gsdx, sdl: cast window as expected by sdl onepad: add an option to control forcefeeback level cmake: add an hidden option (SHARED_SDL) to build SDL as a shared library to allow pre-load git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4873 96395faa-99c1-11dd-bbfe-3dabce05a288 --- 3rdparty/SDL-1.3.0-5387/CMakeLists.txt | 23 ++++++++++++++++++- .../src/video/x11/SDL_x11window.c | 4 +--- bin/launch_pcsx2_linux.sh | 18 ++++++++++++++- plugins/GSdx/GSLinuxDialog.cpp | 12 +++++----- plugins/GSdx/GSWnd.h | 2 +- plugins/onepad/Linux/ini.cpp | 3 +++ plugins/onepad/controller.h | 2 ++ plugins/onepad/joystick.cpp | 2 +- 8 files changed, 53 insertions(+), 13 deletions(-) diff --git a/3rdparty/SDL-1.3.0-5387/CMakeLists.txt b/3rdparty/SDL-1.3.0-5387/CMakeLists.txt index 13ab814fe4..69ace89c7e 100644 --- a/3rdparty/SDL-1.3.0-5387/CMakeLists.txt +++ b/3rdparty/SDL-1.3.0-5387/CMakeLists.txt @@ -388,7 +388,28 @@ set(SDL_sources #include_directories( ${SDL_ROOT}/include /usr/include/kde/artsc /usr/include/directfb) -add_library(${Output} STATIC ${SDL_sources} ) + +# Hiden option. It is only a temporary workaround of issue 1003. The purpose is to LD_PRELOAD +# the library so it avoid any conflict with previous SDL1.2 symbol +if (DEFINED SHARED_SDL) + add_library(${Output} SHARED ${SDL_sources} ) + + # Seem to be needed when pre-loading on Fedora + target_link_libraries(${Output} dl) + target_link_libraries(${Output} m) + + # Install the library with others plugins + if(PACKAGE_MODE) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) + else(PACKAGE_MODE) + install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) + endif(PACKAGE_MODE) + +else (DEFINED SHARED_SDL) + # Std build use static build + add_library(${Output} STATIC ${SDL_sources} ) +endif (DEFINED SHARED_SDL) + # User flags options if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") diff --git a/3rdparty/SDL-1.3.0-5387/src/video/x11/SDL_x11window.c b/3rdparty/SDL-1.3.0-5387/src/video/x11/SDL_x11window.c index 5ca3350cc6..6e8b85bcf5 100644 --- a/3rdparty/SDL-1.3.0-5387/src/video/x11/SDL_x11window.c +++ b/3rdparty/SDL-1.3.0-5387/src/video/x11/SDL_x11window.c @@ -512,9 +512,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { - // For me it is a bug -- Gregory - // Window w = (Window) data; - Window w = *(Window*) data; + Window w = (Window) data; window->title = X11_GetWindowTitle(_this, w); diff --git a/bin/launch_pcsx2_linux.sh b/bin/launch_pcsx2_linux.sh index e98cda504d..f46f3cc1b9 100755 --- a/bin/launch_pcsx2_linux.sh +++ b/bin/launch_pcsx2_linux.sh @@ -17,7 +17,23 @@ PWD_old=$PWD # Go to the script directory cd `dirname $current_script` -if [ -e pcsx2 ] ; then + +# Setup LD_PRELOAD to work-around issue 1003 +SDL_SO=`pwd`/plugins/libpcsx2_SDL.so +if [ -e "$SDL_SO" ] +then + echo "INFO: LD_PRELOAD $SDL_SO" + if [ -n "$LD_PRELOAD" ] + then + LD_PRELOAD="$SDL_SO:$LD_PRELOAD" + else + LD_PRELOAD="$SDL_SO" + fi +fi + +# Launch PCSX2 +if [ -x pcsx2 ] +then ./pcsx2 else echo "Error PCSX2 not found" diff --git a/plugins/GSdx/GSLinuxDialog.cpp b/plugins/GSdx/GSLinuxDialog.cpp index bf05c081a5..271b8e2619 100644 --- a/plugins/GSdx/GSLinuxDialog.cpp +++ b/plugins/GSdx/GSLinuxDialog.cpp @@ -98,7 +98,7 @@ bool RunLinuxDialog() gtk_combo_box_append_text(GTK_COMBO_BOX(interlace_combo_box), label.c_str()); } - gtk_combo_box_set_active(GTK_COMBO_BOX(interlace_combo_box), 0); + gtk_combo_box_set_active(GTK_COMBO_BOX(interlace_combo_box), theApp.GetConfig("interlace", 0)); gtk_container_add(GTK_CONTAINER(main_box), interlace_label); gtk_container_add(GTK_CONTAINER(main_box), interlace_combo_box); @@ -143,17 +143,17 @@ bool RunLinuxDialog() { // Get all the settings from the dialog box. - #if 0 // I'll put the right variable names in later. + #if 0 + // I'll put the right variable names in later. if (gtk_combo_box_get_active(GTK_COMBO_BOX(render_combo_box)) != -1) renderer = gtk_combo_box_get_active(GTK_COMBO_BOX(render_combo_box)); + // Crash, for some interlace options if (gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)) != -1) - interlace = gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)); - - if (gtk_combo_box_get_active(GTK_COMBO_BOX(aspect_combo_box)) != -1) - aspect = gtk_combo_box_get_active(GTK_COMBO_BOX(aspect_combo_box)); + theApp.SetConfig( "interlace", (int)gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)) ); #endif + theApp.SetConfig("swthreads", atoi((char*)gtk_entry_get_text(GTK_ENTRY(swthreads_text))) ); theApp.SetConfig("filter", (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filter_check))); diff --git a/plugins/GSdx/GSWnd.h b/plugins/GSdx/GSWnd.h index 44369783e9..9969638361 100644 --- a/plugins/GSdx/GSWnd.h +++ b/plugins/GSdx/GSWnd.h @@ -108,7 +108,7 @@ public: bool IsManaged() const {return m_managed;} Display* GetDisplay(); - void* GetHandle() {return (void*)&m_Xwindow;} + void* GetHandle() {return (void*)m_Xwindow;} GSVector4i GetClientRect(); bool SetWindowText(const char* title); void SetWindow(SDL_Window* current_window) { if (current_window) m_window = current_window; } diff --git a/plugins/onepad/Linux/ini.cpp b/plugins/onepad/Linux/ini.cpp index 8dd39d6a24..efcb3a5408 100644 --- a/plugins/onepad/Linux/ini.cpp +++ b/plugins/onepad/Linux/ini.cpp @@ -132,6 +132,7 @@ void SaveConfig() fprintf(f, "options = %d\n", conf->options); fprintf(f, "mouse_sensibility = %d\n", conf->sensibility); fprintf(f, "joy_pad_map = %d\n", conf->joyid_map); + fprintf(f, "ff_intensity = %d\n", conf->ff_intensity); for (int pad = 0; pad < 2; pad++) { @@ -178,6 +179,8 @@ void LoadConfig() conf->sensibility = value; if (fscanf(f, "joy_pad_map = %d\n", &value) == 0) return; conf->joyid_map = value; + if (fscanf(f, "ff_intensity = %d\n", &value) == 0) return; + conf->ff_intensity = value; for (int pad = 0; pad < 2; pad++) { diff --git a/plugins/onepad/controller.h b/plugins/onepad/controller.h index d54866a6fe..168946ba97 100644 --- a/plugins/onepad/controller.h +++ b/plugins/onepad/controller.h @@ -63,6 +63,7 @@ struct PADconf u32 options; // upper 16 bits are for pad2 u32 sensibility; u32 joyid_map; + u32 ff_intensity; map keysym_map[2]; PADconf() { init(); } @@ -70,6 +71,7 @@ struct PADconf void init() { memset(&keys, 0, sizeof(keys)); log = options = joyid_map = 0; + ff_intensity = 100; sensibility = 500; for (int pad = 0; pad < 2 ; pad++) keysym_map[pad].clear(); diff --git a/plugins/onepad/joystick.cpp b/plugins/onepad/joystick.cpp index eeb244a790..d89f6e5d71 100644 --- a/plugins/onepad/joystick.cpp +++ b/plugins/onepad/joystick.cpp @@ -186,7 +186,7 @@ void JoystickInfo::DoHapticEffect(int type, int pad, int force) if (pjoy->haptic_effect_id[type] < 0) return; // FIXME: might need to multiply force - pjoy->haptic_effect_data[type].periodic.magnitude = force; // force/32767 strength + pjoy->haptic_effect_data[type].periodic.magnitude = force * conf->ff_intensity ; // force/32767 strength // Upload the new effect SDL_HapticUpdateEffect(pjoy->haptic, pjoy->haptic_effect_id[type], &pjoy->haptic_effect_data[type]);