mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
48186245fe
## Link to GitHub Issue, if one exists
n/a
## Description of change
Change the usage pattern for Card Manager UI.
### Previous behavior
Previously, it was a list of cards that you select, and click a button
to insert as P1 or P2.
This is fine, but users got confused when they pressed `Insert Card`
overlay key and got a different card inserted, or when auto-insert
didn't work as expected.
Additionally, if you play a game without continue (IIDX/DDR for
example), then it's cumbersome to bring up the overlay and click on
insert card every time.
### New behavior
Insert Card overlay now lets you pick a card and *slot* it into P1 or P2
side.
From that point on, the slotted card number is used as the override,
replacing what was previously passed to `-card0` or `-card1`. This means
that `Insert Card` button and auto-insert will pick up the new card and
use that instead.
## Compiling
👍
## Testing
Tested 1p-only game (popn) and 2p games (DDR, IIDX).
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <optional>
|
|
|
|
#include "overlay/window.h"
|
|
|
|
namespace overlay::windows {
|
|
|
|
struct CardEntry {
|
|
std::string name = "unnamed";
|
|
std::string id = "E004010000000000";
|
|
std::string search_string = "";
|
|
bool read_only = false;
|
|
float color[3] {};
|
|
};
|
|
|
|
class CardManager : public Window {
|
|
public:
|
|
|
|
CardManager(SpiceOverlay *overlay);
|
|
~CardManager() override;
|
|
|
|
void build_content() override;
|
|
|
|
private:
|
|
|
|
std::filesystem::path config_path;
|
|
bool config_dirty = false;
|
|
std::vector<CardEntry> cards;
|
|
char name_buffer[65] {};
|
|
char card_buffer[17] {};
|
|
float color_buffer[3] {};
|
|
|
|
std::optional<CardEntry> card_cmd_overrides[2];
|
|
|
|
std::optional<CardEntry> loaded_card[2];
|
|
CardEntry *current_card = nullptr;
|
|
|
|
std::string search_filter = "";
|
|
std::string search_filter_in_lower_case = "";
|
|
|
|
void config_load();
|
|
void config_save();
|
|
|
|
void generate_search_string(CardEntry *card);
|
|
void generate_random_color();
|
|
|
|
bool build_card(int reader);
|
|
void open_card_editor();
|
|
void build_card_editor();
|
|
void build_card_list();
|
|
void build_card_selectable(CardEntry &card);
|
|
void build_footer();
|
|
|
|
void insert_card_over_api(int reader, CardEntry &card);
|
|
};
|
|
}
|