11/08/2006

PSP ButtonHook for FW2.71 RELEASED

 
 
Download-Link #1: ButtonHook_for_FW2.71.zip

Install
copy dh/kd/271CtrlP0okm.prx to MemoryStick
add line
ms0:/dh/kd/271CtrlP0okm.prx
to ms0:/dh/271F/flash0/kd/pspbtcnf.txt
and ms0:/dh/271F/flash0/kd/pspbtcnf_game.txt
** see pspbtcnf.txt.sample pspbtcnf_game.txt.sample

if in MemoryStick root have CtrlP0okm.bin
then it will use it to Hook the Button

Todo
use PSP sio to add External JoyStick



CtrlP0okm.bin sample

main.c

// swap Buttons CIRCLE & CROSS sample

/*
pad_data :
    unsigned int     TimeStamp; // The current read frame.
    unsigned int     Buttons;   // Bit mask containing zero or more of ::PspCtrlButtons.
    unsigned char    Lx;        // Analogue stick, X axis.
    unsigned char    Ly;        // Analogue stick, Y axis.
    unsigned char    Rsrv[6];   // Reserved.

Buttons :
    PSP_CTRL_SELECT   = 0x00000001,    // Select button.
    PSP_CTRL_START    = 0x00000008,    // Start button.
    PSP_CTRL_UP       = 0x00000010,    // Up D-Pad button.
    PSP_CTRL_RIGHT    = 0x00000020,    // Right D-Pad button.
    PSP_CTRL_DOWN     = 0x00000040,    // Down D-Pad button.
    PSP_CTRL_LEFT     = 0x00000080,    // Left D-Pad button.
    PSP_CTRL_LTRIGGER = 0x00000100,    // Left trigger.
    PSP_CTRL_RTRIGGER = 0x00000200,    // Right trigger.
    PSP_CTRL_TRIANGLE = 0x00001000,    // Triangle button.
    PSP_CTRL_CIRCLE   = 0x00002000,    // Circle button.
    PSP_CTRL_CROSS    = 0x00004000,    // Cross button.
    PSP_CTRL_SQUARE   = 0x00008000,    // Square button.
    PSP_CTRL_HOME     = 0x00010000,    // Home button.
    PSP_CTRL_HOLD     = 0x00020000,    // Hold button.
    PSP_CTRL_WLAN_UP  = 0x00040000,    // Wlan switch up.
    PSP_CTRL_REMOTE   = 0x00080000,    // Remote hold position.
    PSP_CTRL_VOLUP    = 0x00100000,    // Volume up button.
    PSP_CTRL_VOLDOWN  = 0x00200000,    // Volume down button.
    PSP_CTRL_SCREEN   = 0x00400000,    // Screen button.
    PSP_CTRL_NOTE     = 0x00800000,    // Music Note button.
    PSP_CTRL_DISC     = 0x01000000,    // Disc present.
    PSP_CTRL_MS       = 0x02000000,    // Memory stick present.

mode :
    sceCtrlPeekBufferPositive = 0x0
    sceCtrlPeekBufferNegative = 0x1
    sceCtrlReadBufferPositive = 0x2
    sceCtrlReadBufferNegative = 0x3
*/
#include <pspctrl.h>

int _start(int *pad_data, int count, int mode, int ret_data, int *Buff)
{
    unsigned int Buttons = pad_data[1] & 0xFFFF9FFF; // Buttons Mask
    if (pad_data[1] & PSP_CTRL_CIRCLE)
    {
        Buttons = Buttons | PSP_CTRL_CROSS;
    }
    if (pad_data[1] & PSP_CTRL_CROSS)
    {
        Buttons = Buttons | PSP_CTRL_CIRCLE;
    }
    pad_data[1] = Buttons;

    return ret_data;
}


Makefile



PSPDEV=/usr/local/pspdev/bin
INCLUDES=-I $(PSPDEV)/../psp/sdk/include


all:    main.bin

main.bin:
    $(PSPDEV)/psp-gcc $(INCLUDES) -W -Wall -G0 -fno-pic -mno-abicalls -w -S main.c -o main.s
    $(PSPDEV)/psp-as main.s -o main.o
    $(PSPDEV)/psp-ld -T psp20bin.x main.o -o main.elf
    $(PSPDEV)/psp-objcopy -O binary main.elf CtrlP0okm.bin


psp20bin.x

OUTPUT_FORMAT("elf32-littlemips")
OUTPUT_ARCH(mips)

ENTRY(_start)

SECTIONS
{
  . = 0x00000000;
  .text.start : {
    *(.text.start)
  }
  .text : {
    *(.text)
  }
  .rodata : {
    *(.rodata)
  }
  .data : {
    *(.data)
  }
  .bss : {
    *(.bss)
  }
}

0 Comments:

Post a Comment

<< Home