Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JInput for ARM linux  (Read 4424 times)
0 Members and 1 Guest are viewing this topic.
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Posted 2010-08-21 17:05:07 »

Here I come again...  Grin

The pandora got 2 analogic stick so I start to look for a port of JInput. I begin to look to the source code but I don't even know how to setup the dev environment and to build it  persecutioncomplex

The port by itself should be "easy" : just to recompile the x86 linux lib for ARM, and load the good lib at JInput start.
Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #1 - Posted 2010-08-21 21:10:26 »

Yeah, thar be dragons. Smiley

Offline Jono
« Reply #2 - Posted 2010-08-22 08:21:10 »

You'll need to set up a toolchain and a VM to compile and test with. Here's one guide specifically for Pandora:
http://www.rjmitchell.ca/~jeff/blog2009/2010/06/02/getting-up-and-going-with-a-crosscompiler-for-pandora-arm-in-5-minutes/

I've done this once before for another ARM device and following a similar set of instructions worked out fine for me.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #3 - Posted 2010-08-23 07:05:08 »

I know, I know... but after I download the CVS of jinput, I'm lost. I had never use ANT without an editor.

I have take a better look to it. It seems that the ant script is not made for crossplatform compiling, am I wrong ?

Ok, first time without modification :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
C:\jinput>ant
Buildfile: C:\jinput\build.xml

init:

dist:

init:

compile:
    [javac] C:\jinput\coreAPI\build.xml:13: warning: 'includeantruntime' was not
 set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 21 source files to C:\jinput\coreAPI\classes
    [javac] C:\jinput\coreAPI\src\java\net\java\games\input\DefaultControllerEnv
ironment.java:54: package net.java.games.util.plugins does not exist
    [javac] import net.java.games.util.plugins.*;
    [javac] ^
    [javac] C:\jinput\coreAPI\src\java\net\java\games\input\DefaultControllerEnv
ironment.java:202: cannot find symbol
    [javac] symbol  : class Plugins
    [javac] location: class net.java.games.input.DefaultControllerEnvironment
    [javac]             Plugins plugins = new Plugins(file);
    [javac]             ^
    [javac] C:\jinput\coreAPI\src\java\net\java\games\input\DefaultControllerEnv
ironment.java:202: cannot find symbol
    [javac] symbol  : class Plugins
    [javac] location: class net.java.games.input.DefaultControllerEnvironment
    [javac]             Plugins plugins = new Plugins(file);
    [javac]                                   ^
    [javac] 3 errors

BUILD FAILED
C:\jinput\build.xml:110: The following error occurred while executing this line:

C:\jinput\build.xml:69: The following error occurred while executing this line:
C:\jinput\coreAPI\build.xml:13: Compile failed; see the compiler error output fo
r details.

Total time: 0 seconds
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #4 - Posted 2010-08-23 09:23:02 »

Just find out this post : http://www.java-gaming.org/topics/jinput-cvs-compilation/21320/view.html

Ok, I have to understand the ANT script now to modify it...
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #5 - Posted 2010-08-25 06:57:03 »

I manage to compile it for ARM and it seems to work fine on the Pandora  Grin

Modification on LinuxEnvironmentPlugin.java was simple :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
        private final static String LIBNAME = "jinput-linux";
   private final static String POSTFIX64BIT = "64";
   private final static String POSTFIXARM = "ARM";
   private static boolean supported = false;

...

static {
      String osName = getPrivilegedProperty("os.name", "").trim();
      if(osName.equals("Linux")) {
            supported = true;
         if("i386".equals(getPrivilegedProperty("os.arch"))) {
            loadLibrary(LIBNAME);
         }
                        else if("arm".equals(getPrivilegedProperty("os.arch")))
                        {
           loadLibrary(LIBNAME + POSTFIXARM);
         }
                        else
                        {
           loadLibrary(LIBNAME + POSTFIX64BIT);
         }
      }
   }


I didn't need to do any modification on the native code. For the ant script, I don't like what I have done. It is more an hack than an elegant solution. I have modify the build.xml for Linux native by replacing the Linux x86 compilation by the ARM compilation (since I use an x86 to compile the ARM code) :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
  <?xml version="1.0" ?> 
- <!--  Written to assume that classpath is rooted in the current directory.
  -->
- <!--  So this should be OK if you make this script in the root of a filesystem.
  -->
- <!--  If not, you may prefer to adjust the basedir, or move some directories around.
  -->
- <!--  The idea is that both Ant and NetBeans have to know what the package root is
  -->
- <!--  for the classes in your application.
  -->
- <project name="JInput Linux port, Native code" basedir="." default="compileNativeJinputLib">
  <property name="libname64" value="libjinput-linux64.so" />
  <property name="libname32" value="libjinput-linux.so" />
  <property name="libnameARM value="libjinput-linuxARM.so" />
- <target name="createNativeDefinitions.java">
- <exec dir="." executable="gawk" os="Linux" output="../java/net/java/games/input/NativeDefinitions.java">
  <arg line="
-f" />
  <arg line="
getDefinitions" />
  <arg line="
/usr/include/linux/input.h" />
  </exec>
  </target>
- <target name="clean">
- <delete>
  <fileset dir="
." includes="*.o" />
  <fileset dir="
." includes="*.so" />
  </delete>
  </target>
- <target name="compileNativeJinputLib">
- <exec executable="uname" outputproperty="hwplatform">
  <arg value="
-m" />
  </exec>
- <condition property="libname" value="${libnameARM}" else="${libnameARM}">
  <equals arg1="
${hwplatform}" arg2="x86_64" />
  </condition>
- <apply dir="." executable="arm-none-linux-gnueabi-gcc" os="Linux" dest="." skipemptyfilesets="true" failonerror="true">
  <arg line="
-O2 -Wall -c -fPIC" />
  <arg value="
-I${java.home}/include" />
  <arg value="
-I${java.home}/include/linux" />
  <arg value="
-I${java.home}/../include" />
  <arg value="
-I${java.home}/../include/linux" />
  <arg value="
-I../../../common/src/native" />
  <mapper type="
glob" from="*.c" to="*.o" />
  <fileset dir="
." includes="*.c" />
  <fileset dir="
../../../common/src/native" includes="*.c" />
  </apply>
- <apply dir="." parallel="true" executable="arm-none-linux-gnueabi-gcc" os="Linux" failonerror="true">
  <arg line="
-shared -O2 -Wall -o ${libname}" />
  <fileset dir="
." includes="*.o" />
  </apply>
- <apply dir="." parallel="true" executable="arm-none-linux-gnueabi-strip" os="Linux" failonerror="true">
  <fileset file="
${libname}" />
  </apply>
  </target>
  </project>


I will make binaries available after testing them more.
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #6 - Posted 2010-08-26 06:00:57 »

Hi

if you can upload a .patch file with your changes I will take a look and maybe include them in core jinput. It's not something I have access too, so won't be maintaining, but if someone has done the ground work and finds it useful, then it ought to be in jinput Smiley

Cheers

Endolf

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #7 - Posted 2010-08-26 06:55:58 »

I will make a better ANT script first. (After I have to understand how to make the patch  Wink)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (36 views)
2014-12-15 09:26:44

Mr.CodeIt (29 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (98 views)
2014-12-08 04:46:31

JscottyBieshaar (58 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (76 views)
2014-11-29 21:32:03

toopeicgaming1999 (137 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (37 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!