Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*CREDITS TO MILKY4444 !!! <3
- [SPRX] button monitoring for everygame(no addresses)
- hi ngu, i was testing a round with the pad library in the ps3sdk... i got it working but it can mess with your game controls so try to use in game. the header: https://www.mediafire.com/?0wxbbzb5faflygq
- how to use:
- initialize:
- */
- //-----------------------------------------------------------------------------------------------------------------------//
- //PUT THIS IN YOUR HEADER:
- #include<cell/pad.h>
- #include <cell/sysmodule.h>
- #define MAX_PAD (1)
- void PadRead(uint32_t* pbutton1, uint32_t* pbutton2)
- {
- int i;
- int ret;
- CellPadInfo2 pad_info;
- static uint32_t old_pad_info=0;
- CellPadData pad_data;
- uint32_t button1 = 0;
- uint32_t button2 = 0;
- ret = cellPadGetInfo2(&pad_info);
- if (ret != CELL_OK){
- //printf("cellPadGetInfo2() error (0x%x).\n", ret);
- return;
- }
- /*E Check info field for monitoring the INTERCEPTED state. */
- if((pad_info.system_info & CELL_PAD_INFO_INTERCEPTED) &&
- (!(old_pad_info & CELL_PAD_INFO_INTERCEPTED)))
- {
- //printf ("This program lost the ownership of the game pad data\n");
- old_pad_info = pad_info.system_info;
- }
- else if((!(pad_info.system_info & CELL_PAD_INFO_INTERCEPTED)) &&
- (old_pad_info & CELL_PAD_INFO_INTERCEPTED))
- {
- // printf ("This program got the ownership of the game pad data\n");
- old_pad_info = pad_info.system_info;
- }
- for (i = 0; i < MAX_PAD; i ++)
- {
- if (pad_info.port_status[i] & CELL_PAD_STATUS_CONNECTED == 0)
- continue;
- ret = cellPadGetData(i, &pad_data);
- if (ret != CELL_PAD_OK || pad_data.len == 0)
- continue;
- button1 = pad_data.button [CELL_PAD_BTN_OFFSET_DIGITAL1];
- button2 = pad_data.button [CELL_PAD_BTN_OFFSET_DIGITAL2];
- }
- *pbutton1 = button1;
- *pbutton2 = button2;
- return;
- }
- //-----------------------------------------------------------------------------------------------------------------------//
- #inlcude "pad.h"
- extern "C" int main(void)//main entry
- {
- cellPadInit(MAX_PAD);
- }
- //detect buttons:
- uint32_t button1,button2;
- PadRead(&button1, &button2);//use in thread
- if(button2 & CELL_PAD_CTRL_TRIANGLE)
- {
- print("pad detected");
- }
- enjoy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement