comparison nuklear_ui/blastem_nuklear.c @ 2235:93918a6a8ab7

Initial support for Sega multi-tap
author Michael Pavone <pavone@retrodev.com>
date Tue, 13 Sep 2022 20:08:26 -0700
parents dd9d43c67986
children 0a107b2d5837
comparison
equal deleted inserted replaced
2234:b6fdedd3b070 2235:93918a6a8ab7
2033 } else { 2033 } else {
2034 selected_model = find_match(model_opts, num_models, "system\0model\0", "md1va3"); 2034 selected_model = find_match(model_opts, num_models, "system\0model\0", "md1va3");
2035 } 2035 }
2036 } 2036 }
2037 2037
2038 const char *formats[] = { 2038 static const char *formats[] = {
2039 "native", 2039 "native",
2040 "gst" 2040 "gst"
2041 }; 2041 };
2042 const uint32_t num_formats = sizeof(formats)/sizeof(*formats); 2042 const uint32_t num_formats = sizeof(formats)/sizeof(*formats);
2043 static int32_t selected_format = -1; 2043 static int32_t selected_format = -1;
2044 if (selected_format < 0) { 2044 if (selected_format < 0) {
2045 selected_format = find_match(formats, num_formats, "ui\0state_format\0", "native"); 2045 selected_format = find_match(formats, num_formats, "ui\0state_format\0", "native");
2046 } 2046 }
2047 const char *ram_inits[] = { 2047 static const char *ram_inits[] = {
2048 "zero", 2048 "zero",
2049 "random" 2049 "random"
2050 }; 2050 };
2051 const uint32_t num_inits = sizeof(ram_inits)/sizeof(*ram_inits); 2051 const uint32_t num_inits = sizeof(ram_inits)/sizeof(*ram_inits);
2052 static int32_t selected_init = -1; 2052 static int32_t selected_init = -1;
2053 if (selected_init < 0) { 2053 if (selected_init < 0) {
2054 selected_init = find_match(ram_inits, num_inits, "system\0ram_init\0", "zero"); 2054 selected_init = find_match(ram_inits, num_inits, "system\0ram_init\0", "zero");
2055 } 2055 }
2056 const char *io_opts_1[] = { 2056 static const char *io_opts_1[] = {
2057 "none", 2057 "none",
2058 "gamepad2.1", 2058 "gamepad2.1",
2059 "gamepad3.1", 2059 "gamepad3.1",
2060 "gamepad6.1", 2060 "gamepad6.1",
2061 "sega_multitap.1",
2061 "mouse.1", 2062 "mouse.1",
2062 "saturn keyboard", 2063 "saturn keyboard",
2063 "xband keyboard" 2064 "xband keyboard"
2064 }; 2065 };
2065 const char *io_opts_2[] = { 2066 static const char *io_opts_2[] = {
2066 "none", 2067 "none",
2067 "gamepad2.2", 2068 "gamepad2.2",
2068 "gamepad3.2", 2069 "gamepad3.2",
2069 "gamepad6.2", 2070 "gamepad6.2",
2071 "sega_multitap.1",
2070 "mouse.1", 2072 "mouse.1",
2071 "saturn keyboard", 2073 "saturn keyboard",
2072 "xband keyboard" 2074 "xband keyboard"
2073 }; 2075 };
2076 static const char *type_names[sizeof(io_opts_1)/sizeof(*io_opts_1)];
2074 static int32_t selected_io_1 = -1; 2077 static int32_t selected_io_1 = -1;
2075 static int32_t selected_io_2 = -1; 2078 static int32_t selected_io_2 = -1;
2076 const uint32_t num_io = sizeof(io_opts_1)/sizeof(*io_opts_1); 2079 const uint32_t num_io = sizeof(io_opts_1)/sizeof(*io_opts_1);
2077 if (selected_io_1 < 0 || selected_io_2 < 0 || show_sms != old_show_sms) { 2080 if (selected_io_1 < 0 || selected_io_2 < 0 || show_sms != old_show_sms) {
2081 type_names[0] = device_type_names[IO_NONE];
2082 type_names[1] = device_type_names[IO_GAMEPAD2];
2083 type_names[2] = device_type_names[IO_GAMEPAD3];
2084 type_names[3] = device_type_names[IO_GAMEPAD6];
2085 type_names[4] = device_type_names[IO_SEGA_MULTI];
2086 type_names[5] = device_type_names[IO_MOUSE];
2087 type_names[6] = device_type_names[IO_SATURN_KEYBOARD];
2088 type_names[7] = device_type_names[IO_XBAND_KEYBOARD];
2078 if (show_sms) { 2089 if (show_sms) {
2079 selected_io_1 = find_match(io_opts_1, num_io, "sms\0io\0devices\0""1\0", "gamepad2.1"); 2090 selected_io_1 = find_match(io_opts_1, num_io, "sms\0io\0devices\0""1\0", "gamepad2.1");
2080 selected_io_2 = find_match(io_opts_2, num_io, "sms\0io\0devices\0""2\0", "gamepad2.2"); 2091 selected_io_2 = find_match(io_opts_2, num_io, "sms\0io\0devices\0""2\0", "gamepad2.2");
2081 } else { 2092 } else {
2082 selected_io_1 = find_match(io_opts_1, num_io, "io\0devices\0""1\0", "gamepad6.1"); 2093 selected_io_1 = find_match(io_opts_1, num_io, "io\0devices\0""1\0", "gamepad6.1");
2094 if (show_sms) { 2105 if (show_sms) {
2095 selected_model = settings_dropdown_ex(context, "Model", sms_model_opts, sms_model_names, num_sms_models, selected_model, "sms\0system\0model\0"); 2106 selected_model = settings_dropdown_ex(context, "Model", sms_model_opts, sms_model_names, num_sms_models, selected_model, "sms\0system\0model\0");
2096 } else { 2107 } else {
2097 selected_model = settings_dropdown_ex(context, "Model", model_opts, model_names, num_models, selected_model, "system\0model\0"); 2108 selected_model = settings_dropdown_ex(context, "Model", model_opts, model_names, num_models, selected_model, "system\0model\0");
2098 } 2109 }
2099 selected_io_1 = settings_dropdown_ex(context, "IO Port 1 Device", io_opts_1, device_type_names, num_io, selected_io_1, show_sms ? "sms\0io\0devices\0""1\0" : "io\0devices\0""1\0"); 2110 selected_io_1 = settings_dropdown_ex(context, "IO Port 1 Device", io_opts_1, type_names, num_io, selected_io_1, show_sms ? "sms\0io\0devices\0""1\0" : "io\0devices\0""1\0");
2100 selected_io_2 = settings_dropdown_ex(context, "IO Port 2 Device", io_opts_2, device_type_names, num_io, selected_io_2, show_sms ? "sms\0io\0devices\0""2\0" : "io\0devices\0""2\0"); 2111 selected_io_2 = settings_dropdown_ex(context, "IO Port 2 Device", io_opts_2, type_names, num_io, selected_io_2, show_sms ? "sms\0io\0devices\0""2\0" : "io\0devices\0""2\0");
2101 selected_region = settings_dropdown_ex(context, "Default Region", region_codes, regions, num_regions, selected_region, "system\0default_region\0"); 2112 selected_region = settings_dropdown_ex(context, "Default Region", region_codes, regions, num_regions, selected_region, "system\0default_region\0");
2102 selected_sync = settings_dropdown(context, "Sync Source", sync_opts, num_sync_opts, selected_sync, "system\0sync_source\0"); 2113 selected_sync = settings_dropdown(context, "Sync Source", sync_opts, num_sync_opts, selected_sync, "system\0sync_source\0");
2103 if (!show_sms) { 2114 if (!show_sms) {
2104 settings_int_property(context, "68000 Clock Divider", "", "clocks\0m68k_divider\0", 7, 1, 53); 2115 settings_int_property(context, "68000 Clock Divider", "", "clocks\0m68k_divider\0", 7, 1, 53);
2105 selected_format = settings_dropdown(context, "Save State Format", formats, num_formats, selected_format, "ui\0state_format\0"); 2116 selected_format = settings_dropdown(context, "Save State Format", formats, num_formats, selected_format, "ui\0state_format\0");