From af0bae142b1da764978fe599fc146a95513d09cc Mon Sep 17 00:00:00 2001 From: Bobby Smith <33353403+bslenul@users.noreply.github.com> Date: Sat, 6 May 2023 18:34:17 +0200 Subject: [PATCH] Add core options to default to 2 or 6 buttons controllers --- libretro.cpp | 16 ++++++++++ libretro_core_options.h | 70 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/libretro.cpp b/libretro.cpp index 6613c5c..ee68c4a 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -1766,6 +1766,22 @@ static void check_variables(bool first_run) else if (strcmp(var.value, "System Card 2 US") == 0) setting_pce_fast_cdbios = "syscard2u.pce"; } + + char key[256]; + key[0] = '\0'; + + var.key = key ; + for (int i = 0 ; i < MAX_PLAYERS ; i++) + { + snprintf(key, sizeof(key), "pce_fast_default_joypad_type_p%d", i + 1); + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if(strcmp(var.value, "2 Buttons") == 0) + AVPad6Enabled[i] = false; + else if(strcmp(var.value, "6 Buttons") == 0) + AVPad6Enabled[i] = true; + } + } } var.key = "pce_fast_nospritelimit"; diff --git a/libretro_core_options.h b/libretro_core_options.h index 4a86a8d..7710f29 100644 --- a/libretro_core_options.h +++ b/libretro_core_options.h @@ -459,6 +459,76 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "disabled" }, + { + "pce_fast_default_joypad_type_p1", + "P1 Default Joypad Type", + NULL, + "Choose if port 1 joypad should be 2 or 6 buttons by default. This option is only applied when the core starts, if you want to switch while content is running, use the 'Mode Switch' button. NOTE: 6 buttons joypad can have weird behaviors in non compatible games.", + NULL, + "input", + { + { "2 Buttons", NULL }, + { "6 Buttons", NULL }, + { NULL, NULL}, + }, + "2 Buttons" + }, + { + "pce_fast_default_joypad_type_p2", + "P2 Default Joypad Type", + NULL, + "Choose if port 2 joypad should be 2 or 6 buttons by default. This option is only applied when the core starts, if you want to switch while content is running, use the 'Mode Switch' button. NOTE: 6 buttons joypad can have weird behaviors in non compatible games.", + NULL, + "input", + { + { "2 Buttons", NULL }, + { "6 Buttons", NULL }, + { NULL, NULL}, + }, + "2 Buttons" + }, + { + "pce_fast_default_joypad_type_p3", + "P3 Default Joypad Type", + NULL, + "Choose if port 3 joypad should be 2 or 6 buttons by default. This option is only applied when the core starts, if you want to switch while content is running, use the 'Mode Switch' button. NOTE: 6 buttons joypad can have weird behaviors in non compatible games.", + NULL, + "input", + { + { "2 Buttons", NULL }, + { "6 Buttons", NULL }, + { NULL, NULL}, + }, + "2 Buttons" + }, + { + "pce_fast_default_joypad_type_p4", + "P4 Default Joypad Type", + NULL, + "Choose if port 4 joypad should be 2 or 6 buttons by default. This option is only applied when the core starts, if you want to switch while content is running, use the 'Mode Switch' button. NOTE: 6 buttons joypad can have weird behaviors in non compatible games.", + NULL, + "input", + { + { "2 Buttons", NULL }, + { "6 Buttons", NULL }, + { NULL, NULL}, + }, + "2 Buttons" + }, + { + "pce_fast_default_joypad_type_p5", + "P5 Default Joypad Type", + NULL, + "Choose if port 5 joypad should be 2 or 6 buttons by default. This option is only applied when the core starts, if you want to switch while content is running, use the 'Mode Switch' button. NOTE: 6 buttons joypad can have weird behaviors in non compatible games.", + NULL, + "input", + { + { "2 Buttons", NULL }, + { "6 Buttons", NULL }, + { NULL, NULL}, + }, + "2 Buttons" + }, { "pce_fast_turbo_toggling", "Turbo Toggle",