@@ -397,10 +397,90 @@ void show_graphics_settings(iris::instance* iris) {
397397 PopStyleVar (2 );
398398}
399399
400+ void show_controller_slot (iris::instance* iris, int slot) {
401+ using namespace ImGui ;
402+
403+ char label[9 ] = " ##slot0" ;
404+
405+ label[6 ] = ' 0' + slot;
406+
407+ if (BeginChild (label, ImVec2 (GetContentRegionAvail ().x / (slot ? 1.0 : 2.0 ) - 10.0 , 0 ))) {
408+ std::string& path = slot ? iris->mcd1_path : iris->mcd0_path ;
409+
410+ ImVec4 col = GetStyleColorVec4 (iris->ds [slot] ? ImGuiCol_Text : ImGuiCol_TextDisabled);
411+
412+ col.w = 1.0 ;
413+
414+ InvisibleButton (" ##slot0" , ImVec2 (10 , 10 ));
415+
416+ texture* tex = &iris->ps2_memory_card_icon ;
417+
418+ SetCursorPosX ((GetContentRegionAvail ().x / 2.0 ) - (tex->width / 2.0 ));
419+
420+ Image (
421+ (ImTextureID)(intptr_t )tex->descriptor_set ,
422+ ImVec2 (tex->width , tex->height ),
423+ ImVec2 (0 , 0 ), ImVec2 (1 , 1 ),
424+ col,
425+ ImVec4 (0.0 , 0.0 , 0.0 , 0.0 )
426+ );
427+
428+ InvisibleButton (" ##pad1" , ImVec2 (10 , 10 ));
429+
430+ BeginDisabled (!iris->ds [slot]);
431+
432+ PushFont (iris->font_heading );
433+ Text (" Slot %d" , slot+1 );
434+ PopFont ();
435+
436+ Text (" Input device" );
437+
438+ std::string name = " None" ;
439+
440+ if (!iris->input_devices [slot]) {
441+ name = " None" ;
442+ } else if (iris->input_devices [slot]->get_type () == 0 ) {
443+ name = " Keyboard" ;
444+ } else if (iris->input_devices [slot]->get_type () == 1 ) {
445+ gamepad_device* gp = static_cast <gamepad_device*>(iris->input_devices [slot]);
446+
447+ name = SDL_GetGamepadNameForID (gp->get_id ());
448+ }
449+
450+ if (BeginCombo (" ##devicetype" , name.c_str ())) {
451+ if (Selectable (" Keyboard" )) {
452+ if (iris->input_devices [slot]) {
453+ delete iris->input_devices [slot];
454+
455+ iris->input_devices [slot] = nullptr ;
456+ }
457+
458+ iris->input_devices [slot] = new keyboard_device ();
459+ }
460+
461+ for (auto gamepad : iris->gamepads ) {
462+ if (Selectable (SDL_GetGamepadNameForID (gamepad.first ))) {
463+ if (iris->input_devices [slot]) {
464+ delete iris->input_devices [slot];
465+
466+ iris->input_devices [slot] = nullptr ;
467+ }
468+
469+ iris->input_devices [slot] = new gamepad_device (gamepad.first );
470+ }
471+ }
472+
473+ EndCombo ();
474+ }
475+ EndDisabled ();
476+ } EndChild ();
477+ }
478+
400479void show_input_settings (iris::instance* iris) {
401480 using namespace ImGui ;
402481
403- Text (" Input settings will go here." );
482+ show_controller_slot (iris, 0 ); SameLine (0.0 , 10.0 );
483+ show_controller_slot (iris, 1 );
404484}
405485
406486void show_paths_settings (iris::instance* iris) {
@@ -659,7 +739,7 @@ void show_memory_card(iris::instance* iris, int slot) {
659739
660740 label[7 ] = ' 0' + slot;
661741
662- if (BeginChild (label, ImVec2 (GetContentRegionAvail ().x / (slot ? 1.0 : 2.0 ), 0 ))) {
742+ if (BeginChild (label, ImVec2 (GetContentRegionAvail ().x / (slot ? 1.0 : 2.0 ) - 10.0 , 0 ))) {
663743 std::string& path = slot ? iris->mcd1_path : iris->mcd0_path ;
664744
665745 ImVec4 col = GetStyleColorVec4 (iris->mcd_slot_type [slot] ? ImGuiCol_Text : ImGuiCol_TextDisabled);
0 commit comments