add high scores data for 6 more games

move cart name from title to extra widget
fix and refactor value bit masking
This commit is contained in:
thrust26 2020-02-21 09:36:40 +01:00
parent d0ff7ba8eb
commit 845ad9520a
7 changed files with 111 additions and 37 deletions

View File

@ -340,16 +340,8 @@ Int32 HighScoresManager::variation(uInt16 addr, bool varBCD, bool zeroBased,
return DEFAULT_VARIATION;
Int32 var = peek(addr);
Int32 bits = ceil(log(numVariations + (!zeroBased ? 1 : 0))/log(2));
if (varBCD)
var = fromBCD(var);
// limit to game's number of variations
var %= 1 << bits;
var += zeroBased ? 1 : 0;
return var;
return convert(var, numVariations, varBCD, zeroBased);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -451,6 +443,24 @@ Int32 HighScoresManager::special(uInt16 addr, bool varBCD, bool zeroBased) const
return var;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 HighScoresManager::convert(uInt32 val, uInt32 maxVal, bool isBCD, bool zeroBased) const
{
maxVal += zeroBased ? 0 : 1;
Int32 bits = isBCD
? ceil(log(maxVal) / log(10) * 4)
: ceil(log(maxVal) / log(2));
if (isBCD)
val = fromBCD(val);
// limit to maxVal's bits
val %= 1 << bits;
val += zeroBased ? 1 : 0;
return val;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 HighScoresManager::fromBCD(uInt8 bcd) const
{

View File

@ -119,6 +119,10 @@ class HighScoresManager
bool scoreInvert() const;
Int32 special() const;
// converts the given value, using only the maximum bits required by maxVal
// and adjusted for BCD and zero based data
Int32 convert(uInt32 val, uInt32 maxVal, bool isBCD, bool zeroBased) const;
private:
enum {
//IDX_ARM_RAM = 0,

View File

@ -7,6 +7,16 @@
"Cart.Addresses" "CC,CE,DD,E6"
""
"Cart.MD5" "136f75c4dd02c29283752b7e5799f978"
"Cart.Manufacturer" "Atari, Dan Hitchens - Sears"
"Cart.ModelNo" "CX2650 - 49-75168"
"Cart.Name" "Berzerk (1982) (Atari)"
"Cart.Rarity" "Common"
"Cart.Variations" "12"
"Cart.Formats" "6"
"Cart.Addresses" "DD,DE,DF,80"
""
"Cart.MD5" "278f14887d601b5e5b620f1870bc09f6"
"Cart.Manufacturer" "Thomas Jentzsch"
"Cart.Name" "SWOOPS! (v0.96) (TJ)"
@ -17,6 +27,13 @@
"Cart.Addresses" "FD,FE,FF,FC"
""
"Cart.MD5" "6dda84fb8e442ecf34241ac0d1d91d69"
"Cart.Manufacturer" "Atari - GCC, Douglas B. Macrae"
"Cart.ModelNo" "CX2677"
"Cart.Name" "Dig Dug (1983) (Atari)"
"Cart.Addresses" "F0FE,F0FD"
""
"Cart.MD5" "72ffbef6504b75e69ee1045af9075f66"
"Cart.Manufacturer" "Atari, Richard Maurer - Sears"
"Cart.ModelNo" "CX2632 - 49-75153"
@ -43,6 +60,14 @@
"Cart.Addresses" "F4,F5,F6"
""
"Cart.MD5" "91f0a708eeb93c133e9672ad2c8e0429"
"Cart.Name" "Oystron (V2.9) (Piero Cavina) (PD)"
"Cart.Rarity" "New Release"
"Cart.Variations" "3"
"Cart.Formats" "5,1,B,0,B,1"
"Cart.Addresses" "D4,D3,E5"
""
"Cart.MD5" "9ad36e699ef6f45d9eb6c4cf90475c9f"
"Cart.Manufacturer" "Imagic, Dennis Koble"
"Cart.ModelNo" "720103-1A, 720103-1B, IA3203, IX-010-04"
@ -63,6 +88,16 @@
"Cart.Addresses" "AE,B0,B2,BC"
""
"Cart.MD5" "ac7c2260378975614192ca2bc3d20e0b"
"Cart.Manufacturer" "Activision, David Crane"
"Cart.ModelNo" "AG-930-04, AZ-030"
"Cart.Name" "Decathlon (1983) (Activision)"
"Cart.Rarity" "Rare"
"Cart.Variations" "10"
"Cart.Formats" "4,0,B,0,D,1"
"Cart.Addresses" "95,96,80"
""
"Cart.MD5" "c1cb228470a87beb5f36e90ac745da26"
"Cart.Manufacturer" "Activision, Bob Whitehead"
"Cart.ModelNo" "AX-015, AX-015-04"
@ -92,6 +127,16 @@
"Cart.Addresses" "BD,BE,80,C7"
""
"Cart.MD5" "f0e0addc07971561ab80d9abe1b8d333"
"Cart.Manufacturer" "Imagic, Rob Fulop"
"Cart.ModelNo" "720000-200, 720101-1B, 720101-1C, IA3200, IA3200C, IX-006-04"
"Cart.Name" "Demon Attack (1982) (Imagic)"
"Cart.Note" "AKA Death from Above"
"Cart.Variations" "10"
"Cart.Formats" "6,0,B,0,B,0,WAVE,B,1"
"Cart.Addresses" "81,83,85,EA,80"
""
"Cart.MD5" "f1489e27a4539a0c6c8529262f9f7e18"
"Cart.Manufacturer" "Champ Games"
"Cart.ModelNo" "CG-01-P"
@ -105,12 +150,32 @@
"Cart.Addresses" "8E,8D,8C,8A,89"
""
"Cart.MD5" "f34f08e5eb96e500e851a80be3277a56"
"Cart.Manufacturer" "Atari, Brad Stewart - Sears"
"Cart.ModelNo" "CX2622 - 6-99813, 49-75107"
"Cart.Name" "Breakout (1978) (Atari)"
"Cart.Note" "Uses the Paddle Controllers"
"Controller.MouseAxis" "01 60"
"Cart.Formats" "3"
"Cart.Addresses" "CE,CD"
""
"Cart.MD5" "f8240e62d8c0a64a61e19388414e3104"
"Cart.Manufacturer" "Activision, Steve Cartwright"
"Cart.ModelNo" "AX-013"
"Cart.Name" "Barnstorming (1982) (Activision)"
"Cart.Rarity" "Uncommon"
"Cart.Variations" "4"
"Cart.Formats" "6,0,B,1,B,1"
"Cart.Addresses" "B5,B6,B7,80"
""
"Cart.MD5" "fca4a5be1251927027f2c24774a02160"
"Cart.Manufacturer" "Activision, John Van Ryzin"
"Cart.ModelNo" "AZ-036-04"
"Cart.Name" "H.E.R.O. (1984) (Activision)"
"Cart.Variations" "5"
"Cart.Formats" "6,0,B,0,B,1,LEVEL,B,1"
"Cart.Addresses" "B7,B8,B9,B4,F5"
"Cart.Formats" "6,0,B,0,B,1,LEVEL,D,1"
"Cart.Addresses" "B7,B8,B9,80,F5"
""

View File

@ -1130,10 +1130,10 @@ void GameInfoDialog::updateHighScoresWidgets()
// update variations RAM value
setAddressVal(myVarAddress, myVarAddressVal, myVarsBCD->getState(),
myVarsZeroBased->getState() ? 1 : 0, stringToInt(myVariations->getText(), 1));
myVarsZeroBased->getState(), stringToInt(myVariations->getText(), 1));
setAddressVal(mySpecialAddress, mySpecialAddressVal, mySpecialBCD->getState(),
mySpecialZeroBased->getState() ? 1 : 0);
mySpecialZeroBased->getState());
// update score RAM values and resulting scores
HSM::ScoreAddresses scoreAddr;
@ -1166,7 +1166,7 @@ void GameInfoDialog::updateHighScoresWidgets()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::setAddressVal(EditTextWidget* addressWidget, EditTextWidget* valWidget,
bool isBCD, uInt8 incVal, uInt8 maxVal)
bool isBCD, bool zeroBased, uInt8 maxVal)
{
string strAddr;
@ -1180,16 +1180,15 @@ void GameInfoDialog::setAddressVal(EditTextWidget* addressWidget, EditTextWidget
uInt16 addr;
uInt8 val;
ostringstream ss;
Int32 bits = ceil(log(maxVal + incVal)/log(2));
// convert to number and read from memory
addr = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
val = system.peek(addr);
val %= 1 << bits;
val += incVal;
val = instance().highScores().convert(val, maxVal, isBCD, zeroBased);
// format output and display in value widget
if (isBCD)
ss << hex;
//if (isBCD)
// ss << hex;
ss << right //<< setw(2) << setfill(' ')
<< uppercase << uInt16(val);
valWidget->setText(ss.str());

View File

@ -73,7 +73,7 @@ class GameInfoDialog : public Dialog, public CommandSender
void updateHighScoresWidgets();
// set formatted memory value for given address field
void setAddressVal(EditTextWidget* address, EditTextWidget* val,
bool isBCD = true, uInt8 incVal = 0, uInt8 maxVal = 255);
bool isBCD = true, bool zeroBased = false, uInt8 maxVal = 255);
private:
TabWidget* myTab{nullptr};
@ -140,7 +140,7 @@ class GameInfoDialog : public Dialog, public CommandSender
CheckboxWidget* mySpecialBCD{nullptr};
CheckboxWidget* mySpecialZeroBased{nullptr};
StaticTextWidget* myScoreLabel{nullptr};
StaticTextWidget* myScoreLabel{nullptr};
StaticTextWidget* myScoreDigitsLabel{nullptr};
PopUpWidget* myScoreDigits{nullptr};
StaticTextWidget* myTrailingZeroesLabel{nullptr};

View File

@ -81,13 +81,14 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
VariantList items;
ypos = VBORDER + _th; xpos = HBORDER;
ypos += lineHeight + VGAP * 2; // space for game name
StaticTextWidget* s = new StaticTextWidget(this, _font, xpos, ypos + 1, "Variation ");
myVariationPopup = new PopUpWidget(this, _font, s->getRight(), ypos,
_font.getStringWidth("256") - 4, lineHeight, items, "", 0,
kVariationChanged);
wid.push_back(myVariationPopup);
myPrevVarButton = new ButtonWidget(this, _font, myVariationPopup->getRight() + 162, ypos - 1,
myPrevVarButton = new ButtonWidget(this, _font, myVariationPopup->getRight() + 157, ypos - 1,
48, myVariationPopup->getHeight(),
PREV_GFX.data(), BUTTON_GFX_W, BUTTON_GFX_H, kPrevVariation);
wid.push_back(myPrevVarButton);
@ -99,15 +100,15 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
ypos += lineHeight + VGAP * 4;
int xposRank = HBORDER;
int xposScore = xposRank + _font.getStringWidth("Rank") + 24;
int xposSpecial = xposScore + _font.getStringWidth("Score") + 24;
int xposScore = xposRank + _font.getStringWidth("Rank");
int xposSpecial = xposScore + _font.getStringWidth(" Score") + 16;
int xposName = xposSpecial + _font.getStringWidth("Round") + 16;
int xposDate = xposName + _font.getStringWidth("Name") + 16;
int xposDelete = xposDate + _font.getStringWidth("YY-MM-DD HH:MM") + 16;
int nWidth = _font.getStringWidth("ABC") + 4;
new StaticTextWidget(this, _font, xposRank, ypos + 1, "Rank");
new StaticTextWidget(this, _font, xposScore, ypos + 1, " Score");
new StaticTextWidget(this, _font, xposScore, ypos + 1, " Score");
mySpecialLabelWidget = new StaticTextWidget(this, _font, xposSpecial, ypos + 1, "Round");
new StaticTextWidget(this, _font, xposName - 2, ypos + 1, "Name");
new StaticTextWidget(this, _font, xposDate+16, ypos + 1, "Date Time");
@ -140,6 +141,9 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
_h = myMD5Widget->getBottom() + VBORDER + buttonHeight(_font) + VBORDER;
_w = myDeleteButtons[0]->getRight() + HBORDER;
myGameNameWidget = new StaticTextWidget(this, _font, HBORDER, VBORDER + _th + 1,
_w - HBORDER * 2, lineHeight);
addDefaultsOKCancelBGroup(wid, _font, "Save", "Cancel", " Reset ");
addToFocusList(wid);
}
@ -153,7 +157,7 @@ HighScoresDialog::~HighScoresDialog()
void HighScoresDialog::loadConfig()
{
// Enable blending (only once is necessary)
if (!surface().attributes().blending)
if (myMode == Menu::AppMode::emulator && !surface().attributes().blending)
{
surface().attributes().blending = true;
surface().attributes().blendalpha = 90;
@ -187,14 +191,7 @@ void HighScoresDialog::loadConfig()
myMD5Widget->setLabel("MD5: " + myMD5);
// requires the current MD5
string title = "High Scores - " + cartName();
uInt32 maxChars = (_w - 20) / _font.getMaxCharWidth();
if(title.length() > maxChars)
setTitle(title.substr(0, maxChars - 1) + ELLIPSIS);
else
setTitle(title);
myGameNameWidget->setLabel(cartName());
myEditRank = myHighScoreRank = -1;
myNow = now();
@ -440,9 +437,6 @@ string HighScoresDialog::cartName() const
Properties props;
instance().propSet().getMD5(myMD5, props);
cerr << myMD5 << endl;
if(props.get(PropType::Cart_Name).empty())
return instance().launcher().currentNode().getNameWithExt("");
else

View File

@ -112,6 +112,8 @@ class HighScoresDialog : public Dialog
string myDates[NUM_RANKS];
string myMD5;
StaticTextWidget* myGameNameWidget{nullptr};
PopUpWidget* myVariationPopup{nullptr};
ButtonWidget* myPrevVarButton{nullptr};
ButtonWidget* myNextVarButton{nullptr};