From 87d50a83853998c054643819a2906958139e67a1 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Mon, 31 Aug 2026 00:14:51 -0500 Subject: [PATCH 1/4] fix: [rmman] copy to output buffer correctly --- iop/input/rmman/src/rmman.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iop/input/rmman/src/rmman.c b/iop/input/rmman/src/rmman.c index 3ee2a979b0e7..546012784042 100644 --- a/iop/input/rmman/src/rmman.c +++ b/iop/input/rmman/src/rmman.c @@ -513,12 +513,10 @@ static int PollRemote(struct RmData *RmData) return 0; } #ifdef BUILDING_RMMANX - RmData->outBuffer[0] = rmbuf[0]; - for (i = 1; i < 5; i += 1) + for (i = 0; i < 5; i += 1) { - RmData->outBuffer[i] = rmbuf[(i - 1) * 2]; + RmData->outBuffer[i] = rmbuf[i * 2]; } - RmData->outBuffer[4] = rmbuf[8]; #else for (i = 0; i < 4; i += 1) { From 620ababc3256dc66b959b94796b9d0ead807ea8e Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Mon, 31 Aug 2026 00:15:24 -0500 Subject: [PATCH 2/4] feat: support DESR front button and extra remote commands --- ee/rpc/remote/include/librm.h | 21 +++++++++++++++++++++ ee/rpc/remote/src/librm.c | 15 ++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ee/rpc/remote/include/librm.h b/ee/rpc/remote/include/librm.h index 45cfcd4a358b..875be570cbe0 100644 --- a/ee/rpc/remote/include/librm.h +++ b/ee/rpc/remote/include/librm.h @@ -22,6 +22,7 @@ struct remote_data { u32 status; u32 button; + u32 front_button; }; /** @@ -199,6 +200,15 @@ struct remote_data #define RM_DESR_FLASH_FORW 0x0050D793 /** @} */ +/** @name Additional DESR remote commands that Dragon or DVRP responds to + */ +/** @{ */ +#define RM_DESR_DVRP_UNK 0x00E0D493 +#define RM_DESR_POWER_ON 0x00E0D293 +#define RM_DESR_POWER_OFF 0x00F0D293 +#define RM_DESR_NOLIGHT 0x00F0D793 +/** @} */ + /** @name Different modes depending on the switch for RMT-Pxxx */ /** @{ */ @@ -207,6 +217,17 @@ struct remote_data #define RM_DESR_MODE_3 0x000000A3 /** @} */ +/** @name Definitions for front buttons on DESR + */ +/** @{ */ +#define RM_DESR_FB_HOME 0x00000001 +#define RM_DESR_FB_UP 0x00000002 +#define RM_DESR_FB_DOWN 0x00000003 +#define RM_DESR_FB_LEFT 0x00000004 +#define RM_DESR_FB_RIGHT 0x00000005 +#define RM_DESR_FB_ENTER 0x00000006 +/** @} */ + /** @name Additional BD remote commands (from RMT-B119A) */ /** @{ */ diff --git a/ee/rpc/remote/src/librm.c b/ee/rpc/remote/src/librm.c index fcc329a2b16e..fdb8988a6bd9 100644 --- a/ee/rpc/remote/src/librm.c +++ b/ee/rpc/remote/src/librm.c @@ -321,17 +321,10 @@ void RMMan_Read(int port, int slot, struct remote_data *data) if (rmman_type == 2) { - int status; - int button; - status = RM_READY; - button = 0; - if (pdata->data[0] == 0x14) - { - status = RM_KEYPRESSED; - button = pdata->data[1] | (pdata->data[2] << 8) | (pdata->data[3] << 16); - } - data->status = status; - data->button = button; + data->status = (pdata->data[0] == 0x14) ? RM_KEYPRESSED : RM_READY; + data->button = (data->status == RM_KEYPRESSED) ? (pdata->data[1] | (pdata->data[2] << 8) | ((pdata->data[3] & ~7) << 16)) : 0; + /* rmman2 bitwise ORs into the unused four bits, while rmmanx separates it out into tne next element */ + data->front_button = (pdata->data[3] & 7) | pdata->data[4]; } else { From 010710bd315882e38a471bca7258e07ccb8becba Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Mon, 31 Aug 2026 00:16:00 -0500 Subject: [PATCH 3/4] fix: [librm] correct reset command --- ee/rpc/remote/include/librm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/rpc/remote/include/librm.h b/ee/rpc/remote/include/librm.h index 875be570cbe0..c702ada88ae4 100644 --- a/ee/rpc/remote/include/librm.h +++ b/ee/rpc/remote/include/librm.h @@ -98,9 +98,9 @@ struct remote_data /** @{ */ #define RM_PS2_POWER 0x0050D1DA /* 21 */ #define RM_PS2_EJECT 0x0060D1DA -#define RM_PS2_RESET 0x0070D1DA #define RM_PS2_POWERON 0x00E0D2DA /* 46 */ #define RM_PS2_POWEROFF 0x00F0D2DA +#define RM_PS2_RESET 0x0010D7DA #define RM_PS2_NOLIGHT 0x0050D7DA /** @}*/ From 55ae1bad2da7a55d0742915e6844f860f08d5cf1 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Mon, 31 Aug 2026 00:16:47 -0500 Subject: [PATCH 4/4] feat: add support for rmman2 to remote sample --- ee/rpc/remote/samples/Makefile.sample | 7 +- ee/rpc/remote/samples/remote.c | 438 +++++++++++++++++--------- 2 files changed, 294 insertions(+), 151 deletions(-) diff --git a/ee/rpc/remote/samples/Makefile.sample b/ee/rpc/remote/samples/Makefile.sample index a2d261daed6b..4c43ea113511 100644 --- a/ee/rpc/remote/samples/Makefile.sample +++ b/ee/rpc/remote/samples/Makefile.sample @@ -7,13 +7,13 @@ # Review ps2sdk README & LICENSE files for further details. EE_BIN = remote_sample.elf -EE_OBJS = remote.o SIO2MAN_irx.o RMMAN_irx.o +EE_OBJS = remote.o SIO2MAN_irx.o RMMAN_irx.o RMMAN2_irx.o EE_LIBS = -ldebug -lrm -lpatches all: $(EE_BIN) clean: - rm -f $(EE_BIN) $(EE_OBJS) SIO2MAN_irx.c RMMAN_irx.c + rm -f $(EE_BIN) $(EE_OBJS) SIO2MAN_irx.c RMMAN_irx.c RMMAN2_irx.c SIO2MAN_irx.c: bin2c $(PS2SDK)/iop/irx/rsio2man.irx SIO2MAN_irx.c SIO2MAN_irx @@ -21,5 +21,8 @@ SIO2MAN_irx.c: RMMAN_irx.c: bin2c $(PS2SDK)/iop/irx/rmman.irx RMMAN_irx.c RMMAN_irx +RMMAN2_irx.c: + bin2c $(PS2SDK)/iop/irx/rmman2.irx RMMAN2_irx.c RMMAN2_irx + include $(PS2SDK)/samples/Makefile.pref include $(PS2SDK)/samples/Makefile.eeglobal diff --git a/ee/rpc/remote/samples/remote.c b/ee/rpc/remote/samples/remote.c index e503ae6aa0f6..ae5ca9c90777 100644 --- a/ee/rpc/remote/samples/remote.c +++ b/ee/rpc/remote/samples/remote.c @@ -19,6 +19,7 @@ #include #include #include +#include extern unsigned char SIO2MAN_irx[]; extern unsigned int size_SIO2MAN_irx; @@ -26,6 +27,9 @@ extern unsigned int size_SIO2MAN_irx; extern unsigned char RMMAN_irx[]; extern unsigned int size_RMMAN_irx; +extern unsigned char RMMAN2_irx[]; +extern unsigned int size_RMMAN2_irx; + static int VblankStartSema, VblankEndSema; static s32 VblankStartHandler(s32 cause) @@ -74,17 +78,46 @@ void loadmodules(int free) } else { + int minver_50000; sbv_patch_enable_lmb(); + { + u8 out[16]; + u8 in[16]; - if (SifExecModuleBuffer(SIO2MAN_irx, size_SIO2MAN_irx, 0, NULL, NULL) < 0) + in[0] = 0x00; + // sceCdMV + sceCdApplySCmd(0x03, in, 1, out); + minver_50000 = (out[0] & 0x80) ? 0 : ((out[3] | (out[2] << 8) | (out[1] << 16)) >= 0x50000); + } + if (minver_50000) { - scr_printf("Failed to load SIO2MAN!\n"); - SleepThread(); + { + u8 out[16]; + u8 in[16]; + + in[0] = 0; + // sceCdNoticeGameStart + // Needed for front button readout for compatible systems + sceCdApplySCmd(0x29, in, 1, out); + } + if (SifExecModuleBuffer(RMMAN2_irx, size_RMMAN2_irx, 0, NULL, NULL) < 0) + { + scr_printf("Failed to load RMMAN2!\n"); + SleepThread(); + } } - if (SifExecModuleBuffer(RMMAN_irx, size_RMMAN_irx, 0, NULL, NULL) < 0) + else { - scr_printf("Failed to load RMMAN!\n"); - SleepThread(); + if (SifExecModuleBuffer(SIO2MAN_irx, size_SIO2MAN_irx, 0, NULL, NULL) < 0) + { + scr_printf("Failed to load SIO2MAN!\n"); + SleepThread(); + } + if (SifExecModuleBuffer(RMMAN_irx, size_RMMAN_irx, 0, NULL, NULL) < 0) + { + scr_printf("Failed to load RMMAN!\n"); + SleepThread(); + } } } @@ -108,145 +141,243 @@ static const char *getRmStatus(u32 status) } } +#define RMCASE(val) case val: return #val + static const char *getRmButton(u32 button) { switch (button) { - case RM_DVD_ONE: - return "RM_DVD_ONE"; - case RM_DVD_TWO: - return "RM_DVD_TWO"; - case RM_DVD_THREE: - return "RM_DVD_THREE"; - case RM_DVD_FOUR: - return "RM_DVD_FOUR"; - case RM_DVD_FIVE: - return "RM_DVD_FIVE"; - case RM_DVD_SIX: - return "RM_DVD_SIX"; - case RM_DVD_SEVEN: - return "RM_DVD_SEVEN"; - case RM_DVD_EIGHT: - return "RM_DVD_EIGHT"; - case RM_DVD_NINE: - return "RM_DVD_NINE"; - case RM_DVD_ZERO: - return "RM_DVD_ZERO"; - case RM_DVD_ENTER: - return "RM_DVD_ENTER"; - case RM_DVD_BROWSE: - return "RM_DVD_BROWSE"; - case RM_DVD_SET: - return "RM_DVD_SET"; - case RM_DVD_RETURN: - return "RM_DVD_RETURN"; - case RM_DVD_CLEAR: - return "RM_DVD_CLEAR"; - case RM_DVD_SOURCE: - return "RM_DVD_SOURCE"; - case RM_DVD_CHUP: - return "RM_DVD_CHUP"; - case RM_DVD_CHDOWN: - return "RM_DVD_CHDOWN"; - case RM_DVD_REC: - return "RM_DVD_REC"; - case RM_DVD_TITLE: - return "RM_DVD_TITLE"; - case RM_DVD_MENU: - return "RM_DVD_MENU"; - case RM_DVD_PROGRAM: - return "RM_DVD_PROGRAM"; - case RM_DVD_TIME: - return "RM_DVD_TIME"; - case RM_DVD_ATOB: - return "RM_DVD_ATOB"; - case RM_DVD_REPEAT: - return "RM_DVD_REPEAT"; - case RM_DVD_PREV: - return "RM_DVD_PREV"; - case RM_DVD_NEXT: - return "RM_DVD_NEXT"; - case RM_DVD_PLAY: - return "RM_DVD_PLAY"; - case RM_DVD_SCAN_BACK: - return "RM_DVD_SCAN_BACK"; - case RM_DVD_SCAN_FORW: - return "RM_DVD_SCAN_FORW"; - case RM_DVD_SHUFFLE: - return "RM_DVD_SHUFFLE"; - case RM_DVD_STOP: - return "RM_DVD_STOP"; - case RM_DVD_PAUSE: - return "RM_DVD_PAUSE"; - case RM_DVD_DISPLAY: - return "RM_DVD_DISPLAY"; - case RM_DVD_SLOW_BACK: - return "RM_DVD_SLOW_BACK"; - case RM_DVD_SLOW_FORW: - return "RM_DVD_SLOW_FORW"; - case RM_DVD_SUBTITLE: - return "RM_DVD_SUBTITLE"; - case RM_DVD_AUDIO: - return "RM_DVD_AUDIO"; - case RM_DVD_ANGLE: - return "RM_DVD_ANGLE"; - case RM_DVD_UP: - return "RM_DVD_UP"; - case RM_DVD_DOWN: - return "RM_DVD_DOWN"; - case RM_DVD_LEFT: - return "RM_DVD_LEFT"; - case RM_DVD_RIGHT: - return "RM_DVD_RIGHT"; - case RM_PS2_RESET: - return "RM_PS2_RESET"; - case RM_PS2_EJECT: - return "RM_PS2_EJECT"; - case RM_PS2_POWERON: - return "RM_PS2_POWERON"; - case RM_PS2_POWEROFF: - return "RM_PS2_POWEROFF"; - case RM_PS2_SELECT: - return "RM_PS2_SELECT"; - case RM_PS2_L3: - return "RM_PS2_L3"; - case RM_PS2_R3: - return "RM_PS2_R3"; - case RM_PS2_START: - return "RM_PS2_START"; - case RM_PS2_UP: - return "RM_PS2_UP"; - case RM_PS2_RIGHT: - return "RM_PS2_RIGHT"; - case RM_PS2_DOWN: - return "RM_PS2_DOWN"; - case RM_PS2_LEFT: - return "RM_PS2_LEFT"; - case RM_PS2_L2: - return "RM_PS2_L2"; - case RM_PS2_R2: - return "RM_PS2_R2"; - case RM_PS2_L1: - return "RM_PS2_L1"; - case RM_PS2_R1: - return "RM_PS2_R1"; - case RM_PS2_TRIANGLE: - return "RM_PS2_TRIANGLE"; - case RM_PS2_CIRCLE: - return "RM_PS2_CIRCLE"; - case RM_PS2_CROSS: - return "RM_PS2_CROSS"; - case RM_PS2_SQUARE: - return "RM_PS2_SQUARE"; - case RM_RELEASED: - return "RM_RELEASED"; - case RM_IDLE: - return "RM_IDLE"; + RMCASE(RM_DVD_ONE); + RMCASE(RM_DVD_TWO); + RMCASE(RM_DVD_THREE); + RMCASE(RM_DVD_FOUR); + RMCASE(RM_DVD_FIVE); + RMCASE(RM_DVD_SIX); + RMCASE(RM_DVD_SEVEN); + RMCASE(RM_DVD_EIGHT); + RMCASE(RM_DVD_NINE); + RMCASE(RM_DVD_ZERO); + RMCASE(RM_DVD_ENTER); + RMCASE(RM_DVD_BROWSE); + RMCASE(RM_DVD_SET); + RMCASE(RM_DVD_RETURN); + RMCASE(RM_DVD_CLEAR); + RMCASE(RM_DVD_SOURCE); + RMCASE(RM_DVD_CHUP); + RMCASE(RM_DVD_CHDOWN); + RMCASE(RM_DVD_REC); + RMCASE(RM_DVD_TITLE); + RMCASE(RM_DVD_MENU); + RMCASE(RM_DVD_PROGRAM); + RMCASE(RM_DVD_TIME); + RMCASE(RM_DVD_ATOB); + RMCASE(RM_DVD_REPEAT); + RMCASE(RM_DVD_PREV); + RMCASE(RM_DVD_NEXT); + RMCASE(RM_DVD_PLAY); + RMCASE(RM_DVD_SCAN_BACK); + RMCASE(RM_DVD_SCAN_FORW); + RMCASE(RM_DVD_SHUFFLE); + RMCASE(RM_DVD_STOP); + RMCASE(RM_DVD_PAUSE); + RMCASE(RM_DVD_DISPLAY); + RMCASE(RM_DVD_SLOW_BACK); + RMCASE(RM_DVD_SLOW_FORW); + RMCASE(RM_DVD_SUBTITLE); + RMCASE(RM_DVD_AUDIO); + RMCASE(RM_DVD_ANGLE); + RMCASE(RM_DVD_UP); + RMCASE(RM_DVD_DOWN); + RMCASE(RM_DVD_LEFT); + RMCASE(RM_DVD_RIGHT); + RMCASE(RM_PS2_POWER); + RMCASE(RM_PS2_EJECT); + RMCASE(RM_PS2_POWERON); + RMCASE(RM_PS2_POWEROFF); + RMCASE(RM_PS2_RESET); + RMCASE(RM_PS2_NOLIGHT); + RMCASE(RM_PS2_SELECT); + RMCASE(RM_PS2_L3); + RMCASE(RM_PS2_R3); + RMCASE(RM_PS2_START); + RMCASE(RM_PS2_UP); + RMCASE(RM_PS2_RIGHT); + RMCASE(RM_PS2_DOWN); + RMCASE(RM_PS2_LEFT); + RMCASE(RM_PS2_L2); + RMCASE(RM_PS2_R2); + RMCASE(RM_PS2_L1); + RMCASE(RM_PS2_R1); + RMCASE(RM_PS2_TRIANGLE); + RMCASE(RM_PS2_CIRCLE); + RMCASE(RM_PS2_CROSS); + RMCASE(RM_PS2_SQUARE); + RMCASE(RM_DVD_OPEN_CLOSE); + RMCASE(RM_DVD_POWER); + RMCASE(RM_DVD_SEARCH_MODE); + RMCASE(RM_DVD_SUBTITLE_ON_OFF); + RMCASE(RM_DVD_STEP_BACK); + RMCASE(RM_DVD_STEP_FORWARD); + RMCASE(RM_DVD_SET_UP); + RMCASE(RM_DESR_EJECT); + RMCASE(RM_DESR_G_GUIDE); + RMCASE(RM_DESR_QUIT_GAME); + RMCASE(RM_DESR_POWER); + RMCASE(RM_DESR_1); + RMCASE(RM_DESR_2); + RMCASE(RM_DESR_3); + RMCASE(RM_DESR_4); + RMCASE(RM_DESR_5); + RMCASE(RM_DESR_6); + RMCASE(RM_DESR_7); + RMCASE(RM_DESR_8); + RMCASE(RM_DESR_9); + RMCASE(RM_DESR_10); + RMCASE(RM_DESR_11); + RMCASE(RM_DESR_12); + RMCASE(RM_DESR_BS_7); + RMCASE(RM_DESR_BS_11); + RMCASE(RM_DESR_CLEAR); + RMCASE(RM_DESR_TOP_MENU); + RMCASE(RM_DESR_MENU); + RMCASE(RM_DESR_RETURN); + RMCASE(RM_DESR_TRIANGLE_OPTION); + RMCASE(RM_DESR_CIRCLE); + RMCASE(RM_DESR_SQUARE_VIEW); + RMCASE(RM_DESR_CROSS_BACK); + RMCASE(RM_DESR_UP); + RMCASE(RM_DESR_LEFT); + RMCASE(RM_DESR_RIGHT); + RMCASE(RM_DESR_DOWN); + RMCASE(RM_DESR_ENTER); + RMCASE(RM_DESR_PROGRAM); + RMCASE(RM_DESR_HOME); + RMCASE(RM_DESR_DISPLAY); + RMCASE(RM_DESR_L1_PREV); + RMCASE(RM_DESR_L3); + RMCASE(RM_DESR_R3); + RMCASE(RM_DESR_R1_NEXT); + RMCASE(RM_DESR_L2_SCAN_BACK); + RMCASE(RM_DESR_SELECT); + RMCASE(RM_DESR_START); + RMCASE(RM_DESR_R2_SCAN_FORW); + RMCASE(RM_DESR_PLAY); + RMCASE(RM_DESR_PAUSE); + RMCASE(RM_DESR_STOP); + RMCASE(RM_DESR_RECORDING_MODE); + RMCASE(RM_DESR_RECORD_START); + RMCASE(RM_DESR_RECORD_PAUSE); + RMCASE(RM_DESR_RECORD_STOP); + RMCASE(RM_DESR_DELETE); + RMCASE(RM_DESR_G_GUIDE2); + RMCASE(RM_DESR_FLASH_BACK); + RMCASE(RM_DESR_FLASH_FORW); + RMCASE(RM_DESR_DVRP_UNK); + RMCASE(RM_DESR_POWER_ON); + RMCASE(RM_DESR_POWER_OFF); + RMCASE(RM_DESR_NOLIGHT); + RMCASE(RM_BD_EJECT); + RMCASE(RM_BD_POWER); + RMCASE(RM_BD_1); + RMCASE(RM_BD_2); + RMCASE(RM_BD_3); + RMCASE(RM_BD_4); + RMCASE(RM_BD_5); + RMCASE(RM_BD_6); + RMCASE(RM_BD_7); + RMCASE(RM_BD_8); + RMCASE(RM_BD_9); + RMCASE(RM_BD_AUDIO); + RMCASE(RM_BD_0); + RMCASE(RM_BD_SUBTITLE); + RMCASE(RM_BD_DISPLAY); + RMCASE(RM_BD_YELLOW); + RMCASE(RM_BD_BLUE); + RMCASE(RM_BD_RED); + RMCASE(RM_BD_GREEN); + RMCASE(RM_BD_TOP_MENU); + RMCASE(RM_BD_POP_UP_MENU); + RMCASE(RM_BD_RETURN); + RMCASE(RM_BD_OPTIONS); + RMCASE(RM_BD_UP); + RMCASE(RM_BD_RIGHT); + RMCASE(RM_BD_DOWN); + RMCASE(RM_BD_LEFT); + RMCASE(RM_BD_ENTER); + RMCASE(RM_BD_HOME); + RMCASE(RM_BD_PREV); + RMCASE(RM_BD_PAUSE); + RMCASE(RM_BD_NEXT); + RMCASE(RM_BD_RWD); + RMCASE(RM_BD_PLAY); + RMCASE(RM_BD_FF); + RMCASE(RM_BD_NETFLIX); + RMCASE(RM_BD_STOP); + RMCASE(RM_BD_SEN); + default: + return "UNKNOWN"; + } +} + +static const char *getRmFrontButton(u32 button) +{ + switch (button) + { + RMCASE(RM_DESR_FB_HOME); + RMCASE(RM_DESR_FB_UP); + RMCASE(RM_DESR_FB_DOWN); + RMCASE(RM_DESR_FB_LEFT); + RMCASE(RM_DESR_FB_RIGHT); + RMCASE(RM_DESR_FB_ENTER); default: return "UNKNOWN"; } } +static int ensureRemoteFilter(void) +{ + int minver_50000; + sbv_patch_enable_lmb(); + { + u8 out[16]; + u8 in[16]; + + in[0] = 0x00; + // sceCdMV + sceCdApplySCmd(0x03, in, 1, out); + minver_50000 = (out[0] & 0x80) ? 0 : ((out[3] | (out[2] << 8) | (out[1] << 16)) >= 0x50000); + } + if (!minver_50000) + return 0; + { + u8 out[16]; + u8 in[16]; + + // Get the current 1-2-3 filter + sceCdApplySCmd(0x2B, in, 0, out); + switch (out[0]) + { + case 1: + case 2: + case 3: + return out[0]; + case 0x80: + return 1; + default: + break; + } + } + { + u8 out[16]; + u8 in[16]; + + in[0] = 1; + // Set the 1-2-3 filter to 1 in case it was not set correctly + sceCdApplySCmd(0x2A, in, 1, out); + } + return 1; +} + int main(int argc, char *argv[]) { /* Buffers for receiving input from remote controllers. A 256-byte region @@ -255,6 +386,7 @@ int main(int argc, char *argv[]) static u8 rmData[256] __attribute__((aligned(64))); struct remote_data data, olddata; int startY, wrap; + int rmset; ee_sema_t sema; /* Initialize RPC services */ @@ -266,24 +398,31 @@ int main(int argc, char *argv[]) /* Initialize graphics library */ init_scr(); - scr_printf("Welcome to the RMMAN sample!\n"); - scr_printf("For this demo, the remote should be plugged into port 2.\n"); + scr_printf("Welcome to the RMMAN/RMMAN2 sample!\n"); scr_printf("Loading modules...\n"); /* Load modules */ - if ((argc == 2) && (strncmp(argv[1], "free", 4) == 0)) + if ((argc >= 2) && !strcmp(argv[1], "rom")) { - scr_printf(" - Using PS2SDK sio2man.irx, rmman.irx modules.\n"); - loadmodules(1); + scr_printf(" - Using ROM0 ADDRV, ROM1 SIO2MAN and ROM1 RMMAN modules.\n"); + loadmodules(0); } else { - scr_printf(" - Using ROM0 ADDRV, ROM1 SIO2MAN and ROM1 RMMAN modules.\n"); - scr_printf("Start this sample with 'free' as an argument to load\n"); - scr_printf("sio2man.irx and rmman.irx\n"); - scr_printf("Example: ps2client execee host:remote_sample.elf free\n"); - loadmodules(0); + scr_printf(" - Using PS2SDK modules.\n"); + scr_printf("Start this sample with 'rom' as an argument to load\n"); + scr_printf("RMMAN ROM modules\n"); + scr_printf("Example: ps2client execee host:remote_sample.elf rom\n"); + loadmodules(1); + } + + rmset = ensureRemoteFilter(); + if (!rmset) + { + rmset = 1; + scr_printf("For this demo, the IR receiver should be plugged into port 2.\n"); } + scr_printf("Ensure the switch on the remote, if present, is set to the %d position.\n", rmset); scr_printf("Initializing...\n"); @@ -338,7 +477,7 @@ int main(int argc, char *argv[]) RMMan_Read(1, 0, &data); /* If there was a difference, print it. */ - if ((olddata.status != data.status) || (olddata.button != data.button)) + if (memcmp(&olddata, &data, sizeof(data))) { olddata = data; @@ -347,8 +486,9 @@ int main(int argc, char *argv[]) if (scr_getY() + 1 >= 27) wrap = 1; - scr_printf("\t%08x (%s)\t%08x (%s)\n", data.status, - getRmStatus(data.status), data.button, getRmButton(data.button)); + scr_printf("\t%08x (%s)\t%08x (%s)\t%08x (%s)\n", data.status, + getRmStatus(data.status), data.button, getRmButton(data.button), + data.front_button, getRmFrontButton(data.front_button)); /* From libdebug itself */ if (wrap)