From 5c244eaca7229b5ec1106aace4a8660c837af33b Mon Sep 17 00:00:00 2001 From: drmext <71258889+drmext@users.noreply.github.com> Date: Thu, 11 Jun 2026 06:24:43 +0000 Subject: [PATCH] improve E004 card generation and placeholder pcbid (#748) ## Link to GitHub Issue or related Pull Request, if one exists #73 ## Description of change Generated cards now start with E0040100 to fully match real cards. The placeholder example `E004010000000000` is replaced with `E0040100FFFFFFFF`. The invalid placeholder/fallback PCBID `04040000000000000000` is replaced with `01201000000000010101`, which contains a valid header/checksum, making it closer resemble a real PCBID while still clearly being an example. --- src/spice2x/avs/ea3.cpp | 4 ++-- src/spice2x/launcher/options.cpp | 6 +++--- src/spice2x/overlay/windows/card_manager.cpp | 2 +- src/spice2x/overlay/windows/card_manager.h | 2 +- src/spice2x/overlay/windows/config.cpp | 2 +- src/spice2x/overlay/windows/control.cpp | 2 +- src/spice2x/util/utils.cpp | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/spice2x/avs/ea3.cpp b/src/spice2x/avs/ea3.cpp index a299d8e..1692bea 100644 --- a/src/spice2x/avs/ea3.cpp +++ b/src/spice2x/avs/ea3.cpp @@ -390,8 +390,8 @@ namespace avs { // fall back to default PCBID if node is not found if (!EA3_PCBID[0] && PCBID_CUSTOM.empty()) { - log_warning("avs-ea3", "no PCBID set, falling back to default PCBID value (04040000000000000000)"); - PCBID_CUSTOM = "04040000000000000000"; + log_warning("avs-ea3", "no PCBID set, falling back to default PCBID value (01201000000000010101)"); + PCBID_CUSTOM = "01201000000000010101"; } // custom PCBID diff --git a/src/spice2x/launcher/options.cpp b/src/spice2x/launcher/options.cpp index fda1c7e..94eb358 100644 --- a/src/spice2x/launcher/options.cpp +++ b/src/spice2x/launcher/options.cpp @@ -114,7 +114,7 @@ static const std::vector OPTION_DEFINITIONS = { .name = "p", .desc = "Sets a custom PCBID override.", .type = OptionType::Text, - .setting_name = "04040000000000000000", + .setting_name = "01201000000000010101", .category = "Network", .sensitive = true, }, @@ -123,7 +123,7 @@ static const std::vector OPTION_DEFINITIONS = { .name = "card0", .desc = "Set a card number for reader 1. Overrides the selected card file.", .type = OptionType::Text, - .setting_name = "E004010000000000", + .setting_name = "E0040100FFFFFFFF", .category = "Network", .sensitive = true, .picker = OptionPickerType::EACard, @@ -133,7 +133,7 @@ static const std::vector OPTION_DEFINITIONS = { .name = "card1", .desc = "Set a card number for reader 2. Overrides the selected card file.", .type = OptionType::Text, - .setting_name = "E004010000000000", + .setting_name = "E0040100FFFFFFFF", .category = "Network", .sensitive = true, .picker = OptionPickerType::EACard, diff --git a/src/spice2x/overlay/windows/card_manager.cpp b/src/spice2x/overlay/windows/card_manager.cpp index 732ea9e..0e90634 100644 --- a/src/spice2x/overlay/windows/card_manager.cpp +++ b/src/spice2x/overlay/windows/card_manager.cpp @@ -166,7 +166,7 @@ namespace overlay::windows { if (ImGui::BeginPopupModal("Card Editor", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { // card ID field (only editable for new cards) ImGui::BeginDisabled(this->current_card); - ImGui::InputTextWithHint("Card ID", "E0040123456789AB", + ImGui::InputTextWithHint("Card ID", "E0040100FFFFFFFF", this->card_buffer, std::size(this->card_buffer), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); diff --git a/src/spice2x/overlay/windows/card_manager.h b/src/spice2x/overlay/windows/card_manager.h index 5dee87c..0c2148f 100644 --- a/src/spice2x/overlay/windows/card_manager.h +++ b/src/spice2x/overlay/windows/card_manager.h @@ -9,7 +9,7 @@ namespace overlay::windows { struct CardEntry { std::string name = "unnamed"; - std::string id = "E004010000000000"; + std::string id = "E0040100FFFFFFFF"; std::string search_string = ""; bool read_only = false; float color[3] {}; diff --git a/src/spice2x/overlay/windows/config.cpp b/src/spice2x/overlay/windows/config.cpp index cb238e7..7655ba1 100644 --- a/src/spice2x/overlay/windows/config.cpp +++ b/src/spice2x/overlay/windows/config.cpp @@ -3972,7 +3972,7 @@ namespace overlay::windows { ImVec4(1.f, 0.f, 0.f, 1.f)); ImGui::SetNextItemWidth(TEXT_INPUT_WIDTH); ImGui::BeginDisabled(option.disabled); - ImGui::InputTextWithHint("##OverrideCard", "E004010000000000", + ImGui::InputTextWithHint("##OverrideCard", "E0040100FFFFFFFF", buffer, sizeof(buffer) - 1, ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsHexadecimal | diff --git a/src/spice2x/overlay/windows/control.cpp b/src/spice2x/overlay/windows/control.cpp index 9e9c68c..80fbfdb 100644 --- a/src/spice2x/overlay/windows/control.cpp +++ b/src/spice2x/overlay/windows/control.cpp @@ -467,7 +467,7 @@ namespace overlay::windows { void Control::cards_view() { if (ImGui::CollapsingHeader("Cards")) { - ImGui::InputTextWithHint("Card ID", "E0040123456789AB", + ImGui::InputTextWithHint("Card ID", "E0040100FFFFFFFF", this->card_input, std::size(this->card_input), ImGuiInputTextFlags_CharsHexadecimal diff --git a/src/spice2x/util/utils.cpp b/src/spice2x/util/utils.cpp index b613ec0..c90e591 100644 --- a/src/spice2x/util/utils.cpp +++ b/src/spice2x/util/utils.cpp @@ -115,9 +115,9 @@ void generate_ea_card(char card[17]) { std::uniform_int_distribution<> uniform(0, 15); // randomize card - strcpy(card, "E00401"); + strcpy(card, "E0040100"); char hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; - for (int i = 6; i < 16; i++) { + for (int i = 8; i < 16; i++) { card[i] = hex[uniform(generator)]; }