implemented cartridge links in GameInfoDialog (see #788)

This commit is contained in:
thrust26 2021-04-21 16:14:30 +02:00
parent aa997a0cd5
commit d1a01391b0
8 changed files with 3600 additions and 3544 deletions

File diff suppressed because it is too large Load Diff

View File

@ -180,7 +180,8 @@ void Properties::print() const
<< get(PropType::Display_VCenter) << "|"
<< get(PropType::Display_Phosphor) << "|"
<< get(PropType::Display_PPBlend) << "|"
<< get(PropType::Cart_Highscore)
<< get(PropType::Cart_Highscore) << "|"
<< get(PropType::Cart_Url)
<< endl;
}
@ -240,7 +241,8 @@ void Properties::printHeader()
<< "Display_VCenter|"
<< "Display_Phosphor|"
<< "Display_PPBlend|"
<< "Cart_Highscore"
<< "Cart_Highscore|"
<< "Cart_Url"
<< endl;
}
@ -274,7 +276,8 @@ std::array<string, Properties::NUM_PROPS> Properties::ourDefaultProperties =
"0", // Display.VCenter
"NO", // Display.Phosphor
"0", // Display.PPBlend
"" // Cart.Highscore
"", // Cart.Highscore
"" // Cart.Url
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -307,5 +310,6 @@ std::array<string, Properties::NUM_PROPS> Properties::ourPropertyNames =
"Display.VCenter",
"Display.Phosphor",
"Display.PPBlend",
"Cart.Highscore"
"Cart.Highscore",
"Cart.Url"
};

View File

@ -50,6 +50,7 @@ enum class PropType : uInt8 {
Display_Phosphor,
Display_PPBlend,
Cart_Highscore,
Cart_Url,
NumTypes
};

View File

@ -2637,8 +2637,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655-069"
"Cart.Name" "Star Castle 2600 (SolidCorp) [069]"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -3693,8 +3693,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655-025"
"Cart.Name" "Star Castle 2600 (SolidCorp) [025]"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -4990,8 +4990,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655-016"
"Cart.Name" "Star Castle 2600 (SolidCorp) [016]"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -7344,8 +7344,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655*"
"Cart.Name" "Star Castle 2600 (SolidCorp) (PAL)"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -16119,8 +16119,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655-014"
"Cart.Name" "Star Castle 2600 (SolidCorp) [014]"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -17398,8 +17398,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655-015"
"Cart.Name" "Star Castle 2600 (SolidCorp) (PAL) [015]"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -18381,8 +18381,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655*"
"Cart.Name" "Star Castle 2600 (SolidCorp)"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""
@ -18670,8 +18670,8 @@
"Cart.Manufacturer" "SOLID Corp. (D. Scott Williamson)"
"Cart.ModelNo" "CX2655-013"
"Cart.Name" "Star Castle 2600 (SolidCorp) [013]"
"Cart.Note" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Cart.Rarity" "Homebrew"
"Cart.Url" "http://starcastle2600.blogspot.com/p/star-castle-2600-story.html"
"Display.Phosphor" "YES"
""

View File

@ -43,6 +43,7 @@
#include "Switches.hxx"
#include "AudioSettings.hxx"
#include "bspf.hxx"
#include "MediaFactory.hxx"
#include "GameInfoDialog.hxx"
@ -411,7 +412,8 @@ void GameInfoDialog::addCartridgeTab()
fontHeight = Dialog::fontHeight(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap();
VGAP = Dialog::vGap(),
HGAP = Dialog::fontWidth() / 4;
int xpos, ypos, lwidth, fwidth, tabID;
WidgetArray wid;
VariantList items;
@ -458,6 +460,15 @@ void GameInfoDialog::addCartridgeTab()
fwidth, lineHeight, "");
wid.push_back(myNote);
ypos += lineHeight + VGAP;
new StaticTextWidget(myTab, _font, xpos, ypos + 1, lwidth, fontHeight, "Link");
myUrl = new EditTextWidget(myTab, _font, xpos + lwidth, ypos - 1,
fwidth - buttonWidth(">>") - HGAP, lineHeight, "");
myUrl->setID(kLinkId);
myUrlButton = new ButtonWidget(myTab, _font, _w - HBORDER - 2 - buttonWidth(">>"), ypos - 1,
buttonWidth(">>"), myUrl->getHeight(), ">>", kLinkPressed);
wid.push_back(myUrl);
// Add items for tab 3
addToFocusList(wid, myTab, tabID);
@ -847,6 +858,9 @@ void GameInfoDialog::loadCartridgeProperties(const Properties& props)
myModelNo->setText(props.get(PropType::Cart_ModelNo));
myRarity->setText(props.get(PropType::Cart_Rarity));
myNote->setText(props.get(PropType::Cart_Note));
myUrl->setText(props.get(PropType::Cart_Url));
updateLink();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -958,6 +972,7 @@ void GameInfoDialog::saveProperties()
myGameProperties.set(PropType::Cart_ModelNo, myModelNo->getText());
myGameProperties.set(PropType::Cart_Rarity, myRarity->getText());
myGameProperties.set(PropType::Cart_Note, myNote->getText());
myGameProperties.set(PropType::Cart_Note, myUrl->getText());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1225,6 +1240,12 @@ void GameInfoDialog::eraseEEPROM()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::updateLink()
{
myUrlButton->setEnabled(myUrl->getText() != EmptyString);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::updateHighScoresWidgets()
{
@ -1455,7 +1476,17 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
case kLinkPressed:
MediaFactory::openURL(myUrl->getText());
break;
case EditTextWidget::kChangedCmd:
if(id == kLinkId)
{
updateLink();
break;
}
[[fallthrough]];
case kHiScoresChanged:
updateHighScoresWidgets();
break;

View File

@ -72,6 +72,8 @@ class GameInfoDialog : public Dialog, public CommandSender
void updateControllerStates();
// erase SaveKey/AtariVox pages for current game
void eraseEEPROM();
// update link button
void updateLink();
// update 'High Scores' tab widgets
void updateHighScoresWidgets();
// set formatted memory value for given address field
@ -130,6 +132,8 @@ class GameInfoDialog : public Dialog, public CommandSender
EditTextWidget* myModelNo{nullptr};
EditTextWidget* myRarity{nullptr};
EditTextWidget* myNote{nullptr};
ButtonWidget* myUrlButton{nullptr};
EditTextWidget* myUrl{nullptr};
// High Scores properties
CheckboxWidget* myHighScores{nullptr};
@ -180,9 +184,12 @@ class GameInfoDialog : public Dialog, public CommandSender
kHiScoresChanged = 'HSch',
kPXCenterChanged = 'Pxch',
kPYCenterChanged = 'Pych',
kExportPressed = 'Expr'
kExportPressed = 'Expr',
kLinkPressed = 'Lkpr'
};
enum { kLinkId };
// Game properties for currently loaded ROM
Properties myGameProperties;
// Filename of the currently loaded ROM

View File

@ -128,10 +128,17 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
// Now add some info for the message box below the image
myRomInfo.push_back("Name: " + myProperties.get(PropType::Cart_Name));
myRomInfo.push_back("Manufacturer: " + myProperties.get(PropType::Cart_Manufacturer));
myRomInfo.push_back("Model: " + myProperties.get(PropType::Cart_ModelNo));
myRomInfo.push_back("Rarity: " + myProperties.get(PropType::Cart_Rarity));
myRomInfo.push_back("Note: " + myProperties.get(PropType::Cart_Note));
string value;
if((value = myProperties.get(PropType::Cart_Manufacturer)) != EmptyString)
myRomInfo.push_back("Manufacturer: " + value);
if((value = myProperties.get(PropType::Cart_ModelNo)) != EmptyString)
myRomInfo.push_back("Model: " + value);
if((value = myProperties.get(PropType::Cart_Rarity)) != EmptyString)
myRomInfo.push_back("Rarity: " + value);
if((value = myProperties.get(PropType::Cart_Note)) != EmptyString)
myRomInfo.push_back("Note: " + value);
bool swappedPorts = myProperties.get(PropType::Console_SwapPorts) == "YES";
// Load the image for controller and bankswitch type auto detection
@ -167,8 +174,11 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
}
if(left != "" && right != "")
myRomInfo.push_back("Controllers: " + (left + " (left), " + right + " (right)"));
if (bsDetected != "")
myRomInfo.push_back("Type: " + Bankswitch::typeToDesc(Bankswitch::nameToType(bsDetected)));
if((value = myProperties.get(PropType::Cart_Url)) != EmptyString)
myRomInfo.push_back("Link: " + value);
setDirty();
}

View File

@ -30,7 +30,8 @@ my %prop_type = (
"Display.VCenter" => 24,
"Display.Phosphor" => 25,
"Display.PPBlend" => 26,
"Cart.Highscore" => 27
"Cart.Highscore" => 27,
"Cart.Url" => 28
);
my @prop_type_as_string = (
"Cart.MD5",
@ -59,7 +60,8 @@ my @prop_type_as_string = (
"Display.VCenter",
"Display.Phosphor",
"Display.PPBlend",
"Cart_Highscore"
"Cart_Highscore",
"Cart_Url"
);
my @prop_defaults = (
@ -93,7 +95,8 @@ my @prop_defaults = (
"1", # Cart.Variations
"", # Cart.Formats
"", # Cart.Addresses
"" # Cart.Highscore
"", # Cart.Highscore
"" # Cart.Url
);
# Load and parse a properties file into an hash table of property