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

add support for USB joysticks #15

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9dc293f
add Input Menu; mv some features from Core Menu to Input Menu
valentecaio Jun 11, 2020
02d2886
add support for USB joystick
valentecaio Jul 15, 2020
53cdc9b
multiplayer working with default button mapping and USB joystick for …
valentecaio Jul 17, 2020
569dc0f
handling the mapping of buttons dynamically at startup time, using fi…
valentecaio Jul 18, 2020
0901318
add some menus for profile config, and move button mapping from contr…
valentecaio Jul 26, 2020
91cb945
button remapping working (for USB controllers)
valentecaio Jul 26, 2020
c0df13a
add option to abort button remapping by pressing native B button
valentecaio Jul 26, 2020
146de9b
enable gamepad in menus
valentecaio Jul 26, 2020
8823c16
select+start to open menu (useful for gamepads)
valentecaio Jul 26, 2020
cb4f6f0
add some hints to menus and rename some menus
valentecaio Jul 26, 2020
e32d2e4
same GUI menu for js1 and js2; add profile restore to defaults feature
valentecaio Aug 3, 2020
c021050
now we can remap native buttons (using profiles)
valentecaio Aug 3, 2020
1760933
analogs deadzone from settings working
valentecaio Aug 3, 2020
8c3b361
d-pad cannot be remapped
valentecaio Aug 3, 2020
f0e1c06
better feedback when remapping all buttons of a profile
valentecaio Aug 3, 2020
fd7c86f
better feedback when remapping a single button of a profile
valentecaio Aug 3, 2020
0a2ec56
add option to edit profile directly from js_config_menu
valentecaio Aug 3, 2020
cc2e5cf
fix KEYUP event to reset d-pad on release
valentecaio Aug 5, 2020
c568973
Create README.md
valentecaio May 3, 2023
afcc397
Update README.md
valentecaio Jan 5, 2024
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# RG350_pcsx4all
PSX emulator for RG350 console

This is my personal fork of the PSX emulator for RG350 console.
I added external gamepad support, button remapping and multiplayer features.

More information:
* [Demonstrational video](https://youtu.be/pUxY2keI0rg)
* [Release notes](https://telegra.ph/Multiplayer-PSX-on-the-RG350-handheld-pcsx4all-emulator-08-04)

4 changes: 2 additions & 2 deletions src/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ int SaveState(const char *file) {
|| mdecFreeze(f, FREEZE_SAVE) )
goto error;

if (freeze_rw(f, FREEZE_SAVE, &player_controller[0], sizeof(struct ps1_controller)))
if (freeze_rw(f, FREEZE_SAVE, &controllers[0], sizeof(struct ps1_controller)))
goto error;

if (SaveFuncs.close(f)) {
Expand Down Expand Up @@ -900,7 +900,7 @@ int LoadState(const char *file) {
mdecFreeze(f, FREEZE_LOAD) )
goto error;

if (freeze_rw(f, FREEZE_LOAD, &player_controller[0], sizeof(struct ps1_controller)))
if (freeze_rw(f, FREEZE_LOAD, &controllers[0], sizeof(struct ps1_controller)))
{
goto error;
}
Expand Down
46 changes: 23 additions & 23 deletions src/pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ unsigned char PAD1_poll(unsigned char value) {
// Don't enable Analog/Vibration for a Digital or DualAnalog controller
CurCmd = value;
g.CurByte1++;
if (player_controller[0].pad_controllertype != PSE_PAD_TYPE_ANALOGPAD) {
if (controllers[0].pad_controllertype != PSE_PAD_TYPE_ANALOGPAD) {
CurCmd = CMD_READ_DATA_AND_VIBRATE;
}
g.CmdLen1 = 8;
Expand All @@ -116,7 +116,7 @@ unsigned char PAD1_poll(unsigned char value) {
return 0xF3;
case CMD_QUERY_MODEL_AND_MODE:
buf = stdmodel;
buf[4] = player_controller[0].pad_mode;
buf[4] = controllers[0].pad_mode;
return 0xF3;
case CMD_QUERY_ACT:
buf = unk46;
Expand All @@ -131,7 +131,7 @@ unsigned char PAD1_poll(unsigned char value) {
buf = unk4d;
return 0xF3;
case CMD_CONFIG_MODE:
if (player_controller[0].configmode) {
if (controllers[0].configmode) {
buf = stdcfg;
return 0xF3;
}
Expand All @@ -147,18 +147,18 @@ unsigned char PAD1_poll(unsigned char value) {
* and Dualshock features won't work.
* */

if (player_controller[0].pad_mode == 1) {
buf[4] = player_controller[0].joy_right_ax0;
buf[5] = player_controller[0].joy_right_ax1;
buf[6] = player_controller[0].joy_left_ax0;
buf[7] = player_controller[0].joy_left_ax1;
if (controllers[0].pad_mode == 1) {
buf[4] = controllers[0].joy_right_ax0;
buf[5] = controllers[0].joy_right_ax1;
buf[6] = controllers[0].joy_left_ax0;
buf[7] = controllers[0].joy_left_ax1;
}
else
{
g.CmdLen1 = 4;
}

return player_controller[0].id;
return controllers[0].id;
}
}

Expand All @@ -168,12 +168,12 @@ unsigned char PAD1_poll(unsigned char value) {
if (g.CurByte1 == 2) {
switch (CurCmd) {
case CMD_CONFIG_MODE:
player_controller[0].configmode = value;
controllers[0].configmode = value;
break;

case CMD_SET_MODE_AND_LOCK:
player_controller[0].pad_mode = value;
player_controller[0].id = value ? 0x73 : 0x41;
controllers[0].pad_mode = value;
controllers[0].id = value ? 0x73 : 0x41;
break;

case CMD_QUERY_ACT:
Expand Down Expand Up @@ -205,25 +205,25 @@ unsigned char PAD1_poll(unsigned char value) {
}
}

if (player_controller[0].pad_controllertype == PSE_PAD_TYPE_ANALOGPAD)
if (controllers[0].pad_controllertype == PSE_PAD_TYPE_ANALOGPAD)
{
switch (CurCmd) {
case CMD_READ_DATA_AND_VIBRATE:
if (g.CurByte1 == player_controller[0].Vib[0]) {
player_controller[0].VibF[0] = value;
if (g.CurByte1 == controllers[0].Vib[0]) {
controllers[0].VibF[0] = value;
#ifdef RUMBLE
if (player_controller[0].VibF[0] != 0) {
if (controllers[0].VibF[0] != 0) {
Shake_Play(device, id_shake_level[3]);
}
#endif

}

if (g.CurByte1 == player_controller[0].Vib[1]) {
player_controller[0].VibF[1] = value;
if (g.CurByte1 == controllers[0].Vib[1]) {
controllers[0].VibF[1] = value;

#ifdef RUMBLE
if (player_controller[0].VibF[1] != 0) {
if (controllers[0].VibF[1] != 0) {
Shake_Play(device, id_shake_level[value>>4]);
}
#endif
Expand All @@ -232,13 +232,13 @@ unsigned char PAD1_poll(unsigned char value) {
break;
case CMD_VIBRATION_TOGGLE:
for (uint8_t i = 0; i < 2; i++) {
if (player_controller[0].Vib[i] == g.CurByte1)
if (controllers[0].Vib[i] == g.CurByte1)
buf[g.CurByte1] = 0;
}
if (value < 2) {
player_controller[0].Vib[value] = g.CurByte1;
if ((player_controller[0].id & 0x0f) < (g.CurByte1 - 1) / 2) {
player_controller[0].id = (player_controller[0].id & 0xf0) + (g.CurByte1 - 1) / 2;
controllers[0].Vib[value] = g.CurByte1;
if ((controllers[0].id & 0x0f) < (g.CurByte1 - 1) / 2) {
controllers[0].id = (controllers[0].id & 0xf0) + (g.CurByte1 - 1) / 2;
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin_lib/plugin_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,5 @@ static void pl_stats_update(void)
(unsigned int)(pl_data.cpu_cur + 0.5f),
(unsigned int)(pl_data.fps_cur + 0.5f),
pl_data.sinfo.pal ? 50 : 60,
player_controller[0].pad_mode?"A":"D");
controllers[0].pad_mode?"A":"D");
}
Loading