Skip to content

Commit

Permalink
Modular pademu, prototypes of xbox modules and hid joystick module
Browse files Browse the repository at this point in the history
  • Loading branch information
belek666 committed May 24, 2020
1 parent a95959f commit 7dec2db
Show file tree
Hide file tree
Showing 65 changed files with 6,076 additions and 2,757 deletions.
72 changes: 61 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ 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 btstack.o ds3usb.o ds4usb.o xbox360usb.o xboxoneusb.o \
ds3bt.o ds4bt.o hidusb.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 @@ -291,8 +292,15 @@ clean:
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 clean
$(MAKE) -C modules/pademu/btstack clean
$(MAKE) -C modules/pademu/ds3usb clean
$(MAKE) -C modules/pademu/ds4usb clean
$(MAKE) -C modules/pademu/xbox360usb clean
$(MAKE) -C modules/pademu/xboxoneusb clean
$(MAKE) -C modules/pademu/ds3bt clean
$(MAKE) -C modules/pademu/ds4bt clean
$(MAKE) -C modules/pademu/hidusb clean
echo "-pc tools"
$(MAKE) -C pc clean

Expand Down Expand Up @@ -487,17 +495,59 @@ modules/ds34usb/iop/ds34usb.irx: modules/ds34usb/iop
$(EE_ASM_DIR)ds34usb.s: modules/ds34usb/iop/ds34usb.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ ds34usb_irx

modules/pademu/bt_pademu.irx: modules/pademu
$(MAKE) -C $< USE_BT=1
modules/pademu/pademu.irx: modules/pademu
$(MAKE) -C $<

$(EE_ASM_DIR)pademu.s: modules/pademu/pademu.irx
$(BIN2S) $< $@ pademu_irx

modules/pademu/btstack/btstack.irx: modules/pademu/btstack
$(MAKE) -C $<

$(EE_ASM_DIR)btstack.s: modules/pademu/btstack/btstack.irx
$(BIN2S) $< $@ btstack_irx

modules/pademu/ds3usb/ds3usb.irx: modules/pademu/ds3usb
$(MAKE) -C $<

$(EE_ASM_DIR)ds3usb.s: modules/pademu/ds3usb/ds3usb.irx
$(BIN2S) $< $@ ds3usb_irx

modules/pademu/ds4usb/ds4usb.irx: modules/pademu/ds4usb
$(MAKE) -C $<

$(EE_ASM_DIR)ds4usb.s: modules/pademu/ds4usb/ds4usb.irx
$(BIN2S) $< $@ ds4usb_irx

$(EE_ASM_DIR)bt_pademu.s: modules/pademu/bt_pademu.irx
$(BIN2S) $< $@ bt_pademu_irx
modules/pademu/xbox360usb/xbox360usb.irx: modules/pademu/xbox360usb
$(MAKE) -C $<

modules/pademu/usb_pademu.irx: modules/pademu
$(MAKE) -C $< USE_USB=1
$(EE_ASM_DIR)xbox360usb.s: modules/pademu/xbox360usb/xbox360usb.irx
$(BIN2S) $< $@ xbox360usb_irx

modules/pademu/xboxoneusb/xboxoneusb.irx: modules/pademu/xboxoneusb
$(MAKE) -C $<

$(EE_ASM_DIR)xboxoneusb.s: modules/pademu/xboxoneusb/xboxoneusb.irx
$(BIN2S) $< $@ xboxoneusb_irx

modules/pademu/ds3bt/ds3bt.irx: modules/pademu/ds3bt
$(MAKE) -C $<

$(EE_ASM_DIR)ds3bt.s: modules/pademu/ds3bt/ds3bt.irx
$(BIN2S) $< $@ ds3bt_irx

modules/pademu/ds4bt/ds4bt.irx: modules/pademu/ds4bt
$(MAKE) -C $<

$(EE_ASM_DIR)ds4bt.s: modules/pademu/ds4bt/ds4bt.irx
$(BIN2S) $< $@ ds4bt_irx

modules/pademu/hidusb/hidusb.irx: modules/pademu/hidusb
$(MAKE) -C $<

$(EE_ASM_DIR)usb_pademu.s: modules/pademu/usb_pademu.irx
$(BIN2S) $< $@ usb_pademu_irx
$(EE_ASM_DIR)hidusb.s: modules/pademu/hidusb/hidusb.irx
$(BIN2S) $< $@ hidusb_irx

$(EE_ASM_DIR)usbhdfsd.s: $(PS2SDK)/iop/irx/usbhdfsd.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ usbhdfsd_irx
Expand Down
1 change: 1 addition & 0 deletions ee_core/include/ee_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ int EnableCheatOp;
#ifdef PADEMU
int EnablePadEmuOp;
int PadEmuSettings;
int PadEmuModules;
#endif

int DisableDebug;
Expand Down
8 changes: 8 additions & 0 deletions ee_core/include/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ enum OPL_MODULE_ID {
OPL_MODULE_ID_MCEMU,

OPL_MODULE_ID_PADEMU,
OPL_MODULE_ID_BTSTACK,
OPL_MODULE_ID_DS3USB,
OPL_MODULE_ID_DS4USB,
OPL_MODULE_ID_XBOX360USB,
OPL_MODULE_ID_XBOXONEUSB,
OPL_MODULE_ID_DS3BT,
OPL_MODULE_ID_DS4BT,
OPL_MODULE_ID_HIDUSB,

//Debugging modules
OPL_MODULE_ID_UDPTTY,
Expand Down
30 changes: 30 additions & 0 deletions ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,38 @@ int New_Reset_Iop(const char *arg, int arglen)
}

#ifdef PADEMU
int btstack_loaded = 0;
if (iop_reboot_count >= 2 && EnablePadEmuOp) {
LoadOPLModule(OPL_MODULE_ID_PADEMU, 0, 4, (char *)&PadEmuSettings);
if (PadEmuModules & (1 << 0)) {
LoadOPLModule(OPL_MODULE_ID_DS3USB, 0, 0, NULL);
}
if (PadEmuModules & (1 << 1)) {
if (!btstack_loaded) {
LoadOPLModule(OPL_MODULE_ID_BTSTACK, 0, 0, NULL);
btstack_loaded = 1;
}
LoadOPLModule(OPL_MODULE_ID_DS3BT, 0, 0, NULL);
}
if (PadEmuModules & (1 << 2)) {
LoadOPLModule(OPL_MODULE_ID_DS4USB, 0, 0, NULL);
}
if (PadEmuModules & (1 << 3)) {
if (!btstack_loaded) {
LoadOPLModule(OPL_MODULE_ID_BTSTACK, 0, 0, NULL);
btstack_loaded = 1;
}
LoadOPLModule(OPL_MODULE_ID_DS4BT, 0, 0, NULL);
}
if (PadEmuModules & (1 << 4)) {
LoadOPLModule(OPL_MODULE_ID_XBOX360USB, 0, 0, NULL);
}
if (PadEmuModules & (1 << 5)) {
LoadOPLModule(OPL_MODULE_ID_XBOXONEUSB, 0, 0, NULL);
}
if (PadEmuModules & (1 << 6)) {
LoadOPLModule(OPL_MODULE_ID_HIDUSB, 0, 0, NULL);
}
}
#endif

Expand Down
1 change: 1 addition & 0 deletions ee_core/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static int eecoreInit(int argc, char **argv)
DPRINTF("PADEMU = %s\n", EnablePadEmuOp == 0 ? "Disabled" : "Enabled");

PadEmuSettings = _strtoi(_strtok(NULL, " "));
PadEmuModules = _strtoi(_strtok(NULL, " "));
#endif

i++;
Expand Down
1 change: 1 addition & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum CONFIG_INDEX {
#define CONFIG_ITEM_PADEMUSOURCE "$PADEMUSource"
#define CONFIG_ITEM_ENABLEPADEMU "$EnablePadEmu"
#define CONFIG_ITEM_PADEMUSETTINGS "$PadEmuSettings"
#define CONFIG_ITEM_PADEMUMODULES "$PadEmuModules"

//OPL config keys
#define CONFIG_OPL_THEME "theme"
Expand Down
5 changes: 3 additions & 2 deletions include/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ enum UI_ITEMS {
PADCFG_PADEMU_SOURCE,
PADCFG_PADEMU_CONFIG,
PADCFG_PADEMU_ENABLE,
PADCFG_PADEMU_MODE,
PADCFG_PADEMU_MODULES_LIST,
PADCFG_PADEMU_PORT,
PADCFG_PADEMU_VIB,
PADCFG_PADPORT,
Expand All @@ -157,8 +157,9 @@ enum UI_ITEMS {
PADCFG_PADEMU_MTAP_PORT,
PADCFG_PADEMU_WORKAROUND,
PADCFG_PADEMU_WORKAROUND_STR,
PADCFG_PADEMU_MODULES_SET,

COMPAT_MODE_BASE = 250,
COMPAT_MODE_BASE = 251,
#else
COMPAT_MODE_BASE = 200,
#endif
Expand Down
29 changes: 25 additions & 4 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ extern int size_apemodpatch_irx;
extern void *audsrv_irx;
extern int size_audsrv_irx;

extern void *bt_pademu_irx;
extern int size_bt_pademu_irx;
extern void *btstack_irx;
extern int size_btstack_irx;

extern void *cdvdfsv_irx;
extern int size_cdvdfsv_irx;
Expand All @@ -34,6 +34,18 @@ extern int size_ds34bt_irx;
extern void *ds34usb_irx;
extern int size_ds34usb_irx;

extern void *ds3bt_irx;
extern int size_ds3bt_irx;

extern void *ds3usb_irx;
extern int size_ds3usb_irx;

extern void *ds4bt_irx;
extern int size_ds4bt_irx;

extern void *ds4usb_irx;
extern int size_ds4usb_irx;

extern void *filexio_irx;
extern int size_filexio_irx;

Expand All @@ -55,6 +67,9 @@ extern int size_hdd_mcemu_irx;
extern void *hdpro_atad_irx;
extern int size_hdpro_atad_irx;

extern void *hidusb_irx;
extern int size_hidusb_irx;

extern void *httpclient_irx;
extern int size_httpclient_irx;

Expand Down Expand Up @@ -94,6 +109,9 @@ extern int size_netman_irx;
extern void *f2techioppatch_irx;
extern int size_f2techioppatch_irx;

extern void *pademu_irx;
extern int size_pademu_irx;

extern void *padman_irx;
extern int size_padman_irx;

Expand Down Expand Up @@ -181,8 +199,11 @@ extern int size_usbhdfsdfsv_irx;
extern void *usb_mcemu_irx;
extern int size_usb_mcemu_irx;

extern void *usb_pademu_irx;
extern int size_usb_pademu_irx;
extern void *xbox360usb_irx;
extern int size_xbox360usb_irx;

extern void *xboxoneusb_irx;
extern int size_xboxoneusb_irx;

extern void *xhdd_irx;
extern int size_xhdd_irx;
Expand Down
7 changes: 3 additions & 4 deletions include/lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ enum _STR_IDS {
_STR_PADEMU_SETTINGS,
_STR_PADEMU_ENABLE,
_STR_HINT_PADEMU_ENABLE,
_STR_PADEMU_MODE,
_STR_HINT_PADEMU_MODE,
_STR_DS34USB_MODE,
_STR_DS34BT_MODE,
_STR_PADEMU_MODULES,
_STR_HINT_PADEMU_MODULES,
_STR_HINT_PADEMU_MODULES_SET,
_STR_PADPORT,
_STR_HINT_PAD_PORT,
_STR_PADEMU_PORT,
Expand Down
1 change: 1 addition & 0 deletions include/opl.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ int showCfgPopup;
#ifdef PADEMU
int gEnablePadEmu;
int gPadEmuSettings;
int gPadEmuModules;
#endif

// ------------------------------------------------------------------------------------------------------------------------
Expand Down
16 changes: 2 additions & 14 deletions modules/pademu/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@

IOP_BIN = pademu.irx
IOP_OBJS = pademu.o sys_utils.o imports.o exports.o

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

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

ifeq ($(VMC),1)
IOP_CFLAGS += -DVMC
Expand Down
22 changes: 22 additions & 0 deletions modules/pademu/btstack/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

IOP_BIN = btstack.irx
IOP_OBJS = btstack.o imports.o exports.o
IOP_OBJS_DIR = obj.btstack/

IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)

IOP_CFLAGS += -Wall -fno-builtin -DUSE_SMSUTILS
IOP_LDFLAGS += -s

all: OBJ_DIR $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS)

rebuild: clean all

OBJ_DIR:
mkdir -p $(IOP_OBJS_DIR)

include $(PS2SDK)/Defs.make
include ../Rules.make
Loading

0 comments on commit 7dec2db

Please sign in to comment.