Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[W.I.P] Add support for belek's xbox 360/xbox one and cleanups #1386

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ else
endif

ifeq ($(PADEMU),1)
IOP_OBJS += bt_pademu.o usb_pademu.o ds34usb.o ds34bt.o libds34usb.a libds34bt.a
IOP_OBJS += pademu.o ds34usb.o ds34bt.o libds34usb.a libds34bt.a
EE_CFLAGS += -DPADEMU
EE_INCS += -Imodules/ds34bt/ee -Imodules/ds34usb/ee
PADEMU_FLAGS = PADEMU=1
Expand Down Expand Up @@ -328,8 +328,7 @@ clean: download_lwNBD
echo " -ds34bt"
$(MAKE) -C modules/ds34bt clean
echo " -pademu"
$(MAKE) -C modules/pademu USE_BT=1 clean
$(MAKE) -C modules/pademu USE_USB=1 clean
$(MAKE) -C modules/pademu USE_DS34USB=1 USE_DS34BT=1 USE_XBOXONE=1 USE_XBOX360=1 clean
echo "-pc tools"
$(MAKE) -C pc clean

Expand Down Expand Up @@ -521,16 +520,10 @@ modules/ds34usb/iop/ds34usb.irx: modules/ds34usb/iop
$(EE_ASM_DIR)ds34usb.c: modules/ds34usb/iop/ds34usb.irx | $(EE_ASM_DIR)
$(BIN2C) $< $@ $(*F)_irx

modules/pademu/bt_pademu.irx: modules/pademu
$(MAKE) -C $< USE_BT=1
modules/pademu/pademu.irx: modules/pademu
$(MAKE) USE_DS34USB=1 USE_DS34BT=1 USE_XBOXONE=1 USE_XBOX360=1 -C $< all

$(EE_ASM_DIR)bt_pademu.c: modules/pademu/bt_pademu.irx
$(BIN2C) $< $@ $(*F)_irx

modules/pademu/usb_pademu.irx: modules/pademu
$(MAKE) -C $< USE_USB=1

$(EE_ASM_DIR)usb_pademu.c: modules/pademu/usb_pademu.irx
$(EE_ASM_DIR)pademu.c: modules/pademu/pademu.irx
$(BIN2C) $< $@ $(*F)_irx

$(EE_ASM_DIR)bdm.c: $(PS2SDK)/iop/irx/bdm.irx | $(EE_ASM_DIR)
Expand Down
1 change: 0 additions & 1 deletion include/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ enum UI_ITEMS {
PADCFG_PADEMU_SOURCE,
PADCFG_PADEMU_CONFIG,
PADCFG_PADEMU_ENABLE,
PADCFG_PADEMU_MODE,
PADCFG_PADEMU_PORT,
PADCFG_PADEMU_VIB,
PADCFG_PADPORT,
Expand Down
4 changes: 1 addition & 3 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ IMPORT_BIN2C(bdmevent_irx);

IMPORT_BIN2C(bdmfs_fatfs_irx);

IMPORT_BIN2C(bt_pademu_irx);
IMPORT_BIN2C(pademu_irx);

IMPORT_BIN2C(cdvdfsv_irx);

Expand Down Expand Up @@ -134,8 +134,6 @@ IMPORT_BIN2C(usbd_irx);

IMPORT_BIN2C(usbmass_bd_irx);

IMPORT_BIN2C(usb_pademu_irx);

IMPORT_BIN2C(xhdd_irx);

#endif
8 changes: 0 additions & 8 deletions lng_tmpl/_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,6 @@ gui_strings:
string: Pad Emulator
- label: HINT_PADEMU_ENABLE
string: Turns on/off Pad Emulator for selected game.
- label: PADEMU_MODE
string: Pad Emulator Mode
- label: HINT_PADEMU_MODE
string: Select Pad Emulator mode.
- label: DS34USB_MODE
string: DualShock3/4 USB
- label: DS34BT_MODE
string: DualShock3/4 BT
- label: PADPORT
string: 'Settings For Port:'
- label: HINT_PAD_PORT
Expand Down
28 changes: 19 additions & 9 deletions modules/pademu/Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
IOP_OBJS = pademu.o sys_utils.o imports.o exports.o padmacro.o ds34common.o

ifeq ($(USE_USB),1)
IOP_BIN = usb_pademu.irx
IOP_CFLAGS += -DUSB
IOP_OBJS_DIR = obj.usb/
IOP_BIN = pademu.irx

ifeq ($(USE_DS34USB),1)
IOP_CFLAGS += -DDS34USB
IOP_OBJS += ds34usb.o
endif

ifeq ($(USE_BT),1)
IOP_BIN = bt_pademu.irx
IOP_CFLAGS += -DBT
IOP_OBJS_DIR = obj.bt/
ifeq ($(USE_DS34BT),1)
IOP_CFLAGS += -DDS34BT
IOP_OBJS += ds34bt.o
endif

ifeq ($(VMC),1)
IOP_CFLAGS += -DVMC
endif

ifeq ($(USE_XBOX360),1)
IOP_CFLAGS += -DX360 -Wall -fno-builtin
IOP_LDFLAGS += -s
IOP_OBJS += xbox360usb.o
endif

ifeq ($(USE_XBOXONE),1)
IOP_CFLAGS += -DXONE -Wall -fno-builtin
IOP_LDFLAGS += -s
IOP_OBJS += xboxoneusb.o
endif

IOP_CFLAGS += -DUSE_SMSUTILS
IOP_INCS += -I../../include/

include $(PS2SDK)/Defs.make
include ../Rules.bin.make
include $(PS2SDK)/samples/Makefile.iopglobal
include $(PS2SDK)/samples/Makefile.iopglobal
85 changes: 85 additions & 0 deletions modules/pademu/ds34.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#ifndef _DS34_H_
#define _DS34_H_

#include <ds34common.h>

#define DS34_VID 0x054C // Sony Corporation
#define DS3_PID 0x0268 // PS3 Controller
#define DS4_PID 0x05C4 // PS4 Controller
#define DS4_PID_SLIM 0x09CC // PS4 Slim Controller
#define DS3 0
#define DS4 1
#define MAX_BUFFER_SIZE 64 // Size of general purpose data buffer

#define MAX_PORTS 4

enum eHID {
// {{{
/* HID event flag */
HID_FLAG_STATUS_REPORTED = 0x01,
HID_FLAG_BUTTONS_CHANGED = 0x02,
HID_FLAG_EXTENSION = 0x04,
HID_FLAG_COMMAND_SUCCESS = 0x08,

/* USB HID Transaction Header (THdr) */
HID_USB_GET_REPORT_FEATURE = 0x03,
HID_USB_SET_REPORT_OUTPUT = 0x02,
HID_USB_DATA_INPUT = 0x01,

/* Bluetooth HID Transaction Header (THdr) */
HID_THDR_GET_REPORT_FEATURE = 0x43,
HID_THDR_SET_REPORT_OUTPUT = 0x52,
HID_THDR_SET_REPORT_FEATURE = 0x53,
HID_THDR_DATA_INPUT = 0xa1,

/* Defines of various parameters for PS3 Game controller reports */
PS3_F4_REPORT_ID = 0xF4,
PS3_F4_REPORT_LEN = 0x04,

PS3_01_REPORT_ID = 0x01,
PS3_01_REPORT_LEN = 0x30,

PS4_02_REPORT_ID = 0x02,
PS4_11_REPORT_ID = 0x11,
PS4_11_REPORT_LEN = 0x4D,

// }}}
};

typedef struct
{
int devId;
int hid_sema;
int controlEndp;
int interruptEndp;
int inEndp;
int outEndp;
u8 status;
} bt_device;

typedef struct _usb_ds34
{
int devId;
int sema;
int cmd_sema;
int controlEndp;
int interruptEndp;
int outEndp;
u8 enabled;
u8 status;
u8 type; // 0 - ds3, 1 - ds4, 2 - guitar hero guitar, 3 - rock band guitar
u8 oldled[4]; // rgb for ds4 and blink
u8 lrum;
u8 rrum;
u8 update_rum;
union
{
struct ds2report ds2;
u8 data[18];
};
u8 analog_btn;
u8 btn_delay;
} ds34usb_device;


#endif
Loading