Hot Issues

Hey Guys,

We’ve had a terrific show of support for them community already and inparticular from Greg Peirce and Endolf on porting to Linux and Mac.

I want to thank both of them for their terrific efforts again.

We now have some hot issues I’d love to get one or more volunteers for. I’d do some of this msyelf but I’m swamped with other duties right now…

(1) Fixing the MouseDevice in the Win32 JInput plug-in.
We’ve pretty much determined that the way its currently implemented is wrong. It needs to be rewritten to return relative delta values and support more then 2 buttons as wellas to look like a single device like the mouse does on the other two platforms.

(2) Expand the devices known by the Win32 driver. Currently the driver is calling anything it doesnt otherwise recognize a generic “joystick” type device. This really isnt right. There are something like a dozen device types defined by DirectX 9 and we really should support them all more directly.

(3) JUnit tests for the API. Simple tests are doable thata re generic to all environments. More involed tests will likely have to test the generic layer and work by using a “test plugin” that returns known values.

(4) The current Win32 build requires the open source Cygwin DLL. There are rumors that it is possible to build a DLL with gcc that doesnt require the Cygwin DLL. If someone knows how to do this, it would be an improvement

Anyway if anyone is up to work on any of these, please post here and apply for Developer status on the code. (If you haven’t already filled out a developer agreement, you’ll need to do that. Its linked on the JInput main page.)

[quote] (4) The current Win32 build requires the open source Cygwin DLL. There are rumors that it is possible to build a DLL with gcc that doesnt require the Cygwin DLL. If someone knows how to do this, it would be an improvement
[/quote]
This is the guts of what we use for Xj3D and a number of our other combined Java/native code makefiles:


OS_NAME=$(shell uname)
ifeq (, $(strip $(findstring CYGWIN, $(OS_NAME))))
  PATH_SEP=':'
  LIB_SUFFIX=so
  LIB_PREFIX=lib
  INCLUDE_LIST+=$(JNI_HEADER_DIR)/linux
  CC_LINK_OPTIONS = -Wl -shared $(CFLAGS)
  ifdef LIBRARY_3RDPARTY
    3RDPARTY_LIBS = $(patsubst %,-l%, $(LIBRARY_3RDPARTY))
  endif
else
  PATH_SEP=';'
  LIB_SUFFIX=dll
  LIB_PREFIX=
  INCLUDE_LIST+=$(JNI_HEADER_DIR)/win32 /usr/include/win32api
  CFLAGS +=-D_WIN32 -mno-cygwin
  CC_LINK_OPTIONS = -Wl,--add-stdcall-alias -shared $(CFLAGS)
  ifdef LIBRARY_3RDPARTY
    3RDPARTY_LIBS = $(patsubst %,$(3RDPARTY_DLL_DIR)/lib%.dll,$(LIBRARY_3RDPARTY))
  endif
endif

INCS=$(subst $(SPACE)$(SPACE),$(SPACE),$(INCLUDE_LIST))
INC_DIRS=$(subst $(SPACE),$(SPACE)-I,$(INCS))

#
# Option listing for the various commands
#
CC_OPTIONS = -c -O2 $(INC_DIRS) $(CFLAGS)

#
# Build rules.
#

ifdef LIBRARY
  LIB_DIR   = $(DESTINATION)/$(LIBRARY)
  OBJ_FILE_LIST = $(SOURCE_FILES:%.c=%.o)
  OBJ_FILES = $(SOURCE_FILES:%.c=$(DESTINATION)/$(LIBRARY)/%.o)
  LIB_FILES = $(LIB_DESTINATION)/$(LIB_PREFIX)$(LIBRARY).$(LIB_SUFFIX)
endif

SOURCE_FILES  = $(filter  %.c,$(C_SOURCE))

LIB_LIST_CLEAN = $(patsubst %,$(NATIVE_SRC_DIR)/%/.clean,$(LIBRARY_LIST))
LIB_LIST_BUILD = $(patsubst %,$(NATIVE_SRC_DIR)/%/.build,$(LIBRARY_LIST))

....

# Rule 4. Building a .o object file from a .java file
$(LIB_DIR)/%.o : $(NATIVE_DIR)/$(LIBRARY)/%.c
      $(PRINT) Compiling $*.c
      cd $(LIB_DIR) && $(CC) $(CC_OPTIONS) $< 

# Rule 5. Building a .o file from a .c file. Invokes rule 4.
%.o : $(NATIVE_DIR)/$(LIBRARY)/%.c
      $(PRINT) creating $(LIB_DIR)/$(LIBRARY)
      $(MAKE) -k $(LIB_DIR)/$@

# Rule 6. Building a .dll or .so from .o files.
$(LIB_DESTINATION)/$(LIB_PREFIX)$(LIBRARY).$(LIB_SUFFIX): $(OBJ_FILES)
      $(PRINT) Building $@
      cd $(LIB_DIR) && $(CC) $(CC_LINK_OPTIONS) -o $(LIB_DESTINATION)/$(LIB_PREFIX)$(LIBRARY).$(LIB_SUFFIX) $(3RDPARTY_LIBS) $(OBJ_FILES) 


If need be, I can send you the entire makefile setup that you can then disassemble as needed.

Forgot to add - Note that there are some very strict things in the GCC call setup on cygwin. The CC_LINK_OPTIONS must be copied absolutely verbatim. The comma is meant to be there, and the whitespace setup is critical too. If you don’t used it exactly as written there, you won’t get cygwin to compile it all.

Why not just use mingw? Is there a reason cygwin was chosen? mingw doesn’t rely on any sort of “unix compatibility” dll, it’s just straight up gcc on win32.

Um we ARE using MinGW.

Im told the result though requries cygwin.
(Its possible that the requriement coems from Peter Puck’s dx8 libs. We are using those becuase MinGW has incomplete and back-version DX support.)

If someone wants to take charge of working this out, that would be great.

I’ll attempt to have a look at it later this week. We’re going through the process right now of evaluating whether to use JInput or the javax.usb code within Xj3D. We’ve been using JXInput for the code we’ve been delivering to some of our clients, but we can’t include it in the public codebase because of the licensing restrictions on it (ie non open source).