MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DrawMemoryCardSettingsPage

Method DrawMemoryCardSettingsPage

pcsx2/ImGui/FullscreenUI_Settings.cpp:3546–3670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3544}
3545
3546void FullscreenUI::DrawMemoryCardSettingsPage()
3547{
3548 BeginMenuButtons();
3549
3550 SettingsInterface* bsi = GetEditingSettingsInterface();
3551
3552 MenuHeading(FSUI_CSTR("Settings and Operations"));
3553 if (MenuButton(FSUI_ICONSTR(ICON_FA_FILE_CIRCLE_PLUS, "Create Memory Card"), FSUI_CSTR("Creates a new memory card file or folder.")))
3554 OpenMemoryCardCreateDialog();
3555
3556 DrawFolderSetting(bsi, FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Memory Card Directory"), "Folders", "MemoryCards", EmuFolders::MemoryCards);
3557 DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_MAGNIFYING_GLASS, "Folder Memory Card Filter"),
3558 FSUI_CSTR("Simulates a larger memory card by filtering saves only to the current game."), "EmuCore", "McdFolderAutoManage", true);
3559
3560 if (MenuButton(FSUI_ICONSTR(ICON_FA_ARROWS_ROTATE, "Swap Memory Cards"), FSUI_CSTR("Swaps the selected memory cards in Slot 1 and Slot 2.")))
3561 {
3562 SettingsInterface* ebsi = GetEditingSettingsInterface();
3563
3564 std::string card1;
3565 if (!ebsi->GetStringValue("MemoryCards", "Slot1_Filename", &card1))
3566 card1 = Host::GetBaseStringSettingValue("MemoryCards", "Slot1_Filename", FileMcd_GetDefaultName(0).c_str());
3567
3568 std::string card2;
3569 if (!ebsi->GetStringValue("MemoryCards", "Slot2_Filename", &card2))
3570 card2 = Host::GetBaseStringSettingValue("MemoryCards", "Slot2_Filename", FileMcd_GetDefaultName(1).c_str());
3571
3572 if (card1.empty() || card2.empty())
3573 {
3574 ShowToast(std::string(), FSUI_STR("Both slots must have a card selected to swap."));
3575 }
3576 else
3577 {
3578 ebsi->SetStringValue("MemoryCards", "Slot1_Filename", card2.c_str());
3579 ebsi->SetStringValue("MemoryCards", "Slot2_Filename", card1.c_str());
3580 SetSettingsChanged(ebsi);
3581 ShowToast(std::string(), FSUI_STR("Swapped Slot 1 and Slot 2 memory cards."));
3582 }
3583 }
3584
3585 for (u32 port = 0; port < NUM_MEMORY_CARD_PORTS; port++)
3586 {
3587 SmallString str;
3588 str.format(FSUI_FSTR("Slot {}"), port + 1);
3589 MenuHeading(str.c_str());
3590
3591 std::string enable_key(fmt::format("Slot{}_Enable", port + 1));
3592 std::string file_key(fmt::format("Slot{}_Filename", port + 1));
3593
3594 DrawToggleSetting(bsi,
3595 SmallString::from_format(fmt::runtime(FSUI_ICONSTR_S(ICON_PF_MEMORY_CARD, "Memory Card Enabled", "##card_enabled_{}")), port),
3596 FSUI_CSTR("If not set, this card will be considered unplugged."), "MemoryCards", enable_key.c_str(), true);
3597
3598 const bool enabled = GetEffectiveBoolSetting(bsi, "MemoryCards", enable_key.c_str(), true);
3599
3600 const std::optional<SmallString> value = bsi->GetOptionalSmallStringValue("MemoryCards", file_key.c_str(),
3601 IsEditingGameSettings(bsi) ? std::nullopt : std::optional<const char*>(FileMcd_GetDefaultName(port).c_str()));
3602
3603 if (MenuButtonWithValue(SmallString::from_format(fmt::runtime(FSUI_ICONSTR_S(ICON_FA_FILE, "Card Name", "##card_name_{}")), port),

Callers

nothing calls this directly

Calls 14

FileMcd_GetDefaultNameFunction · 0.85
viewMethod · 0.80
stringClass · 0.50
formatFunction · 0.50
runtimeFunction · 0.50
GetStringValueMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
SetStringValueMethod · 0.45
formatMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected