Actually, the fceu supports to customize keys but it just lacks an
easier way to do it. I'll try to introduce how to do it as following.

After you run fceu at the first time, it creates a ~/.fceultra directory
with a configuration file "fceu98.cfg". The definition of keys are all
written there.

You can use a binary editor to edit that file, and do the following changes:

Search: 47 61 6D 65 50 61 64 43 6F 6E 66 69 67 00 -- -- -- --
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 01 00 00 00
Modify:
        47 61 6D 65 50 61 64 43 6F 6E 66 69 67 00 -- -- -- --
        -- -- -- -- -- -- -- -- 78 00 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 7A 00 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 09 00 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 0D 00 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 11 01 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 12 01 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 14 01 -- -- -- -- -- -- 01 00 00 00
        -- -- -- -- -- -- -- -- 13 01 -- -- -- -- -- -- 01 00 00 00


Note:
        47 61 6D 65 50 61 64 43 6F 6E 66 69 67 00 <=> "GamePadConfig"

        There are 8 values need to be modified. Each of them is a 16-bits
        integer. They are mapped to the NES joystick, which are "A", "B",
        "Select", "Enter", "Up", "Down", "Left", and "Right".

        After you modified those values mentioned above, the effect is:
        "A" maps to PC keyboard 'X'
        "B" maps to PC keyboard 'Z'
        "Select" maps to PC keyboard 'Tab'
        "Enter" maps to PC keyboard 'Enter'
        "Up" maps to PC keyboard 'Up'
        "Down" maps to PC keyboard 'Down'
        "Left" maps to PC keyboard 'Left'
        "Right" maps to PC keyboard 'Right'

        The values are written in /usr/include/SDL/SDL_keysym.h
        (please install libsdl1.2-dev package)

        For example:
           78 00(hex in little-endian) = 120(decimal value) = SDLK_x
           11 01(hex in little-endian) = 273(decimal value) = SDLK_UP

        So you can customize your own key mapping with proper value.

Quickstart: (please apt-get install bbe)
#!/bin/sh
# Please backup the old config file
cp -i ~/.fceultra/fceu98.cfg ~/.fceultra/fceu98.cfg.old

# generate new config file to /tmp/fceu98.cfg.new
bbe -b "/GamePadConfig/:178" -e 'r 26 \x78\x00' -e 'r 46 \x7a\x00' \
        -e 'r 66 \x09\x00' -e 'r 86 \x0d\x00' -e 'r 106 \x11\x01' \
        -e 'r 126 \x12\x01' -e 'r 146 \x14\x01' -e 'r 166 \x13\x01' \
        ~/.fceultra/fceu98.cfg \
        > /tmp/fceu98.cfg.new

# replace the old one
cp /tmp/fceu98.cfg.new ~/.fceultra/fceu98.cfg

regards,
 Ying-Chun Liu

-- 
                                                PaulLiu(劉穎駿)
E-mail address: [EMAIL PROTECTED]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to