what buttons are which on a 360 controller and FRAPS?

Started by MisterN, August 19, 2012, 03:57:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

1. What buttons are which on a 360 controller to use with bennu?

2. Howcome bennu does not work with fraps?

EDIT: I am making a bennu program that will show you whats what on a joypad, and im using a 360 controller as its basis, since many pc controllers today are based off of it. I cannot figure out how to get the d-pad to work. Thats it, other than that, I have gotten every other thing on the controller to work. if I use Joy_gethat, only 0 works, but that applies to every button on the d-pad.
werg

handsource-dyko

Do you want the d-pad digitally? I believe it's either the hat switch or simply the axis.

MisterN

I want a digital d-pad working with the two analog sticks (the RT and LT buttons are also axis's as well) This is the program I am working on:

/*

BennuGD JoyPad Test

Created By: Nicholas Wolf

Purpose: For showing you what belongs to what on the joypad so that you can use it in the code

*/

#ifndef __VERSION__
    import "mod_sdlevthandler";
    import "mod_pathfind";
#else
    import "mod_blendop";
    import "mod_text";
    import "mod_grproc";
    import "mod_video";
    import "mod_map";
    import "mod_screen";
    import "mod_path";
    import "mod_rand";
    import "mod_say";
    import "mod_mouse";
    import "mod_scroll";
    import "mod_math";
#endif

IMPORT "mod_debug";
IMPORT "mod_dir";
IMPORT "mod_file";
IMPORT "mod_key";
IMPORT "mod_draw";
IMPORT "mod_string";
IMPORT "mod_proc";
IMPORT "mod_wm";
IMPORT "mod_sys";
IMPORT "mod_joy";
IMPORT "mod_sound";
IMPORT "mod_time";
IMPORT "mod_timers";
IMPORT "mod_cd"

global
    //Joy buttons
        pressing_button = false;
        joy_but_0 = 0;
        joy_but_1 = 1;
        joy_but_2 = 2;
        joy_but_3 = 3;
        joy_but_4 = 4;
        joy_but_5 = 5;
        joy_but_6 = 6;
        joy_but_7 = 7;
        joy_but_8 = 8;
        joy_but_9 = 9;
        joy_but_10 = 10;
        joy_but_11 = 11;
        joy_but_12 = 12;
    //Joy D-Pad
        joy_dpad_0 = 0;
        joy_dpad_1 = 1;
        joy_dpad_2 = 2;
        joy_dpad_3 = 3;
        joy_dpad_4 = 4;
        joy_dpad_5 = 5;
        joy_dpad_6 = 6;
        joy_dpad_7 = 7;
        joy_dpad_8 = 8;

process main()
begin
say("Joypads present: "+joy_number());
    loop
        //Finding the buttons   
            if(joy_getbutton(0,joy_but_0))
                say("This button is assigned to button 0");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_1))
                say("This button is assigned to button 1");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_2))
                say("This button is assigned to button 2");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_3))
                say("This button is assigned to button 3");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_4))
                say("This button is assigned to button 4");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_5))
                say("This button is assigned to button 5");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_6))
                say("This button is assigned to button 6");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_7))
                say("This button is assigned to button 7");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_8))
                say("This button is assigned to button 8");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_9))
                say("This button is assigned to button 9");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_10))
                say("This button is assigned to button 10");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_11))
                say("This button is assigned to button 11");
                pressing_button = true;
            else
                pressing_button = false;
            end
            if(joy_getbutton(0,joy_but_12))
                say("This button is assigned to button 12");
                pressing_button = true;
            else
                pressing_button = false;
            end
        //Finding the D-Pad
            if(joy_gethat(0,joy_dpad_0))
                say("This d-pad button is assigned to 0");
            end
            if(joy_gethat(0,joy_dpad_1))
                say("This d-pad button is assigned to 1");
            end
            if(joy_gethat(0,joy_dpad_2))
                say("This d-pad button is assigned to 2");
            end
            if(joy_gethat(0,joy_dpad_3))
                say("This d-pad button is assigned to 3");
            end
            if(joy_gethat(0,joy_dpad_4))
                say("This d-pad button is assigned to 4");
            end
            if(joy_gethat(0,joy_dpad_5))
                say("This d-pad button is assigned to 5");
            end
            if(joy_gethat(0,joy_dpad_6))
                say("This d-pad button is assigned to 6");
            end
            if(joy_gethat(0,joy_dpad_7))
                say("This d-pad button is assigned to 7");
            end
            if(joy_gethat(0,joy_dpad_8))
                say("This d-pad button is assigned to 8");
            end
        //The joysticks
            if(joy_getaxis(0,0)<-6);
                say("axis is going left");
            end
            if(joy_getaxis(0,0)>6);
                say("axis is going right");
            end
            if(joy_getaxis(0,1)>6);
                say("axis is going down");
            end
            if(joy_getaxis(0,1)<-6);
                say("axis is going up");
            end
            if(joy_getaxis(0,4)<-6);
                say("axis is going left");
            end
            if(joy_getaxis(0,4)>6);
                say("axis is going right");
            end
            if(joy_getaxis(0,3)>6);
                say("axis is going down");
            end
            if(joy_getaxis(0,3)<-6);
                say("axis is going up");
            end
        //Analog Shoulder Buttons
            if(joy_getaxis(0,2)<-6);
                say("axis is being pushed");
            end
            if(joy_getaxis(0,2)>6);
                say("axis is being pushed");
            end
       
        IF (key(_esc) or exit_status)
            exit("goodbye!",0);
        END
    frame; end
end


It is for use with a 360 controller. The issue I am having is getting the digital d-pad to work.
werg

SplinterGU

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

werg

SplinterGU

I was imagine that... I was found it in google...

sorry, I can't do nothing for fraps compatibility... maybe you must think in capture screens in memory and then dump it to disk... I made it for some videos (engine outrun like)
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

Oh ok. But now my unsolved problem.

The Xbox 360 D-pad. I cannot get it to work right.
werg

SplinterGU

try with this


PROGRAM controls;
import "mod_video";
import "mod_joy";
import "mod_text";
import "mod_proc";

GLOBAL
buttons[7][22];
axes[7][22];
hats[7][22];
balls[7][22][1];
accel[7][2];

BEGIN
    set_mode(640,480,16);

    write(0,320,470,4,"*** PRESS ESC FOR EXIT ***");

    FROM y=0 to JOY_NUMJOYSTICKS()-1;
        from x = 0 to JOY_NUMBUTTONS( y ) -1;
            if ( y == 0 ) write(0,10,10+(x*10),4,x+" :"); end
            write_int(0,40+(y*30),10+(x*10),4,& buttons[y][x]);
        end
        from x = 0 to JOY_AXES( y ) -1;
            if ( y == 0 ) write(0,160,10+(x*10),4,x+" :"); end
            write_int(0,190+(y*60),10+(x*10),4,&axes[y][x]);
        end
        from x = 0 to JOY_NUMHATS( y ) -1;
            if ( y == 0 ) write(0,160,60+(x*10),4,x+" :"); end
            write_int(0,190+(y*60),60+(x*10),4,&hats[y][x]);
        end
        from x = 0 to JOY_NUMBALLS( y ) -1;
            if ( y == 0 ) write(0,160,160+(x*10),4,x+" :"); end
            write_int(0,190+(y*60),160+(x*10),4,&balls[y][x][0]);
            write_int(0,220+(y*60),160+(x*10),4,&balls[y][x][1]);
        end
        from x = 0 to 2;
            write_int(0,160+(x*30),200+(y*10),4,&accel[y][x]);
        end
    END

    LOOP

        FROM y=0 to JOY_NUMJOYSTICKS()-1;
            from x = 0 to JOY_NUMBUTTONS( y ) -1;
                buttons[y][x]=get_joy_button(y,x);
            end
            from x = 0 to JOY_AXES( y ) -1;
                axes[y][x]=JOY_GETAXIS(y, x);
            end
            from x = 0 to JOY_NUMHATS( y ) -1;
                hats[y][x]=JOY_GETHAT(y,x);
            end
            from x = 0 to JOY_NUMBALLS( y ) -1;
                JOY_GETBALL(y,x,&balls[y][x][0],&balls[y][x][1]);
            end
            joy_getaccel(y,&accel[y][0],&accel[y][1],&accel[y][2]);
        END
        IF (key(_ESC)) exit(); END

        FRAME;
    END
END

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

handsource-dyko

Did you know that a controller can have more then two axis in the usb spec? If you have a d-pad and two analog sticks on a controller you've got 6 axis in total (that's where the playstation controller got it's name from). Maybe you have to fiddle with the joy_axes function wich return the number of buttons on the active (or selected) controller.

MisterN

thanks splinter, it works. but, i still have no idea at all how to use the hats, cause the code is so well intertwined, i cant take it apart to see whats what.
werg