efl: remove PS3 backend.

This backend has received no patch and maintenance from anyone who could
actually test it over the last few years. After talking with KaKaRoTo it
is best to remove it. If anyone want to take over its maintenance, you
are welcome to revert this patch.
devs/barbieri/future
Cedric BAIL 6 years ago
parent e6b4878a9e
commit d179a5c2a9
  1. 8
      Makefile.am
  2. 8
      README
  3. 48
      configure.ac
  4. 2
      pc/.gitignore
  5. 12
      pc/ecore-psl1ght.pc.in
  6. 3
      pc/evas-psl1ght.pc.in
  7. 1
      src/Makefile.am
  8. 25
      src/Makefile_Ecore_Evas.am
  9. 29
      src/Makefile_Ecore_Psl1ght.am
  10. 35
      src/Makefile_Evas.am
  11. 2
      src/lib/ecore_evas/Ecore_Evas.h
  12. 16
      src/lib/ecore_evas/ecore_evas.c
  13. 6
      src/lib/ecore_evas/ecore_evas_module.c
  14. 124
      src/lib/ecore_psl1ght/Ecore_Psl1ght.h
  15. 78
      src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h
  16. 862
      src/lib/ecore_psl1ght/ecore_psl1ght.c
  17. 36
      src/lib/ecore_psl1ght/ecore_psl1ght_private.h
  18. 281
      src/lib/ecore_psl1ght/gemutil.c
  19. 19
      src/lib/ecore_psl1ght/gemutil.h
  20. 245
      src/lib/ecore_psl1ght/moveutil.c
  21. 43
      src/lib/ecore_psl1ght/moveutil.h
  22. 62
      src/lib/ecore_psl1ght/spursutil.c
  23. 24
      src/lib/ecore_psl1ght/spursutil.h
  24. 14
      src/lib/elementary/efl_ui_win.c
  25. 3
      src/lib/elementary/elm_config.c
  26. 4
      src/lib/evas/file/evas_module.c
  27. 467
      src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
  28. 16
      src/modules/evas/engines/psl1ght/Evas_Engine_PSL1GHT.h
  29. 449
      src/modules/evas/engines/psl1ght/evas_engine.c
  30. 30
      src/modules/evas/engines/psl1ght/evas_engine.h
  31. 275
      src/modules/evas/engines/psl1ght/rsxutil.c
  32. 43
      src/modules/evas/engines/psl1ght/rsxutil.h
  33. 3
      src/tests/evas/evas_test_render_engines.c

@ -221,10 +221,6 @@ if BUILD_ENGINE_SOFTWARE_DDRAW
pkgconfig_DATA += pc/evas-software-ddraw.pc
endif
if BUILD_ENGINE_PSL1GHT
pkgconfig_DATA += pc/evas-psl1ght.pc
endif
if BUILD_ENGINE_WAYLAND_SHM
pkgconfig_DATA += pc/evas-wayland-shm.pc
endif
@ -249,10 +245,6 @@ if HAVE_ECORE_DRM
pkgconfig_DATA += pc/ecore-drm.pc
endif
if HAVE_PS3
pkgconfig_DATA += pc/ecore-psl1ght.pc
endif
if HAVE_ECORE_SDL
pkgconfig_DATA += pc/ecore-sdl.pc
endif

@ -168,14 +168,6 @@ supports all the transport layers Ecore Con supports.
**Ecore Psl1ght:**
//BSD 2-Clause license//
This library acts as a helper for porting to the Playstation 3 (PS3)
native runtime environment.
**Ecore SDL:**

@ -2523,13 +2523,8 @@ define([EVAS_ENGINE_DEP_CHECK_FB], [
AC_CHECK_HEADER([linux/fb.h], [:], [AC_MSG_ERROR([Missing linux/fb.h])])
])
define([EVAS_ENGINE_DEP_CHECK_PSL1GHT], [
AC_CHECK_HEADER([rsx/rsx.h], [:], [AC_MSG_ERROR([Missing rsx/rsx.h])])
])
EVAS_ENGINE([buffer], [static])
EVAS_ENGINE([fb], [${want_fb}], [EVAS_ENGINE_DEP_CHECK_FB])
EVAS_ENGINE([psl1ght], [${have_ps3}], [EVAS_ENGINE_DEP_CHECK_PSL1GHT])
# XXX TODO:
EVAS_CHECK_ENGINE([gl-cocoa], [${want_evas_engine_gl_cocoa}], [no], [OpenGL Cocoa])
@ -3521,42 +3516,6 @@ EFL_LIB_END_OPTIONAL([Ecore_FB])
#### End of Ecore_FB
#### Ecore_Psl1ght
EFL_LIB_START_OPTIONAL([Ecore_Psl1ght], [test "${have_ps3}" = "yes"])
### Additional options to configure
### Default values
### Checks for programs
### Checks for libraries
EFL_PLATFORM_DEPEND([ECORE_PSL1GHT], [escape])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [ecore-input])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [ecore])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [eo])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [efl])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [eina])
EFL_ADD_LIBS([ECORE_PSL1GHT], [-lio -lsysutil -lgem -lcamera -lspurs])
### Checks for header files
### Checks for types
### Checks for structures
### Checks for compiler characteristics
### Checks for linker characteristics
### Checks for library functions
EFL_LIB_END_OPTIONAL([Ecore_Psl1ght])
#### End of Ecore_Psl1ght
#### Ecore_SDL
EFL_LIB_START_OPTIONAL([Ecore_SDL], [test "${want_sdl}" = "yes"])
@ -4492,7 +4451,6 @@ ECORE_EVAS_MODULE([drm], [${want_drm}],
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_drm}], [ecore-drm2])])
ECORE_EVAS_MODULE([gl-drm], [${want_gl_drm}],
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_gl_drm}], [ecore-drm2])])
ECORE_EVAS_MODULE([psl1ght], [${have_ps3}])
ECORE_EVAS_MODULE([opengl-cocoa], [${want_ecore_evas_gl_cocoa}])
@ -5389,7 +5347,6 @@ EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [elocation])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_x11_any}], [ecore_x])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_fb}], [ecore_fb])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${have_ps3}], [ecore_psl1ght])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_sdl}], [ecore_sdl])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_ecore_evas_gl_cocoa}], [ecore_cocoa])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${build_ecore_evas_win32}], [ecore_win32])
@ -5409,7 +5366,6 @@ EFL_ADD_LIBS([ELEMENTARY], [-lm])
ELM_CHECK_BACKEND([X], [${want_x11_any}])
ELM_CHECK_BACKEND([FB], [${want_fb}])
ELM_CHECK_BACKEND([PSL1GHT], [${have_ps3}])
ELM_CHECK_BACKEND([SDL], [${want_sdl}])
ELM_CHECK_BACKEND([Cocoa], [${want_ecore_evas_gl_cocoa}])
ELM_CHECK_BACKEND([Win32], [${build_ecore_evas_win32}])
@ -5689,7 +5645,6 @@ pc/evas-eglfs.pc
pc/evas-opengl-x11.pc
pc/evas-opengl-sdl.pc
pc/evas-opengl-cocoa.pc
pc/evas-psl1ght.pc
pc/evas-software-buffer.pc
pc/evas-software-x11.pc
pc/evas-software-gdi.pc
@ -5710,7 +5665,6 @@ pc/ecore-input-evas.pc
pc/ecore-cocoa.pc
pc/ecore-drm.pc
pc/ecore-fb.pc
pc/ecore-psl1ght.pc
pc/ecore-sdl.pc
pc/ecore-wayland.pc
pc/ecore-wl2.pc
@ -5897,8 +5851,6 @@ echo "IVI-Shell.......: $want_wayland_ivi_shell"
echo "Ecore_Buffer....: $want_ecore_buffer (${features_ecore_buffer})"
if test "${have_linux}" = "yes"; then
echo "Ecore_FB........: $want_fb (${features_ecore_fb})"
elif test "${have_ps3}" = "yes"; then
echo "Ecore_PSL1GHT...: $have_ps3"
elif test "${have_darwin}" = "yes"; then
echo "Ecore_Cocoa.....: $efl_lib_optional_ecore_cocoa"
elif test "${have_windows}" = "yes"; then

2
pc/.gitignore vendored

@ -11,7 +11,6 @@
/ecore-input-evas.pc
/ecore-input.pc
/ecore-ipc.pc
/ecore-psl1ght.pc
/ecore-sdl.pc
/ecore-wayland.pc
/ecore-wl2.pc
@ -49,7 +48,6 @@
/evas-opengl-cocoa.pc
/evas-opengl-sdl.pc
/evas-opengl-x11.pc
/evas-psl1ght.pc
/evas-software-buffer.pc
/evas-software-ddraw.pc
/evas-software-gdi.pc

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: ecore-psl1ght
Description: E core library, PSL1GHT module
Requires.private: @requirements_pc_ecore_psl1ght@
Version: @VERSION@
Libs: -L${libdir} -lecore_psl1ght
Libs.private: @requirements_libs_ecore_psl1ght@
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/ecore-psl1ght-@VMAJ@

@ -1,3 +0,0 @@
Name: evas-psl1ght
Description: Evas PSL1GHT engine
Version: @VERSION@

@ -48,7 +48,6 @@ include Makefile_Ecore_Input.am
include Makefile_Ecore_Input_Evas.am
include Makefile_Ecore_Cocoa.am
include Makefile_Ecore_FB.am
include Makefile_Ecore_Psl1ght.am
include Makefile_Ecore_SDL.am
include Makefile_Ecore_Wayland.am
include Makefile_Ecore_Wl2.am

@ -144,31 +144,6 @@ modules_ecore_evas_engines_fb_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_ecore_evas_engines_fb_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if BUILD_ECORE_EVAS_PSL1GHT
PSL1GHTSOURCES = modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
ecoreevasenginepsl1ghtpkgdir = $(libdir)/ecore_evas/engines/psl1ght/$(MODULE_ARCH)
ecoreevasenginepsl1ghtpkg_LTLIBRARIES = modules/ecore_evas/engines/psl1ght/module.la
# Workaround for broken parallel install support in automake (relink issue)
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
install_ecoreevasenginepsl1ghtpkgLTLIBRARIES = install-ecoreevasenginepsl1ghtpkgLTLIBRARIES
$(install_ecoreevasenginepsl1ghtpkgLTLIBRARIES): install-libLTLIBRARIES
modules_ecore_evas_engines_psl1ght_module_la_SOURCES = $(PSL1GHTSOURCES)
modules_ecore_evas_engines_psl1ght_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
@ECORE_EVAS_CFLAGS@ \
@ECORE_PSL1GHT_CFLAGS@ \
-I$(top_srcdir)/src/modules/evas/engines/psl1ght
modules_ecore_evas_engines_psl1ght_module_la_LIBADD = \
@USE_ECORE_EVAS_LIBS@ \
@USE_ECORE_PSL1GHT_LIBS@
modules_ecore_evas_engines_psl1ght_module_la_DEPENDENCIES = \
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
@USE_ECORE_PSL1GHT_INTERNAL_LIBS@
modules_ecore_evas_engines_psl1ght_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_ecore_evas_engines_psl1ght_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if BUILD_ECORE_EVAS_WAYLAND
WAYLANDSOURCES = \
modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c \

@ -1,29 +0,0 @@
if HAVE_PS3
### Library
lib_LTLIBRARIES += lib/ecore_psl1ght/libecore_psl1ght.la
installed_ecorepsl1ghtmainheadersdir = $(includedir)/ecore-psl1ght-@VMAJ@
dist_installed_ecorepsl1ghtmainheaders_DATA = \
lib/ecore_psl1ght/Ecore_Psl1ght.h
lib_ecore_psl1ght_libecore_psl1ght_la_SOURCES = \
lib/ecore_psl1ght/ecore_psl1ght.c \
lib/ecore_psl1ght/moveutil.c \
lib/ecore_psl1ght/moveutil.h \
lib/ecore_psl1ght/spursutil.c \
lib/ecore_psl1ght/spursutil.h \
lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h \
lib/ecore_psl1ght/ecore_psl1ght_private.h
lib_ecore_psl1ght_libecore_psl1ght_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_PSL1GHT_CFLAGS@
lib_ecore_psl1ght_libecore_psl1ght_la_LIBADD = @ECORE_PSL1GHT_LIBS@
lib_ecore_psl1ght_libecore_psl1ght_la_DEPENDENCIES = @ECORE_PSL1GHT_INTERNAL_LIBS@
lib_ecore_psl1ght_libecore_psl1ght_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
endif
# TODO: what are they used for?
EXTRA_DIST2 += \
lib/ecore_psl1ght/gemutil.c \
lib/ecore_psl1ght/gemutil.h

@ -1043,41 +1043,6 @@ modules_evas_engines_gl_x11_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
endif
if BUILD_ENGINE_PSL1GHT
PSL1GHT_SOURCES = \
modules/evas/engines/psl1ght/evas_engine.c \
modules/evas/engines/psl1ght/rsxutil.c \
modules/evas/engines/psl1ght/evas_engine.h \
modules/evas/engines/psl1ght/rsxutil.h \
modules/evas/engines/psl1ght/Evas_Engine_PSL1GHT.h
if EVAS_STATIC_BUILD_PSL1GHT
lib_evas_libevas_la_SOURCES += $(PSL1GHT_SOURCES)
lib_evas_libevas_la_CPPFLAGS += @evas_engine_psl1ght_cflags@
lib_evas_libevas_la_LIBADD += @evas_engine_psl1ght_libs@
else
enginepsl1ghtpkgdir = $(libdir)/evas/modules/engines/psl1ght/$(MODULE_ARCH)
enginepsl1ghtpkg_LTLIBRARIES = modules/evas/engines/psl1ght/module.la
# Workaround for broken parallel install support in automake (relink issue)
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
install_enginepsl1ghtpkgLTLIBRARIES = install-enginepsl1ghtpkgLTLIBRARIES
$(install_enginepsl1ghtpkgLTLIBRARIES): install-libLTLIBRARIES
modules_evas_engines_psl1ght_module_la_SOURCES = $(PSL1GHT_SOURCES)
modules_evas_engines_psl1ght_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/include \
-I$(top_srcdir)/src/lib/evas/cserve2 \
@EVAS_CFLAGS@ \
@evas_engine_psl1ght_cflags@
modules_evas_engines_psl1ght_module_la_LIBADD = \
@USE_EVAS_LIBS@ \
@evas_engine_psl1ght_libs@
modules_evas_engines_psl1ght_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
modules_evas_engines_psl1ght_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_evas_engines_psl1ght_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
endif
if BUILD_ENGINE_SOFTWARE_DDRAW
SOFTWARE_DDRAW_SOURCES = \
modules/evas/engines/software_ddraw/evas_engine.c \

@ -2020,7 +2020,7 @@ EAPI Ecore_Evas *ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent,
*
* The psl1ght backend is used for the PS3 GameOS.
*/
EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h);
EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h) EINA_DEPRECATED;
/* generic manipulation calls */

@ -555,11 +555,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_PSL1GHT:
#ifdef BUILD_ECORE_EVAS_PSL1GHT
return EINA_TRUE;
#else
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_WAYLAND_SHM:
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
return EINA_TRUE;
@ -897,17 +893,9 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c
}
static Ecore_Evas *
_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED, const char *extra_options EINA_UNUSED)
{
Ecore_Evas *ee;
char *name = NULL;
_ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
ee = ecore_evas_psl1ght_new(name, w, h);
free(name);
if (ee) ecore_evas_move(ee, x, y);
return ee;
return NULL;
}
static Ecore_Evas *

@ -288,12 +288,6 @@ _ecore_evas_available_engines_get(void)
{
#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
ADDENG("opengl_cocoa");
#endif
}
else if (!strcmp(name, "psl1ght"))
{
#ifdef BUILD_ECORE_EVAS_PSL1GHT
ADDENG("psl1ght");
#endif
}
else if (!strcmp(name, "sdl"))

@ -1,124 +0,0 @@
#ifndef _ECORE_PSL1GHT_H
#define _ECORE_PSL1GHT_H
#ifdef EAPI
# undef EAPI
#endif
#ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
#else
# define EAPI
#endif
/**
* @file
* @brief Ecore PSL1GHT system functions.
*/
#ifdef __cplusplus
extern "C" {
#endif
EAPI extern int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS;
EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS;
EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS;
EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE;
EAPI extern int ECORE_PSL1GHT_EVENT_QUIT;
typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers;
struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */
{
unsigned int timestamp;
unsigned int modifiers;
int shift_changed : 1;
int shift : 1;
int alt_changed : 1;
int alt : 1;
int ctrl_changed : 1;
int ctrl : 1;
int win_changed : 1;
int win : 1;
int num_lock_changed : 1;
int num_lock : 1;
int caps_lock_changed : 1;
int caps_lock : 1;
int scroll_lock_changed : 1;
int scroll_lock : 1;
};
typedef struct _Ecore_Psl1ght_Event_Key_Down Ecore_Psl1ght_Event_Key_Down;
struct _Ecore_Psl1ght_Event_Key_Down /** PSL1GHT Key Down event */
{
const char *keyname; /**< The name of the key that was pressed */
const char *keycompose; /**< The UTF-8 string conversion if any */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Key_Up Ecore_Psl1ght_Event_Key_Up;
struct _Ecore_Psl1ght_Event_Key_Up /** PSL1GHT Key Up event */
{
const char *keyname; /**< The name of the key that was released */
const char *keycompose; /**< The UTF-8 string conversion if any */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Down Ecore_Psl1ght_Event_Mouse_Button_Down;
struct _Ecore_Psl1ght_Event_Mouse_Button_Down /** PSL1GHT Mouse Down event */
{
int button; /**< Mouse button that was pressed (1 - 32) */
int x; /**< Mouse co-ordinates when mouse button was pressed */
int y; /**< Mouse co-ordinates when mouse button was pressed */
int double_click : 1; /**< Set if click was a double click */
int triple_click : 1; /**< Set if click was a triple click */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Up Ecore_Psl1ght_Event_Mouse_Button_Up;
struct _Ecore_Psl1ght_Event_Mouse_Button_Up /** PSL1GHT Mouse Up event */
{
int button; /**< Mouse button that was released (1 - 32) */
int x; /**< Mouse co-ordinates when mouse button was raised */
int y; /**< Mouse co-ordinates when mouse button was raised */
int double_click : 1; /**< Set if click was a double click */
int triple_click : 1; /**< Set if click was a triple click */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Move Ecore_Psl1ght_Event_Mouse_Move;
struct _Ecore_Psl1ght_Event_Mouse_Move /** PSL1GHT Mouse Move event */
{
int x; /**< Mouse co-ordinates where the mouse cursor moved to */
int y; /**< Mouse co-ordinates where the mouse cursor moved to */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Wheel Ecore_Psl1ght_Event_Mouse_Wheel;
struct _Ecore_Psl1ght_Event_Mouse_Wheel /** PSL1GHT Mouse Wheel event */
{
int x, y;
int direction; /* 0 = vertical, 1 = horizontal */
int wheel; /* value 1 (left/up), -1 (right/down) */
unsigned int time;
};
EAPI int ecore_psl1ght_init(const char *name);
EAPI int ecore_psl1ght_shutdown(void);
EAPI void ecore_psl1ght_resolution_set(int width, int height);
EAPI void ecore_psl1ght_poll_events(void);
EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h);
EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h);
#ifdef __cplusplus
}
#endif
#undef EAPI
#define EAPI
#endif

@ -1,78 +0,0 @@
#ifndef ECORE_PSL1GHT_KEYS_H__
# define ECORE_PSL1GHT_KEYS_H__
struct _ecore_psl1ght_keys_s
{
int code;
const char *name;
const char *compose;
};
static const struct _ecore_psl1ght_keys_s keystable[] =
{
{ KB_RAWKEY_NO_EVENT, "0x00", "" },
{ KB_RAWKEY_BS, "BackSpace", "\010" },
{ KB_RAWKEY_TAB, "Tab", "\011" },
{ KB_RAWKEY_ENTER, "Return", "\015" },
{ KB_RAWKEY_PAUSE, "Pause", "Pause" },
{ KB_RAWKEY_ESCAPE, "Escape", "\033" },
{ KB_RAWKEY_SPACE, "space", " " },
/* Skip uppercase letters */
{ KB_RAWKEY_LEFT_BRACKET_101, "bracketleft", "[" },
{ KB_RAWKEY_BACKSLASH_101, "backslash", "\\" },
{ KB_RAWKEY_RIGHT_BRACKET_101, "bracketright", "]" },
{ KB_RAWKEY_ACCENT_CIRCONFLEX_106, "asciicircumm", "^" },
{ KB_RAWKEY_DELETE, "Delete", "\177" },
/* End of ASCII mapped keysyms */
/* Numeric keypad */
{ KB_RAWKEY_KPAD_0, "KP0", "0" },
{ KB_RAWKEY_KPAD_1, "KP1", "1" },
{ KB_RAWKEY_KPAD_2, "KP2", "2" },
{ KB_RAWKEY_KPAD_3, "KP3", "3" },
{ KB_RAWKEY_KPAD_4, "KP4", "4" },
{ KB_RAWKEY_KPAD_5, "KP5", "5" },
{ KB_RAWKEY_KPAD_6, "KP6", "6" },
{ KB_RAWKEY_KPAD_7, "KP7", "7" },
{ KB_RAWKEY_KPAD_8, "KP8", "8" },
{ KB_RAWKEY_KPAD_9, "KP9", "9" },
{ KB_RAWKEY_KPAD_PERIOD, "period", "." },
{ KB_RAWKEY_KPAD_SLASH, "KP_Divide", "/" },
{ KB_RAWKEY_KPAD_ASTERISK, "KP_Multiply", "*" },
{ KB_RAWKEY_KPAD_MINUS, "KP_Minus", "-" },
{ KB_RAWKEY_KPAD_PLUS, "KP_Plus", "+" },
{ KB_RAWKEY_KPAD_ENTER, "KP_Enter", "\015" },
/* Arrows + Home/End pad */
{ KB_RAWKEY_UP_ARROW, "Up", "Up" },
{ KB_RAWKEY_DOWN_ARROW, "Down", "Down" },
{ KB_RAWKEY_RIGHT_ARROW, "Right", "Right" },
{ KB_RAWKEY_LEFT_ARROW, "Left", "Left" },
{ KB_RAWKEY_INSERT, "Insert", "Insert" },
{ KB_RAWKEY_HOME, "Home", "Home" },
{ KB_RAWKEY_END, "End", "End" },
{ KB_RAWKEY_PAGE_UP, "Page_Up", "Page_Up" },
{ KB_RAWKEY_PAGE_DOWN, "Page_Down", "Page_Down" },
/* Function keys */
{ KB_RAWKEY_F1, "F1", "F1" },
{ KB_RAWKEY_F2, "F2", "F2" },
{ KB_RAWKEY_F3, "F3", "F3" },
{ KB_RAWKEY_F4, "F4", "F4" },
{ KB_RAWKEY_F5, "F5", "F5" },
{ KB_RAWKEY_F6, "F6", "F6" },
{ KB_RAWKEY_F7, "F7", "F7" },
{ KB_RAWKEY_F8, "F8", "F8" },
{ KB_RAWKEY_F9, "F9", "F9" },
{ KB_RAWKEY_F10, "F10", "F10" },
{ KB_RAWKEY_F11, "F11", "F11" },
{ KB_RAWKEY_F12, "F12", "F12" },
/* Key state modifier keys */
{ KB_RAWKEY_KPAD_NUMLOCK, "Num_Lock", "Num_Lock" },
{ KB_RAWKEY_CAPS_LOCK, "Caps_Lock", "Caps_Lock" },
{ KB_RAWKEY_SCROLL_LOCK, "Scroll_Lock", "Scroll_Lock" },
};
#endif /* ECORE_PSL1GHT_KEYS_H__ */

@ -1,862 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sysutil/video.h>
#include <sysutil/sysutil.h>
#include <sysmodule/sysmodule.h>
#include <io/pad.h>
#include <io/mouse.h>
#include <io/kb.h>
#include <io/camera.h>
#include <io/move.h>
#include <sys/process.h>
#include "moveutil.h"
#include "Eina.h"
#include "Ecore_Psl1ght.h"
#include "Ecore_Input.h"
#include "Ecore.h"
#include "ecore_psl1ght_private.h"
#include "ecore_private.h"
#include "Ecore_Psl1ght_Keys.h"
/* Allocate 1MB stack to avoid overflows */
SYS_PROCESS_PARAM(1001, 0x100000);
int _ecore_psl1ght_log_dom = -1;
EAPI int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0;
EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0;
EAPI int ECORE_PSL1GHT_EVENT_QUIT = 0;
static int _ecore_psl1ght_init_count = 0;
static int window_width = 0;
static int window_height = 0;
/* Mouse support */
static int mouse_connected = FALSE;
static u8 mouse_buttons = 0;
static int mouse_x = 0;
static int mouse_y = 0;
/* Keyboard support */
static int keyboard_connected = FALSE;
static KbLed keyboard_leds = {{0}};
static KbMkey keyboard_mods = {{0}};
static u16 keyboard_old_key = 0;
/* Pad support */
static padData pad_data;
static padData old_pad_data = {0};
static int pad_old_x = 0;
static int pad_old_o = 0;
/* Move support */
static int move_connected = FALSE;
static moveContext *move_context = NULL;
u16 move_buttons = 0;
static void xmb_event_handler(u64 status, u64 param, void *user_data);
/**
* @defgroup Ecore_Psl1ght_Library_Group PSL1GHT Library Functions
* @ingroup Ecore
*
* Functions used to set up and shut down the Ecore_Psl1ght functions.
*/
/**
* Sets up the Ecore_Psl1ght library.
* @param name device target name
* @return @c 0 on failure. Otherwise, the number of times the library has
* been initialised without being shut down.
* @ingroup Ecore_PSL1GHT_Library_Group
*/
EAPI int
ecore_psl1ght_init(const char *name EINA_UNUSED)
{
videoState state;
videoResolution resolution;
int ret, camera_loaded, gem_loaded;
if (++_ecore_psl1ght_init_count != 1)
return _ecore_psl1ght_init_count;
_ecore_psl1ght_log_dom = eina_log_domain_register
("ecore_psl1ght", ECORE_PSL1GHT_DEFAULT_LOG_COLOR);
if (_ecore_psl1ght_log_dom < 0)
{
EINA_LOG_ERR("Impossible to create a log domain for the Ecore PSL1GHT module.");
return --_ecore_psl1ght_init_count;
}
if (!ecore_event_init())
{
eina_log_domain_unregister(_ecore_psl1ght_log_dom);
_ecore_psl1ght_log_dom = -1;
return --_ecore_psl1ght_init_count;
}
if (videoGetState (0, 0, &state) == 0 &&
videoGetResolution (state.displayMode.resolution, &resolution) == 0)
{
ecore_psl1ght_resolution_set (resolution.width, resolution.height);
}
else
{
ecore_event_shutdown();
eina_log_domain_unregister(_ecore_psl1ght_log_dom);
_ecore_psl1ght_log_dom = -1;
return --_ecore_psl1ght_init_count;
}
/* Pad support */
ioPadInit (7);
/* Mouse support */
ioMouseInit(2);
mouse_buttons = 0;
mouse_x = 0;
mouse_y = 0;
/* Keyboard support */
ioKbInit(2);
keyboard_leds._KbLedU.leds = 0;
keyboard_mods._KbMkeyU.mkeys = 0;
/* Initialize Move */
move_context = NULL;
move_buttons = 0;
camera_loaded = !sysModuleIsLoaded (SYSMODULE_CAMERA);
if (!camera_loaded)
ret = sysModuleLoad (SYSMODULE_CAMERA);
else
ret = 0;
if (ret == 0)
{
gem_loaded = !sysModuleIsLoaded (SYSMODULE_GEM);
if (!gem_loaded)
ret = sysModuleLoad (SYSMODULE_GEM);
if (ret == 0)
{
move_context = initMove ();
}
else {
if (gem_loaded)
sysModuleUnload (SYSMODULE_CAMERA);
}
}
sysUtilRegisterCallback (SYSUTIL_EVENT_SLOT0, xmb_event_handler, NULL);
if (ECORE_PSL1GHT_EVENT_GOT_FOCUS == 0)
{
ECORE_PSL1GHT_EVENT_GOT_FOCUS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_QUIT = ecore_event_type_new();
}
mouse_x = 0;
mouse_y = 0;
return _ecore_psl1ght_init_count;
}
/**
* Shuts down the Ecore_Psl1ght library.
* @return @c The number of times the system has been initialised without
* being shut down.
* @ingroup Ecore_PSL1GHT_Library_Group
*/
EAPI int
ecore_psl1ght_shutdown(void)
{
if (--_ecore_psl1ght_init_count != 0)
return _ecore_psl1ght_init_count;
ecore_event_shutdown();
eina_log_domain_unregister(_ecore_psl1ght_log_dom);
_ecore_psl1ght_log_dom = -1;
ecore_event_type_flush(ECORE_PSL1GHT_EVENT_GOT_FOCUS,
ECORE_PSL1GHT_EVENT_LOST_FOCUS,
ECORE_PSL1GHT_EVENT_EXPOSE,
ECORE_PSL1GHT_EVENT_KEY_MODIFIERS,
ECORE_PSL1GHT_EVENT_QUIT);
ioPadEnd();
ioMouseEnd();
ioKbEnd();
if (move_context)
{
endMove (move_context);
move_context = NULL;
sysModuleUnload (SYSMODULE_CAMERA);
sysModuleUnload (SYSMODULE_GEM);
}
sysUtilUnregisterCallback(SYSUTIL_EVENT_SLOT0);
return _ecore_psl1ght_init_count;
}
static unsigned int
_ecore_psl1ght_get_time(void)
{
return (unsigned int)((unsigned long long)
(ecore_time_get() * 1000.0) & 0xffffffff);
}
static unsigned int
_ecore_psl1ght_get_modifiers(void)
{
unsigned int modifiers = 0;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_shift ||
keyboard_mods._KbMkeyU._KbMkeyS.l_shift)
modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl ||
keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl)
modifiers |= ECORE_EVENT_MODIFIER_CTRL;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_alt ||
keyboard_mods._KbMkeyU._KbMkeyS.l_alt)
modifiers |= ECORE_EVENT_MODIFIER_ALT;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_win ||
keyboard_mods._KbMkeyU._KbMkeyS.l_win)
modifiers |= ECORE_EVENT_MODIFIER_WIN;
if (keyboard_leds._KbLedU._KbLedS.num_lock)
modifiers |= ECORE_EVENT_LOCK_NUM;
if (keyboard_leds._KbLedU._KbLedS.caps_lock)
modifiers |= ECORE_EVENT_LOCK_CAPS;
if (keyboard_leds._KbLedU._KbLedS.scroll_lock)
modifiers |= ECORE_EVENT_LOCK_SCROLL;
return modifiers;
}
static void
_ecore_psl1ght_key_modifiers(KbMkey *mods, KbLed *leds)
{
Ecore_Psl1ght_Event_Key_Modifiers *ev;
Eina_Bool emit = EINA_FALSE;
ev = malloc(sizeof(Ecore_Psl1ght_Event_Key_Modifiers));
if (!ev) return;
if (mods->_KbMkeyU._KbMkeyS.l_shift !=
keyboard_mods._KbMkeyU._KbMkeyS.l_shift ||
mods->_KbMkeyU._KbMkeyS.r_shift !=
keyboard_mods._KbMkeyU._KbMkeyS.r_shift)
{
emit = EINA_TRUE;
ev->shift_changed = EINA_TRUE;
ev->shift = mods->_KbMkeyU._KbMkeyS.r_shift |
mods->_KbMkeyU._KbMkeyS.l_shift;
}
if (mods->_KbMkeyU._KbMkeyS.l_ctrl !=
keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl ||
mods->_KbMkeyU._KbMkeyS.r_ctrl !=
keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl)
{
emit = EINA_TRUE;
ev->ctrl_changed = EINA_TRUE;
ev->ctrl = mods->_KbMkeyU._KbMkeyS.r_ctrl |
mods->_KbMkeyU._KbMkeyS.l_ctrl;
}
if (mods->_KbMkeyU._KbMkeyS.l_alt !=
keyboard_mods._KbMkeyU._KbMkeyS.l_alt ||
mods->_KbMkeyU._KbMkeyS.r_alt !=
keyboard_mods._KbMkeyU._KbMkeyS.r_alt)
{
emit = EINA_TRUE;
ev->alt_changed = EINA_TRUE;
ev->alt = mods->_KbMkeyU._KbMkeyS.r_alt |
mods->_KbMkeyU._KbMkeyS.l_alt;
}
if (mods->_KbMkeyU._KbMkeyS.l_win !=
keyboard_mods._KbMkeyU._KbMkeyS.l_win ||
mods->_KbMkeyU._KbMkeyS.r_win !=
keyboard_mods._KbMkeyU._KbMkeyS.r_win)
{
emit = EINA_TRUE;
ev->win_changed = EINA_TRUE;
ev->win = mods->_KbMkeyU._KbMkeyS.r_win |
mods->_KbMkeyU._KbMkeyS.l_win;
}
keyboard_mods = *mods;
if (leds->_KbLedU._KbLedS.num_lock !=
keyboard_leds._KbLedU._KbLedS.num_lock)
{
emit = EINA_TRUE;
ev->num_lock_changed = EINA_TRUE;
ev->num_lock = leds->_KbLedU._KbLedS.num_lock;
}
if (leds->_KbLedU._KbLedS.caps_lock !=
keyboard_leds._KbLedU._KbLedS.caps_lock)
{
emit = EINA_TRUE;
ev->caps_lock_changed = EINA_TRUE;
ev->caps_lock = leds->_KbLedU._KbLedS.caps_lock;
}
if (leds->_KbLedU._KbLedS.scroll_lock !=
keyboard_leds._KbLedU._KbLedS.scroll_lock)
{
emit = EINA_TRUE;
ev->scroll_lock_changed = EINA_TRUE;
ev->scroll_lock = leds->_KbLedU._KbLedS.scroll_lock;
}
keyboard_leds = *leds;
if (emit)
{
ev->timestamp = _ecore_psl1ght_get_time ();
ev->modifiers = _ecore_psl1ght_get_modifiers();
ecore_event_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, ev, NULL, NULL);
}
else
{
free(ev);
}
}
static void
unicodeToUtf8(u16 w, char *utf8buf)
{
unsigned char *utf8s = (unsigned char *)utf8buf;
if ( w < 0x0080 )
{
utf8s[0] = ( unsigned char )w;
utf8s[1] = 0;
}
else if ( w < 0x0800 )
{
utf8s[0] = 0xc0 | ((w) >> 6);
utf8s[1] = 0x80 | ((w) & 0x3f);
utf8s[2] = 0;
}
else {
utf8s[0] = 0xe0 | ((w) >> 12);
utf8s[1] = 0x80 | (((w) >> 6) & 0x3f);
utf8s[2] = 0x80 | ((w) & 0x3f);
utf8s[3] = 0;
}
}
static Ecore_Event_Key *
_ecore_psl1ght_event_key(u16 key)
{
Ecore_Event_Key *ev;
char utf8[4];
u16 utf16;
unsigned int i;
ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return NULL;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->window = 0;
ev->event_window = 0;
ev->modifiers = _ecore_psl1ght_get_modifiers();
key &= ~KB_KEYPAD;
for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i)
if (keystable[i].code == key)
{
ev->keyname = keystable[i].name;
ev->key = keystable[i].name;
ev->string = keystable[i].compose;
ev->compose = keystable[i].compose;
return ev;
}
utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key);
unicodeToUtf8(utf16, utf8);
ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8);
return ev;
}
static void
_ecore_psl1ght_mouse_move(s32 x_axis, s32 y_axis)
{
Ecore_Event_Mouse_Move *ev;
ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!ev) return;
mouse_x += x_axis;
mouse_y += y_axis;
if (mouse_x < 0) mouse_x = 0;
if (mouse_y < 0) mouse_y = 0;
if (mouse_x > window_width) mouse_x = window_width;
if (mouse_y > window_height) mouse_y = window_height;
ev->window = 0;
ev->root_window = 0;
ev->event_window = 0;
ev->same_screen = 0;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->modifiers = _ecore_psl1ght_get_modifiers ();
ev->x = ev->root.x = mouse_x;
ev->y = ev->root.x = mouse_y;
ev->multi.device = 0;
ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
ev->multi.pressure = ev->multi.angle = 0;
ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
}
static void
_ecore_psl1ght_mouse_button(int button, int pressed)
{
Ecore_Event_Mouse_Button *ev;
static unsigned int previous_timestamp = 0;
ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
if (!ev) return;
ev->window = 0;
ev->root_window = 0;
ev->event_window = 0;
ev->same_screen = 0;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->modifiers = _ecore_psl1ght_get_modifiers ();
ev->buttons = button;
if (ev->timestamp - previous_timestamp <= 500)
ev->double_click = 1;
ev->triple_click = 0;
previous_timestamp = ev->timestamp;
ev->x = ev->root.x = mouse_x;
ev->y = ev->root.y = mouse_y;
ev->multi.device = 0;
ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
ev->multi.pressure = ev->multi.angle = 0;
ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
if (pressed)
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
else
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
}
static void
_ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt)
{
Ecore_Event_Mouse_Wheel *ev;
ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
if (!ev) return;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->window = 0;
ev->event_window = 0;
ev->modifiers = _ecore_psl1ght_get_modifiers ();
ev->direction = 0;
ev->z = wheel;
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
}
static void
_ecore_psl1ght_pad_button (const char *name, int pressed)
{
Ecore_Event_Key *ev = NULL;
ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->window = 0;
ev->event_window = 0;
ev->modifiers = 0;
ev->keyname = name;
ev->key = name;
ev->string = "";
ev->compose = "";
if (pressed)
ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
else
ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
}
#define PAD_STICK_DEADZONE 0x20
static void
_ecore_psl1ght_poll_joypad(void)
{
padInfo padinfo;
int i;
/**/
/* Check mouse events */
ioPadGetInfo (&padinfo);
for (i = 0; i < 4; i++) /* Ignore the move */
{
if (padinfo.status[i])
{
int analog_h, analog_v;
if (ioPadGetData (i, &pad_data) != 0)
continue;
analog_h = pad_data.ANA_L_H - 0x80;
analog_v = pad_data.ANA_L_V - 0x80;
if (analog_h > PAD_STICK_DEADZONE)
analog_h -= PAD_STICK_DEADZONE;
else if (analog_h < -PAD_STICK_DEADZONE)
analog_h += PAD_STICK_DEADZONE;
else
analog_h = 0;
analog_h /= 10;
if (analog_v > PAD_STICK_DEADZONE)
analog_v -= PAD_STICK_DEADZONE;
else if (analog_v < -PAD_STICK_DEADZONE)
analog_v += PAD_STICK_DEADZONE;
else
analog_v = 0;
analog_v /= 10;
if (analog_h != 0 || analog_v != 0)
_ecore_psl1ght_mouse_move (analog_h, analog_v);
if (old_pad_data.BTN_CROSS ^ pad_data.BTN_CROSS) {
_ecore_psl1ght_pad_button ("Cross", pad_data.BTN_CROSS);
_ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS);
}
if (old_pad_data.BTN_CIRCLE ^ pad_data.BTN_CIRCLE) {
_ecore_psl1ght_pad_button ("Circle", pad_data.BTN_CIRCLE);
_ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE);
}
if (old_pad_data.BTN_SQUARE ^ pad_data.BTN_SQUARE)
_ecore_psl1ght_pad_button ("Square", pad_data.BTN_SQUARE);
if (old_pad_data.BTN_TRIANGLE ^ pad_data.BTN_TRIANGLE)
_ecore_psl1ght_pad_button ("Triangle", pad_data.BTN_TRIANGLE);
if (old_pad_data.BTN_UP ^ pad_data.BTN_UP)
_ecore_psl1ght_pad_button ("Up", pad_data.BTN_UP);
if (old_pad_data.BTN_DOWN ^ pad_data.BTN_DOWN)
_ecore_psl1ght_pad_button ("Down", pad_data.BTN_DOWN);
if (old_pad_data.BTN_LEFT ^ pad_data.BTN_LEFT)
_ecore_psl1ght_pad_button ("Left", pad_data.BTN_LEFT);
if (old_pad_data.BTN_RIGHT ^ pad_data.BTN_RIGHT)
_ecore_psl1ght_pad_button ("Right", pad_data.BTN_RIGHT);
if (old_pad_data.BTN_L1 ^ pad_data.BTN_L1)
_ecore_psl1ght_pad_button ("L1", pad_data.BTN_L1);
if (old_pad_data.BTN_L2 ^ pad_data.BTN_L2)
_ecore_psl1ght_pad_button ("L2", pad_data.BTN_L2);
if (old_pad_data.BTN_L3 ^ pad_data.BTN_L3)
_ecore_psl1ght_pad_button ("L3", pad_data.BTN_L3);
if (old_pad_data.BTN_R1 ^ pad_data.BTN_R1)
_ecore_psl1ght_pad_button ("R1", pad_data.BTN_R1);
if (old_pad_data.BTN_R2 ^ pad_data.BTN_R2)
_ecore_psl1ght_pad_button ("R2", pad_data.BTN_R2);
if (old_pad_data.BTN_R3 ^ pad_data.BTN_R3)
_ecore_psl1ght_pad_button ("R3", pad_data.BTN_R3);
if (old_pad_data.BTN_START ^ pad_data.BTN_START)
_ecore_psl1ght_pad_button ("Start", pad_data.BTN_START);
if (old_pad_data.BTN_SELECT ^ pad_data.BTN_SELECT)
_ecore_psl1ght_pad_button ("Select", pad_data.BTN_SELECT);
old_pad_data = pad_data;
}
}
}
static void
_ecore_psl1ght_poll_mouse(void)
{
mouseInfo mouseinfo;
u32 i;
/**/
/* Check mouse events */
ioMouseGetInfo(&mouseinfo);
if (mouseinfo.status[0] == 1 && !mouse_connected) // Connected
{
mouse_connected = TRUE;
mouse_buttons = 0;
// Old events in the queue are discarded
ioMouseClearBuf(0);
}
else if (mouseinfo.status[0] != 1 && mouse_connected) // Disconnected
{
mouse_connected = FALSE;
mouse_buttons = 0;
}
if (mouse_connected)
{
mouseDataList datalist;
ioMouseGetDataList(0, &datalist);
for (i = 0; i < datalist.count; i++)
{
u8 old_left = mouse_buttons & 1;
u8 new_left = datalist.list[i].buttons & 1;
u8 old_right = mouse_buttons & 2;
u8 new_right = datalist.list[i].buttons & 2;
u8 old_middle = mouse_buttons & 4;
u8 new_middle = datalist.list[i].buttons & 4;
if (datalist.list[i].x_axis != 0 ||
datalist.list[i].y_axis != 0)
_ecore_psl1ght_mouse_move (datalist.list[i].x_axis,
datalist.list[i].y_axis);
if (old_left != new_left)
_ecore_psl1ght_mouse_button (1, new_left);
if (old_middle != new_middle)
_ecore_psl1ght_mouse_button (2, new_middle);
if (old_right != new_right)
_ecore_psl1ght_mouse_button (3, new_right);
if (datalist.list[i].wheel != 0)
_ecore_psl1ght_mouse_wheel (datalist.list[i].wheel,
datalist.list[i].tilt);
mouse_buttons = datalist.list[i].buttons;
}
}
}
static void
_ecore_psl1ght_poll_move(void)
{
u16 new_buttons;
static int t_pressed = 0;
static int calibrated = 0;
static float prev_x = 0;
static float prev_y = 0;
static int gyro = 0;
float x, y, z;
/* Check move events */
processMove (move_context);
new_buttons = move_context->state.paddata.buttons & (~move_buttons);
move_buttons = move_context->state.paddata.buttons;
moveGet3DPosition (move_context, &x, &y, &z);
//printf ("Move 3D position is : %f, %f, %f\n", x,y,z);
switch (new_buttons) {
case 1:
gyro = !gyro;
break;
case 4:
// Move button
//printf ("Calibrating\n");
gemCalibrate (0);
calibrated = 1;
break;
case 8:
// start button
_ecore_psl1ght_mouse_move ((window_width / 2) - mouse_x, (window_height / 2) - mouse_y);
break;
}
if (calibrated)
{
float x_axis, y_axis;
if (gyro)
{
gemInertialState gem_inert;
gemGetInertialState (0, 0, 0, &gem_inert);
x_axis = -vec_array (gem_inert.gyro, 1) * 25;
y_axis = -vec_array (gem_inert.gyro, 0) * 25;
if (abs (x_axis) > 2 || abs (y_axis) > 2)
_ecore_psl1ght_mouse_move (x_axis, y_axis);
}
else {
x_axis = (x - prev_x) * 2.5;
y_axis = -(y - prev_y) * 2.5;
prev_x = x;
prev_y = y;
_ecore_psl1ght_mouse_move (x_axis, y_axis);
}
if (!t_pressed && (move_buttons & 0x2))
_ecore_psl1ght_mouse_button (1, 1);
else if (t_pressed && (move_buttons & 0x2) == 0)
_ecore_psl1ght_mouse_button (1, 0);
t_pressed = move_buttons & 0x2;
}
}
static void
_ecore_psl1ght_poll_keyboard(void)
{
KbInfo kbInfo;
int i;
/* Check keyboard events */
ioKbGetInfo(&kbInfo);
if (kbInfo.status[0] == 1 && !keyboard_connected)
{
/* Connected */
keyboard_connected = true;
// Old events in the queue are discarded
ioKbClearBuf(0);
keyboard_leds._KbLedU.leds = 0;
keyboard_mods._KbMkeyU.mkeys = 0;
keyboard_old_key = 0;
// Set raw keyboard code types to get scan codes
ioKbSetCodeType(0, KB_CODETYPE_RAW);
ioKbSetReadMode(0, KB_RMODE_INPUTCHAR);
}
else if (kbInfo.status[0] != 1 && keyboard_connected)
{
/* Disconnected keyboard */
keyboard_connected = FALSE;
}
if (keyboard_connected)
{
KbData Keys;
// Read data from the keyboard buffer
if (ioKbRead(0, &Keys) == 0 && Keys.nb_keycode > 0)
{
Ecore_Event_Key *ev = NULL;
_ecore_psl1ght_key_modifiers (&Keys.mkey, &Keys.led);
if (Keys.nb_keycode == 0 && keyboard_old_key != 0)
{
ev = _ecore_psl1ght_event_key (keyboard_old_key);
if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
}
for (i = 0; i < Keys.nb_keycode; i++)
{
if (Keys.keycode[i] != keyboard_old_key)
{
if (Keys.keycode[i] != 0)
{
ev = _ecore_psl1ght_event_key (Keys.keycode[i]);
if (ev)
ecore_event_add(ECORE_EVENT_KEY_DOWN, ev,
NULL, NULL);
}
else
{
ev = _ecore_psl1ght_event_key (keyboard_old_key);
if (ev)
ecore_event_add(ECORE_EVENT_KEY_UP, ev,
NULL, NULL);
}
keyboard_old_key = Keys.keycode[0];
}
}
}
}
}
static void
xmb_event_handler(u64 status, u64 param, void *user_data)
{
//printf ("Received event %lX\n", status);
switch (status) {
case SYSUTIL_EXIT_GAME:
ecore_event_add(ECORE_PSL1GHT_EVENT_QUIT, NULL,