summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controller_info.c19
-rw-r--r--controller_info.h2
-rw-r--r--nuklear_ui/blastem_nuklear.c72
3 files changed, 70 insertions, 23 deletions
diff --git a/controller_info.c b/controller_info.c
index f92b9dd..9fef8dd 100644
--- a/controller_info.c
+++ b/controller_info.c
@@ -62,7 +62,10 @@ static const char *subtype_human_names[] = {
static const char *variant_names[] = {
"normal",
"6b bumpers",
- "6b right"
+ "6b right",
+ "3button",
+ "6button",
+ "8button"
};
static void load_ctype_config(void)
@@ -242,6 +245,12 @@ static char const *labels_nintendo[] = {
static char const *labels_genesis[] = {
"A", "B", "X", "Y", NULL, NULL, "Start", NULL, NULL, "Z", "C", NULL, "Mode"
};
+static char const *labels_genesis_3button[] = {
+ "A", "B", NULL, NULL, NULL, NULL, "Start", NULL, NULL, NULL, "C", NULL, "Mode"
+};
+static char const *labels_genesis_8button[] = {
+ "A", "B", "X", "Y", "Mode", NULL, "Start", NULL, NULL, "Z", "C", "L", "R"
+};
static char const *labels_saturn[] = {
"A", "B", "X", "Y", NULL, NULL, "Start", NULL, NULL, "Z", "C", "LT", "RT"
};
@@ -266,7 +275,13 @@ static const char** label_source(controller_info *info)
}
} else {
if (info->subtype == SUBTYPE_GENESIS) {
- return labels_genesis;
+ if (info->variant == VARIANT_8BUTTON) {
+ return labels_genesis_8button;
+ } else if (info->variant == VARIANT_3BUTTON) {
+ return labels_genesis_3button;
+ } else {
+ return labels_genesis;
+ }
} else {
return labels_saturn;
}
diff --git a/controller_info.h b/controller_info.h
index e837467..db1f6ec 100644
--- a/controller_info.h
+++ b/controller_info.h
@@ -30,6 +30,8 @@ enum {
VARIANT_NORMAL,
VARIANT_6B_BUMPERS, //C and Z positions are RB and LB respectively
VARIANT_6B_RIGHT, //C and Z positions are RT and RB respectively
+ VARIANT_3BUTTON, //3-button Gen/MD controller
+ VARIANT_8BUTTON, //Modern 8-button Gen/MD style controller (retro-bit, 8bitdo M30, etc.)
VARIANT_NUM
};
diff --git a/nuklear_ui/blastem_nuklear.c b/nuklear_ui/blastem_nuklear.c
index 6378df1..f782404 100644
--- a/nuklear_ui/blastem_nuklear.c
+++ b/nuklear_ui/blastem_nuklear.c
@@ -1332,26 +1332,41 @@ static void view_controller_variant(struct nk_context *context)
nk_label(context, "Select the layout that", NK_TEXT_CENTERED);
nk_label(context, "best matches your controller", NK_TEXT_CENTERED);
nk_label(context, "", NK_TEXT_CENTERED);
- if (nk_button_label(context, "4 face buttons")) {
- selected_controller_info.variant = VARIANT_NORMAL;
- selected = 1;
- }
- char buffer[512];
- snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s",
- get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER),
- get_axis_label(&selected_controller_info, SDL_CONTROLLER_AXIS_TRIGGERRIGHT)
- );
- if (nk_button_label(context, buffer)) {
- selected_controller_info.variant = VARIANT_6B_RIGHT;
- selected = 1;
- }
- snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s",
- get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_LEFTSHOULDER),
- get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- );
- if (nk_button_label(context, buffer)) {
- selected_controller_info.variant = VARIANT_6B_BUMPERS;
- selected = 1;
+ if (selected_controller_info.subtype == SUBTYPE_GENESIS) {
+ if (nk_button_label(context, "3 button")) {
+ selected_controller_info.variant = VARIANT_3BUTTON;
+ selected = 1;
+ }
+ if (nk_button_label(context, "Standard 6 button")) {
+ selected_controller_info.variant = VARIANT_6B_BUMPERS;
+ selected = 1;
+ }
+ if (nk_button_label(context, "6 button with 2 shoulder buttons")) {
+ selected_controller_info.variant = VARIANT_8BUTTON;
+ selected = 1;
+ }
+ } else {
+ if (nk_button_label(context, "4 face buttons")) {
+ selected_controller_info.variant = VARIANT_NORMAL;
+ selected = 1;
+ }
+ char buffer[512];
+ snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s",
+ get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER),
+ get_axis_label(&selected_controller_info, SDL_CONTROLLER_AXIS_TRIGGERRIGHT)
+ );
+ if (nk_button_label(context, buffer)) {
+ selected_controller_info.variant = VARIANT_6B_RIGHT;
+ selected = 1;
+ }
+ snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s",
+ get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_LEFTSHOULDER),
+ get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
+ );
+ if (nk_button_label(context, buffer)) {
+ selected_controller_info.variant = VARIANT_6B_BUMPERS;
+ selected = 1;
+ }
}
nk_end(context);
}
@@ -1382,7 +1397,22 @@ static void controller_type_group(struct nk_context *context, char *name, int ty
selected_controller_info.type = type_id;
selected_controller_info.subtype = first_subtype_id + i;
pop_view();
- push_view(view_controller_variant);
+ if (selected_controller_info.subtype == SUBTYPE_SATURN) {
+ selected_controller_info.variant = VARIANT_6B_BUMPERS;
+ save_controller_info(selected_controller, &selected_controller_info);
+ if (initial_controller_config) {
+ SDL_GameController *controller = render_get_controller(selected_controller);
+ if (controller) {
+ push_view(view_controller_bindings);
+ controller_binding_changed = 0;
+ SDL_GameControllerClose(controller);
+ } else {
+ show_mapping_view();
+ }
+ }
+ } else {
+ push_view(view_controller_variant);
+ }
}
}
nk_group_end(context);