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

Bring back Modular PADEMU by @belek666 #1008

Draft
wants to merge 44 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
eed8a56
Create Clang-PR.yml
israpps Dec 9, 2022
3621454
Merge branch 'ps2homebrew:master' into master
israpps Jan 9, 2023
111099e
Merge branch 'ps2homebrew:master' into master
israpps Mar 7, 2023
7476010
Merge branch 'ps2homebrew:master' into master
israpps Apr 4, 2023
c9ad882
Merge branch 'ps2homebrew:master' into master
israpps Apr 13, 2023
60a9096
Merge branch 'ps2homebrew:master' into master
israpps Apr 19, 2023
768c197
Merge branch 'ps2homebrew:master' into master
israpps Jun 3, 2023
d7a7075
Merge branch 'ps2homebrew:master' into master
israpps Jun 21, 2023
cd69672
Modular pademu, prototypes of xbox modules and hid joystick module
belek666 May 24, 2020
52ec95a
Fixed the screwed analog inputs in the xbox360usb module
RoloDeOvo Sep 19, 2020
a81912f
Added compatibility list.
RoloDeOvo Sep 19, 2020
cc43437
Deleted current compatibilty list for poor formatting.
RoloDeOvo Sep 19, 2020
7f87f8a
Added a better compatibility list.
RoloDeOvo Sep 19, 2020
db7f2a4
Compatibility list updated. Crazy Taxi confirmed to work
RoloDeOvo Sep 19, 2020
ebf5017
Megaman X Collection confirmed to work with PADEMU
RoloDeOvo Sep 19, 2020
f45088c
Klonoa 2 works with PADEMU but it will infinite load sometimes.
RoloDeOvo Sep 19, 2020
32af273
Jak and Daxter doesn't work with PADEMU
RoloDeOvo Sep 19, 2020
17235cb
Update COMPATIBILITY.md
RoloDeOvo Sep 19, 2020
fb58055
Update COMPATIBILITY.md
RoloDeOvo Sep 19, 2020
8104443
Nights Into Dreams confirmed to work with Xbox PADEMU
RoloDeOvo Sep 23, 2020
dc65962
Alien Hominid works with Xbox PADEMU
RoloDeOvo Sep 23, 2020
b52c341
3 more games confirmed to work with Xbox PADEMU
RoloDeOvo Oct 5, 2020
10ca0d7
RaC 2 confirmed to work with Xbox PADEMU
RoloDeOvo Oct 5, 2020
cbe0ca1
Added some info
RoloDeOvo Oct 5, 2020
8de0446
Update COMPATIBILITY.md
RoloDeOvo Oct 5, 2020
d6e8a90
Red Faction confirmed to work with Xbox PADEMU
RoloDeOvo Oct 5, 2020
c7715e6
THPS4 works with Xbox PADEMU.
RoloDeOvo Oct 5, 2020
7541275
Warriors Orochi 2 works with Xbox PADEMU.
RoloDeOvo Oct 5, 2020
9c93c20
Burnout 2 works with Xbox PADEMU.
RoloDeOvo Oct 5, 2020
3deae19
Sonic Mega Collection Plus works with Xbox PADEMU.
RoloDeOvo Oct 5, 2020
29c8f50
Jak II confirmed to work with Xbox PADEMU
RoloDeOvo Oct 6, 2020
e10b56f
Added devices to compatibility list.
RoloDeOvo Oct 21, 2020
3f901c6
Delete compatibility list from master branch
RoloDeOvo Oct 21, 2020
1ec6e09
clang format
belek666 Oct 23, 2020
6185363
first crude success on getting it compiling...
israpps Jun 23, 2023
5a742cd
rectify `IRX_ID`, printf and `MODNAME` macros
israpps Jun 23, 2023
1296264
Update xboxoneusb.c
israpps Jun 26, 2023
74a6cca
represent pademu modules ID as macros
israpps Jun 26, 2023
59364a4
printf PADEMU args
israpps Jun 26, 2023
6f3f3bf
add "hello" printf to PADEMU modules
israpps Jun 26, 2023
9e925ac
xboxone: fix printf
israpps Jun 26, 2023
b9fd41f
PADEMU: dont import printf if no debug
israpps Jun 26, 2023
d2315af
PADEMU: simplify makefiles
israpps Jun 26, 2023
ffb3e9f
Update pademu.c
israpps Jun 26, 2023
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
30 changes: 30 additions & 0 deletions .github/workflows/Clang-PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI-format-pull-request

# only perform this workflow if a developer manually triggers it from the actions tab
on:
workflow_dispatch:

jobs:
check-format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,c'
clangFormatVersion: 12
inplace: true

- name: Create Pull Request
id: prmaker
uses: peter-evans/create-pull-request@v4
with:
commit-message: "Format source code"
body: "clang-format"
title: "clang-format"
delete-branch: true
branch-suffix: random
add-paths: |
*
72 changes: 61 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,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 @@ -297,8 +298,15 @@ 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 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 @@ -490,17 +498,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)bdm.s: $(PS2SDK)/iop/irx/bdm.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ bdm_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 @@ -87,6 +87,7 @@ extern int EnableCheatOp;
extern int EnablePadEmuOp;
extern int PadEmuSettings;
extern int PadMacroSettings;
extern int PadEmuModules;
#endif

extern int EnableDebug;
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 @@ -25,6 +25,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
38 changes: 37 additions & 1 deletion ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
Some parts of the code are taken from HD Project by Polo
*/

#define PADEMU_MODULES_ID_DS3USB (1 << 0)
#define PADEMU_MODULES_ID_DS3BT (1 << 1)
#define PADEMU_MODULES_ID_DS4USB (1 << 2)
#define PADEMU_MODULES_ID_DS4BT (1 << 3)
#define PADEMU_MODULES_ID_XBOX360USB (1 << 4)
#define PADEMU_MODULES_ID_XBOXONEUSB (1 << 5)
#define PADEMU_MODULES_ID_HIDUSB (1 << 6)
#include <iopcontrol.h>

#include "ee_core.h"
Expand Down Expand Up @@ -184,14 +191,43 @@ int New_Reset_Iop(const char *arg, int arglen)
}

#ifdef PADEMU
int btstack_loaded = 0;
if (iop_reboot_count >= 2 && EnablePadEmuOp) {
char args_for_pademu[8];
memcpy(args_for_pademu, &PadEmuSettings, 4);
memcpy(args_for_pademu + 4, &PadMacroSettings, 4);
LoadOPLModule(OPL_MODULE_ID_PADEMU, 0, sizeof(args_for_pademu), args_for_pademu);
if (PadEmuModules & PADEMU_MODULES_ID_DS3USB) {
LoadOPLModule(OPL_MODULE_ID_DS3USB, 0, 0, NULL);
}
if (PadEmuModules & PADEMU_MODULES_ID_DS3BT) {
if (!btstack_loaded) {
LoadOPLModule(OPL_MODULE_ID_BTSTACK, 0, 0, NULL);
btstack_loaded = 1;
}
LoadOPLModule(OPL_MODULE_ID_DS3BT, 0, 0, NULL);
}
if (PadEmuModules & PADEMU_MODULES_ID_DS4USB) {
LoadOPLModule(OPL_MODULE_ID_DS4USB, 0, 0, NULL);
}
if (PadEmuModules & PADEMU_MODULES_ID_DS4BT) {
if (!btstack_loaded) {
LoadOPLModule(OPL_MODULE_ID_BTSTACK, 0, 0, NULL);
btstack_loaded = 1;
}
LoadOPLModule(OPL_MODULE_ID_DS4BT, 0, 0, NULL);
}
if (PadEmuModules & PADEMU_MODULES_ID_XBOX360USB) {
LoadOPLModule(OPL_MODULE_ID_XBOX360USB, 0, 0, NULL);
}
if (PadEmuModules & PADEMU_MODULES_ID_XBOXONEUSB) {
LoadOPLModule(OPL_MODULE_ID_XBOXONEUSB, 0, 0, NULL);
}
if (PadEmuModules & PADEMU_MODULES_ID_HIDUSB) {
LoadOPLModule(OPL_MODULE_ID_HIDUSB, 0, 0, NULL);
}
}
#endif

DPRINTF("Exiting services...\n");
SifExitIopHeap();
LoadFileExit();
Expand Down
3 changes: 2 additions & 1 deletion ee_core/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int EnableCheatOp;
int EnablePadEmuOp;
int PadEmuSettings;
int PadMacroSettings;
int PadEmuModules;
#endif
int EnableDebug;
int *gCheatList; // Store hooks/codes addr+val pairs
Expand Down Expand Up @@ -108,8 +109,8 @@ static int eecoreInit(int argc, char **argv)
DPRINTF("PADEMU = %s\n", EnablePadEmuOp == 0 ? "Disabled" : "Enabled");

PadEmuSettings = _strtoi(_strtok(NULL, " "));

PadMacroSettings = _strtoi(_strtok(NULL, " "));
PadEmuModules = _strtoi(_strtok(NULL, " "));
#endif
CustomOSDConfigParam.spdifMode = _strtoi(_strtok(NULL, " "));
CustomOSDConfigParam.screenType = _strtoi(_strtok(NULL, " "));
Expand Down
1 change: 1 addition & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ enum CONFIG_INDEX {
#define CONFIG_ITEM_PADEMUSOURCE "$PADEMUSource"
#define CONFIG_ITEM_ENABLEPADEMU "$EnablePadEmu"
#define CONFIG_ITEM_PADEMUSETTINGS "$PadEmuSettings"
#define CONFIG_ITEM_PADEMUMODULES "$PadEmuModules"
#define CONFIG_ITEM_PADMACROSETTINGS "$PadMacroSettings"
#define CONFIG_ITEM_PADMACROSOURCE "$PadMacroSource"

Expand Down
5 changes: 3 additions & 2 deletions include/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,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 @@ -171,6 +171,7 @@ enum UI_ITEMS {
PADCFG_PADEMU_MTAP_PORT,
PADCFG_PADEMU_WORKAROUND,
PADCFG_PADEMU_WORKAROUND_STR,
PADCFG_PADEMU_MODULES_SET,

PADMACRO_GLOBAL_BUTTON,
PADMACRO_CFG_SOURCE,
Expand All @@ -184,7 +185,7 @@ enum UI_ITEMS {
PADMACRO_INVERT_RY,
PADMACRO_TURBO_SPEED,

COMPAT_MODE_BASE = 250,
COMPAT_MODE_BASE = 251,
#else
COMPAT_MODE_BASE = 200,
#endif
Expand Down
20 changes: 20 additions & 0 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ IMPORT_BIN2C(audsrv_irx);

IMPORT_BIN2C(bdm_irx);

IMPORT_BIN2C(btstack_irx);

IMPORT_BIN2C(bdm_cdvdman_irx);

IMPORT_BIN2C(bdm_mcemu_irx);
Expand All @@ -28,6 +30,14 @@ IMPORT_BIN2C(cleareffects_irx);

IMPORT_BIN2C(deci2_img);

IMPORT_BIN2C(ds3bt_irx);

IMPORT_BIN2C(ds3usb_irx);

IMPORT_BIN2C(ds4bt_irx);

IMPORT_BIN2C(ds4usb_irx);

IMPORT_BIN2C(drvtif_irx);

IMPORT_BIN2C(drvtif_ingame_irx);
Expand All @@ -42,6 +52,8 @@ IMPORT_BIN2C(genvmc_irx);

IMPORT_BIN2C(hdd_cdvdman_irx);

IMPORT_BIN2C(hidusb_irx);

IMPORT_BIN2C(hdd_hdpro_cdvdman_irx);

IMPORT_BIN2C(lwnbdsvr_irx);
Expand All @@ -68,6 +80,10 @@ IMPORT_BIN2C(isofs_irx);

IMPORT_BIN2C(iremsndpatch_irx);

IMPORT_BIN2C(pademu_irx);

IMPORT_BIN2C(padman_irx);

IMPORT_BIN2C(libsd_irx);

IMPORT_BIN2C(mcman_irx);
Expand Down Expand Up @@ -126,6 +142,10 @@ IMPORT_BIN2C(udptty_irx);

IMPORT_BIN2C(udptty_ingame_irx);

IMPORT_BIN2C(xbox360usb_irx);

IMPORT_BIN2C(xboxoneusb_irx);

IMPORT_BIN2C(udnl_irx);

IMPORT_BIN2C(usbd_irx);
Expand Down
1 change: 1 addition & 0 deletions include/opl.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ extern int showCfgPopup;
#ifdef PADEMU
extern int gEnablePadEmu;
extern int gPadEmuSettings;
extern int gPadEmuModules;
extern int gPadMacroSource;
extern int gPadMacroSettings;
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/ds34common.h → include/pademu_common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _DS34COMMON_H_
#define _DS34COMMON_H_
#ifndef _PADEMU_COMMON_
#define _PADEMU_COMMON_
#include <stdint.h>

#define USB_CLASS_WIRELESS_CONTROLLER 0xE0
Expand Down
6 changes: 6 additions & 0 deletions lng_tmpl/_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -670,3 +670,9 @@ gui_strings:
string: Default Theme Music
- label: DEF_BGM_PATH_HINT
string: Set path to stream music for internal theme.
- label: PADEMU_MODULES
string: Select modules to load
- label: HINT_PADEMU_MODULES
string: Select which pademu modules to load.
- label: HINT_PADEMU_MODULES_SET
string: Select/Unselect pademu module.
5 changes: 5 additions & 0 deletions modules/Rules.bin.make
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ rebuild: clean all

run:
ps2client -t 1 execiop host:$(IOP_BIN)

ifdef DEBUG
$(info debug enabled)
IOP_CFLAGS += -DDEBUG=$(DEBUG)
endif
2 changes: 1 addition & 1 deletion modules/ds34bt/iop/ds34bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "irx.h"

#include <ds34common.h>
#include <pademu_common.h>

#define DS3 0
#define DS4 1
Expand Down
2 changes: 1 addition & 1 deletion modules/ds34usb/iop/ds34usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "irx.h"

#include <ds34common.h>
#include <pademu_common.h>

#define DS3 0
#define DS4 1
Expand Down
17 changes: 3 additions & 14 deletions modules/pademu/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
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_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_BIN = pademu.irx
IOP_OBJS = pademu.o sys_utils.o padmacro.o imports.o exports.o
IOP_OBJS_DIR = obj.pademu/

ifeq ($(VMC),1)
IOP_CFLAGS += -DVMC
Expand Down
Loading