===============================================================================
 phoneME-GP2X-SDL version 1.0.0 - 15/07/2008 by -zaxxon-
===============================================================================
Bugs reporting, release and readme instructions by Eclipse 
(so you know who you wanna hurt for the horrible English)


This port is based on official release of SUN phoneME Feature:
https://phoneme.dev.java.net/

Respect than official sources, GP2X port (linux-arm) uses SDL libs to support
graphic, music and input.

To configure keys and screen orientation are used the following shell
environment variables:

J2ME_GP2X_JOYU   - Joystick UP
J2ME_GP2X_JOYUL  - Joystick UP-LEFT
J2ME_GP2X_JOYL   - Joystick LEFT
J2ME_GP2X_JOYDL  - Joystick DOWN-LEFT
J2ME_GP2X_JOYD   - Joystick DOWN
J2ME_GP2X_JOYDR  - Joystick DOWN-RIGHT
J2ME_GP2X_JOYR   - Joystick RIGHT
J2ME_GP2X_JOYUR  - Joystick UP-RIGHT
J2ME_GP2X_JOYC   - Joystick CENTER (PRESS)
J2ME_GP2X_START  - Button START
J2ME_GP2X_SELECT - Button SELECT
J2ME_GP2X_LEFT   - Button LEFT
J2ME_GP2X_RIGHT  - Button RIGHT
J2ME_GP2X_BUTA   - Button A
J2ME_GP2X_BUTB   - Button B
J2ME_GP2X_BUTX   - Button X
J2ME_GP2X_BUTY   - Button Y
J2ME_GP2X_VOLU   - Button VOLUME+
J2ME_GP2X_VOLD   - Button VOLUME-

J2ME_GP2X_REVERSE - Reverse Display Orientation (Any Value).

For screen orientation it's possible to use any values, it's only needed
that J2ME_GP2X_REVERSE is defined ("unset J2ME_GP2X_REVERSE" to
have normal orientation).

For keys declaration, the values, defined in the include files of this project,
are the following:

KEYMAP_KEY_BACKSPACE    = 8
KEYMAP_KEY_POUND        = 35
KEYMAP_KEY_ASTERISK     = 42
KEYMAP_KEY_0            = 48
KEYMAP_KEY_1            = 49
KEYMAP_KEY_2            = 50
KEYMAP_KEY_3            = 51
KEYMAP_KEY_4            = 52
KEYMAP_KEY_5            = 53
KEYMAP_KEY_6            = 54
KEYMAP_KEY_7            = 55
KEYMAP_KEY_8            = 56
KEYMAP_KEY_9            = 57
KEYMAP_KEY_SPACE        = 32
KEYMAP_KEY_UP           = -1
KEYMAP_KEY_DOWN         = -2
KEYMAP_KEY_LEFT         = -3
KEYMAP_KEY_RIGHT        = -4
KEYMAP_KEY_SELECT       = -5
KEYMAP_KEY_SOFT1        = -6
KEYMAP_KEY_SOFT2        = -7
KEYMAP_KEY_CLEAR        = -8
KEYMAP_KEY_SEND         = -10
KEYMAP_KEY_END          = -11
KEYMAP_KEY_POWER        = -12 
KEYMAP_KEY_GAMEA        = -13
KEYMAP_KEY_GAMEB        = -14
KEYMAP_KEY_GAMEC        = -15
KEYMAP_KEY_GAMED        = -16
KEYMAP_KEY_GAME_UP      = -17
KEYMAP_KEY_GAME_DOWN    = -18
KEYMAP_KEY_GAME_LEFT    = -19
KEYMAP_KEY_GAME_RIGHT   = -20

phoneME implements CLDC 1.1 and MIDP 2.1 profiles plus a partial
implementation of Mobile Media API (JSR 135).
About this last one is supported MIDI player (with VolumeControl)
and ToneSequence (with ToneControl) besides Manager.playTone() method.

To play MIDI files, phoneME use Timidity sources (http://timidity.sourceforge.net/)
in the version included into SDL_sound (http://icculus.org/SDL_sound/).
A very big thanks to Timidity authors!

The following commands are needed to manage .jarand relative Midlet, and for
practical examples, read below "HOW TO INSTALL AND RUN A GAME"

To install a MIDlet:

installMidlet <filename.jar>

If it's worked, an ID number is returned and it's need to run game:

runMidlet <ID number>

To remove a MIDlet:

removeMidlet <ID number>

To list names and IDs of installed game:

listMidlet

- HOW TO INSTALL AND RUN A GAME

Copy the "phoneMe" and "midi" directory on the root of your SD. 
Inside that directory you will find two .gpe example files to be edited.

1) Copy your .jar file inside the phoneME directory and edit the Install_Game.gpe 
to make it fit your game.
You have to change the .jar filename if different and the log filename if you want to change it

cd /mnt/sd/phoneME/bin/arm
./installMidlet ../../GAMENAME.jar > ../../GAMENAME.installed.txt
sync
cd /usr/gp2x
exec ./gp2xmenu

2) Launch Install_Game.gpe (or the one you renamed), then using the gp2x ebook reader or a text editor open the .txt log.
It may show something like that:

The suite was succesfully installed, ID: 3

What you need is that ID number, in this case 3.
If the file contains error messages probably something goes wrong, check the edited file or try another game.

3) Use the obtained ID to make a .gpe file to run the game, like this

export J2ME_GP2X_JOYU=50
export J2ME_GP2X_JOYUL=49
export J2ME_GP2X_JOYL=52
export J2ME_GP2X_JOYDL=55
export J2ME_GP2X_JOYD=56
export J2ME_GP2X_JOYDR=57
export J2ME_GP2X_JOYR=54
export J2ME_GP2X_JOYUR=51
export J2ME_GP2X_START=-6
export J2ME_GP2X_SELECT=-7
export J2ME_GP2X_LEFT=-22
export J2ME_GP2X_RIGHT=48
export J2ME_GP2X_BUTA=-13
export J2ME_GP2X_BUTB=-14
export J2ME_GP2X_BUTX=-15
export J2ME_GP2X_BUTY=-16
export J2ME_GP2X_VOLU=35
export J2ME_GP2X_VOLD=42
export J2ME_GP2X_JOYC=53
export J2ME_GP2X_REVERSE=1
cd /mnt/sd/phoneME/bin/arm
./runMidlet 3
sync
cd /usr/gp2x
exec ./gp2xmenu

As you can see, we passed 3 as argument at runMidlet.

All those ambient variables are needed to bind the gp2x keys for the game, names are self explanatory: J2ME_GP2X_JOYU for UP, J2ME_GP2X_JOYDR for joystick Down-Right (only in F100), and so on.
export J2ME_GP2X_REVERSE=1 serves to games that needs to be rotated, to disable screen rotation simply delete this row.


Here's the list of values you can use

KEYMAP_KEY_INVALID      = 0
KEYMAP_KEY_BACKSPACE    = 8
KEYMAP_KEY_POUND        = 35
KEYMAP_KEY_ASTERISK     = 42
KEYMAP_KEY_0            = 48
KEYMAP_KEY_1            = 49
KEYMAP_KEY_2            = 50
KEYMAP_KEY_3            = 51
KEYMAP_KEY_4            = 52
KEYMAP_KEY_5            = 53
KEYMAP_KEY_6            = 54
KEYMAP_KEY_7            = 55
KEYMAP_KEY_8            = 56
KEYMAP_KEY_9            = 57
KEYMAP_KEY_SPACE        = 32
KEYMAP_KEY_UP           = -1
KEYMAP_KEY_DOWN         = -2
KEYMAP_KEY_LEFT         = -3
KEYMAP_KEY_RIGHT        = -4
KEYMAP_KEY_SELECT       = -5
KEYMAP_KEY_SOFT1        = -6
KEYMAP_KEY_SOFT2        = -7
KEYMAP_KEY_CLEAR        = -8
KEYMAP_KEY_SEND         = -10
KEYMAP_KEY_END          = -11
KEYMAP_KEY_POWER        = -12 
KEYMAP_KEY_GAMEA        = -13
KEYMAP_KEY_GAMEB        = -14
KEYMAP_KEY_GAMEC        = -15
KEYMAP_KEY_GAMED        = -16
KEYMAP_KEY_GAME_UP      = -17
KEYMAP_KEY_GAME_DOWN    = -18
KEYMAP_KEY_GAME_LEFT    = -19
KEYMAP_KEY_GAME_RIGHT   = -20
KEYMAP_KEY_DEBUG_TRACE1 = -21
KEYMAP_KEY_SCREEN_ROT   = -22

KEYMAP_KEY_SCREEN_ROT (-22) is no longer needed because you can choose to rotate the screen with the export J2ME_GP2X_REVERSE=1 line and save a button for better uses, still can be usefull for some games that have problems with the screen rotation at startup (the only one i found is Darkest Fear 3 at the moment).

Sadly, on F200 there are only 4 keys for the pad so the diagonals and the joystick click are not bindables.

- WHAT TYPES OF GAMES RUNS BETTER?

Search around for 320x240 or 240x320 games, like the ones for the N95 mobile, they will run fullscreen!


HOW TO COMPILE YOUR OWN VERSION

1) Download the original PhoneMe sources from Sun: 
http://download.java.net/mobileembedded/phoneme/feature/phoneme_feature-mr2-rel-src-b23-08_may-2007.zip

2) Make in your own home directory a new one called "phoneME".

3) Copy there the PhoneME sources, you need to have a "phoneme_feature" subdirectory.

4) Copy included "phoneME-GP2X-SDL-1.0.0.patch" in "phoneME" folder.

5) From console, inside "phoneME" digit patch -p1 phoneME-GP2X-SDL-1.0.0.patch

6) Make executable the script "compile.sh" using the command chmod a+x compile.sh.

7) Run the script with ./compile.sh.

8) cross your fingers and wait

9) At the end the only directories you need to copy on the SD are
~/phoneME/phoneme_feature/build_output/midp/appdb
~/phoneME/phoneme_feature/build_output/midp/bin
~/phoneME/phoneme_feature/build_output/midp/lib

For question or more info, visit http://www.gp2xita.com/community/ 