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
This commit is contained in:
gregory.hainaut 2011-08-20 12:17:47 +00:00
parent 9bfbbf0a0c
commit 783f600711
8 changed files with 53 additions and 13 deletions

View File

@ -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 "")

View File

@ -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);

View File

@ -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"

View File

@ -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)));

View File

@ -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; }

View File

@ -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++)
{

View File

@ -63,6 +63,7 @@ struct PADconf
u32 options; // upper 16 bits are for pad2
u32 sensibility;
u32 joyid_map;
u32 ff_intensity;
map<u32,u32> 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();

View File

@ -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]);