Skip to content

Commit

Permalink
[Switch] add split Joycon support and option to enable it
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Nov 15, 2018
1 parent 076b320 commit ec4e860
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_VERBOSE_MAKEFILE OFF)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 75)
set(VERSION_MINOR 76)

if(BUILD_PSP2)
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
Expand Down
24 changes: 18 additions & 6 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
Changes in this Version
======
1.75
1.76

- fixed crash when booting a floppy with floppy speed >1x
- fixed inconsistencies in menu navigation
- enabled long filename display in file browser (hold Triangle or X to show it)
- fixed an issue where HD Dir could not be selected unless Boot HD was set to OFF
- removed legacy code and data files that were not needed
- on Switch, added split Joycon option for tabletop multiplayer with multiple single Joycons
- fixed lag when navigating the savestate menu

Description
=====
Expand Down Expand Up @@ -60,6 +57,10 @@ Vita-exclusive Features
- Supports loading files from ux0: or uma0: partition
- Rear touch panel can be enabled for mouse pointer control

Switch-exclusive Features
======
- Split Joycon support

Notes
======
- *Bios:* Please put kickstart files in `ux0:/data/uae4all/kickstarts` on Vita and in `/switch/uae4all2/kickstarts` directory on Switch. Files must be named as kick13.rom, kick20.rom, kick31.rom
Expand Down Expand Up @@ -145,6 +146,12 @@ Circle = A
Start = Plus
Select = Minus

Split Joycon mode: When you pair additional Joycons in this mode, please turn Split Joycon mode off and back on to force a re-scan. In split Joycon mode, the controls for player 1 are slightly different:
Minus or Plus = Menu (player 1 only)
SL = on-screen keyboard (player 1 only)
Pressing Stick while moving it = change keyboard transparency and position; move mouse pointer (player 1 only)
SR + SL + Stick directions = hotkey to quick-zoom image and center image vertically (player 1 only)

General
-----
Select = Toggle menu
Expand Down Expand Up @@ -203,6 +210,11 @@ Mouse + keyboard tested working with the "Jelly Comb Mini Bluetooth Keyboard Wit

CHANGELOG
=====
1.76

- on Switch, added split Joycon option for tabletop multiplayer with multiple single Joycons
- fixed lag when navigating the savestate menu

1.75

- fixed crash when booting a floppy with floppy speed >1x
Expand Down
1 change: 1 addition & 0 deletions src/gp2x/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ enum { MEMDISK_MENU_CASE_MAIN, MEMDISK_MENU_CASE_MISC };

#ifdef __SWITCH__
#define DEFAULT_SWAPAB 0
#define DEFAULT_SINGLEJOYCONS 0
#endif
5 changes: 5 additions & 0 deletions src/gp2x/menu/menu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ int mainMenu_deadZone = 1000;
#endif
#ifdef __SWITCH__
int mainMenu_swapAB = DEFAULT_SWAPAB;
int mainMenu_singleJoycons = DEFAULT_SINGLEJOYCONS;
#endif

// The following params in use, but can't be changed with gui
Expand Down Expand Up @@ -376,6 +377,7 @@ void SetDefaultMenuSettings(int general)
#endif
#ifdef __SWITCH__
mainMenu_swapAB = DEFAULT_SWAPAB;
mainMenu_singleJoycons = DEFAULT_SINGLEJOYCONS;
#endif
// The following params can't be changed in gui
skipintro = DEFAULT_SKIPINTRO;
Expand Down Expand Up @@ -1366,6 +1368,8 @@ int saveconfig(int general)
#ifdef __SWITCH__
snprintf((char*)buffer, 255, "swapAB=%d\n",mainMenu_swapAB);
fputs(buffer,f);
snprintf((char*)buffer, 255, "singleJoycons=%d\n",mainMenu_singleJoycons);
fputs(buffer,f);
#endif
fclose(f);
return 1;
Expand Down Expand Up @@ -1783,6 +1787,7 @@ void loadconfig(int general)
fscanf(f,"useSavesFolder=%d\n",&mainMenu_useSavesFolder);
#ifdef __SWITCH__
fscanf(f,"swapAB=%d\n",&mainMenu_swapAB);
fscanf(f,"singleJoycons=%d\n",&mainMenu_singleJoycons);
#endif
fclose(f);
}
Expand Down
1 change: 1 addition & 0 deletions src/gp2x/menu/menu_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ extern int mainMenu_custom3_R3[4];
#endif
#ifdef __SWITCH__
extern int mainMenu_swapAB;
extern int mainMenu_singleJoycons;
#endif
#endif

Expand Down
9 changes: 9 additions & 0 deletions src/gp2x/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
#include <psp2/io/fcntl.h>
#endif

#ifdef __SWITCH__
#include <switch.h>
extern void update_joycon_mode();
#endif

#if defined(__PSP2__) || defined(__SWITCH__)
#define SDL_PollEvent PSP2_PollEvent
int inside_menu = 0;
Expand Down Expand Up @@ -1065,6 +1070,10 @@ int run_mainMenu()
leave_program();
#if !defined(__PSP2__) && !defined(__SWITCH__)
sync();
#endif
#ifdef __SWITCH__
mainMenu_singleJoycons = 0;
update_joycon_mode();
#endif
exit(0);
break;
Expand Down
32 changes: 31 additions & 1 deletion src/gp2x/menu/menu_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#define SDL_PollEvent PSP2_PollEvent
#endif

#ifdef __SWITCH__
#include <switch.h>
#endif

const char *text_str_misc_separator="----------------------------------";
static const char *text_str_misc_title= " Miscellanous -";
static const char *text_str_stylus_offset="StylusOffset";
Expand Down Expand Up @@ -71,6 +75,9 @@ enum {
#endif
#if defined(__PSP2__) || defined(__SWITCH__)
MENUMISC_MOUSEEMULATION,
#ifdef __SWITCH__
MENUMISC_SINGLEJOYCONS,
#endif
MENUMISC_LEFTSTICKMOUSE,
#endif
MENUMISC_MOUSEMULTIPLIER,
Expand Down Expand Up @@ -414,8 +421,26 @@ static void draw_miscMenu(int c)
write_text_inv(tabstop3-8,menuLine,"On");
else
write_text(tabstop3-8,menuLine,"On");
#ifdef __SWITCH__
// MENUMISC_SINGLEJOYCONS
write_text(tabstop2,menuLine,"Split JoyCons");
if (mainMenu_singleJoycons==0)
{
if ((menuMisc!=MENUMISC_SINGLEJOYCONS)||(bb))
write_text_inv(tabstop9,menuLine,"Off");
else
write_text(tabstop9,menuLine,"Off ");
}
else if (mainMenu_singleJoycons==1)
{
if ((menuMisc!=MENUMISC_SINGLEJOYCONS)||(bb))
write_text_inv(tabstop9,menuLine,"On");
else
write_text(tabstop9,menuLine,"On ");
}
#else
write_text(tabstop3-5,menuLine,"(can disturb 2nd player)");

#endif
// MENUMISC_LEFTSTICKMOUSE
menuLine+=2;
write_text(leftMargin,menuLine,"Mouse Control");
Expand Down Expand Up @@ -785,6 +810,11 @@ static int key_miscMenu(int *c)
if (left || right)
mainMenu_touchControls = !mainMenu_touchControls;
break;
case MENUMISC_SINGLEJOYCONS:
if (left || right) {
mainMenu_singleJoycons = !mainMenu_singleJoycons;
}
break;
#else
if (left)
{
Expand Down

0 comments on commit ec4e860

Please sign in to comment.