diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 260478441..2e5ab45e1 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -1176,57 +1176,76 @@ bool Console::parseAdresses(Int32& variation, Int32& player, Int32 scores[]) // n-times 82, ; score addresses player 1 in hex, high to low // n-times 83, ; score addresses player 2 in hex, high to low // ... + + // Formats: + // 2, ; score addresses per player + // 10, ; score multiplier + // b, ; score format (BCD, HEX) + // b, ; variation format (BCD, HEX) + // 0, ; add to variation + // Addresses + // n*v-times 82, ; score addresses player x in hex, high to low + // 80, ; variation address in hex + // 81, ; player address in hex + // ... + /* Frogger "Cart.Players" "2" "Cart.Variations" "6" - "Cart.Addresses" "b,0,dd,e6,b,1,2,cc,ce,cd,cf" + //"Cart.Addresses" "b,0,dd,e6,b,1,2,cc,ce,cd,cf" + "Cart.Formats" "2,1,b,b,0" + "Cart.Addresses" "cc,ce,cd,cf,dd,e6" + Chopper Command: "Cart.Variations" "4" "Cart.Players" "2" - "Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" + //"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" + "Cart.Formats" "3,1,b,b,1" + "Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" Asteroids "Cart.Players" "2" "Cart.Variations" "66" - "Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" - + //"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" + "Cart.Formats" "2,10,b,h,1" + "Cart.Addresses" "bd,be,c0,c1,80,c7" */ + // TODO: + // - player bits (Asteroids) + // - score swaps (Asteroids) + + + string formats = myProperties.get(PropType::Cart_Formats); string addresses = myProperties.get(PropType::Cart_Addresses); - char format; + char scoreFormat; + char varFormat; Int16 addr; Int32 varAdd, numScoreAddr, scoreMult; // Since istringstream swallows whitespace, we have to make the // delimiters be spaces + std::replace(formats.begin(), formats.end(), ',', ' '); + std::replace(formats.begin(), formats.end(), '|', ' '); std::replace(addresses.begin(), addresses.end(), ',', ' '); std::replace(addresses.begin(), addresses.end(), '|', ' '); - istringstream buf(addresses); + istringstream addrBuf(addresses); + istringstream formatBuf(formats); - // 1. retrieve current variation (0..255) - if (!(buf >> format && buf >> varAdd && buf >> std::hex >> addr)) - return false; - - variation = mySystem->peek(addr); - if (format == 'b') - variation = (variation >> 4) * 10 + variation % 16; - variation += varAdd; - variation = std::min(variation, numVariations()); - - // 2. retrieve current player (0..3) - string playerFormat; - - if (!(buf >> std::hex >> addr)) - return false; - - player = mySystem->peek(addr); - player = std::min(player, numPlayers()); - - // 3. retrieve current scores for all players - if (!(buf >> format && buf >> std::dec >> scoreMult && buf >> std::hex >> numScoreAddr)) - return false; + // 1. retrieve formats + if (!(formatBuf >> numScoreAddr)) + numScoreAddr = 2; + if (!(formatBuf >> scoreMult)) + scoreMult = 1; + if (!(formatBuf >> scoreFormat)) + scoreFormat = 'b'; + if (!(formatBuf >> varFormat)) + varFormat = 'b'; + if (!(formatBuf >> varAdd)) + varAdd = 0; + // 2. retrieve current scores for all players for (int i = 0; i < numPlayers(); ++i) { Int32 totalScore = 0; @@ -1235,18 +1254,35 @@ bool Console::parseAdresses(Int32& variation, Int32& player, Int32 scores[]) { Int32 score; - if (!(buf >> std::hex >> addr)) + if (!(addrBuf >> std::hex >> addr)) return false; - totalScore *= (format == 'b') ? 100 : 256; + totalScore *= (scoreFormat == 'b') ? 100 : 256; score = mySystem->peek(addr); - if (format == 'b') + if (scoreFormat == 'b') score = (score >> 4) * 10 + score % 16; totalScore += score; } scores[i] = totalScore * scoreMult; } + + // 3. retrieve current variation (0..255) + if (!(addrBuf >> std::hex >> addr)) + return false; + variation = mySystem->peek(addr); + if (varFormat == 'b') + variation = (variation >> 4) * 10 + variation % 16; + variation += varAdd; + variation = std::min(variation, numVariations()); + + // 4. retrieve current player (0..3) + if (!(addrBuf >> std::hex >> addr)) + return false; + + player = mySystem->peek(addr); + player = std::min(player, numPlayers() - 1); + return true; } diff --git a/src/emucore/Props.cxx b/src/emucore/Props.cxx index 6b3296262..e5188eb43 100644 --- a/src/emucore/Props.cxx +++ b/src/emucore/Props.cxx @@ -258,6 +258,7 @@ void Properties::print() const << get(PropType::Display_PPBlend) << "|" << get(PropType::Cart_Players) << "|" << get(PropType::Cart_Variations) << "|" + << get(PropType::Cart_Formats) << "|" << get(PropType::Cart_Addresses) << endl; } @@ -306,6 +307,7 @@ void Properties::printHeader() << "Display_PPBlend|" << "Cart_Players|" << "Cart_Variations|" + << "Cart_Formats|" << "Cart_Addresses" << endl; } @@ -336,6 +338,7 @@ std::array Properties::ourDefaultProperties = "0", // Display.PPBlend "1", // Cart.Players "1", // Cart.Variations + "", // Cart.Formats, "" // Cart.Addresses }; @@ -365,5 +368,6 @@ std::array Properties::ourPropertyNames = "Display.PPBlend", "Cart.Players", "Cart.Variations", + "Cart.Formats", "Cart.Addresses" }; diff --git a/src/emucore/Props.hxx b/src/emucore/Props.hxx index d7fcbf7b4..dacc099e9 100644 --- a/src/emucore/Props.hxx +++ b/src/emucore/Props.hxx @@ -44,6 +44,7 @@ enum class PropType : uInt8 { Display_PPBlend, Cart_Players, Cart_Variations, + Cart_Formats, Cart_Addresses, NumTypes }; diff --git a/src/emucore/stella.pro b/src/emucore/stella.pro index e48c5808a..d9293939d 100644 --- a/src/emucore/stella.pro +++ b/src/emucore/stella.pro @@ -213,7 +213,7 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "6" -"Cart.Addresses" "b,0,dd,e6,b,1,2,cc,ce,cd,cf" +"Cart.Addresses" "cc,ce,cd,cf,dd,e6" "" "Cart.MD5" "02cee0b140d2f1a1efcfb1d482a5c392" @@ -645,7 +645,7 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "6" -"Cart.Addresses" "b,0,dd,e6,b,1,2,cc,ce,cd,cf" +"Cart.Addresses" "cc,ce,cd,cf,dd,e6" "" "Cart.MD5" "082fdc8bd47fef01482ce5883c4ffdb8" @@ -1511,7 +1511,8 @@ "Cart.Name" "Chopper Command (1982) (Activision) (PAL)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "11bcf5c752088b5aaf86d6c7a6a11e8d" @@ -2222,7 +2223,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "19b3b807507653516985ba95da92499d" @@ -2396,7 +2398,8 @@ "Cart.Note" "2600 Screen Search Console" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "1cafa9f3f9a2fce4af6e4b85a2bbd254" @@ -3157,7 +3160,8 @@ "Cart.Name" "Chopper Command (1982) (Activision) (16K)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "25e73efb9a6edf119114718bd2f646ba" @@ -3575,7 +3579,8 @@ "Cart.Note" "AKA Chopper Command" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "2a9f9001540c55a302befd8e9d54b47b" @@ -3902,7 +3907,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "2dcf9ce486393cd36ca0928cd53b96cb" @@ -4290,7 +4296,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "3276c777cbe97cdd2b4a63ffc16b7151" @@ -4758,7 +4765,8 @@ "Display.Format" "PAL" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "384db97670817103dd8c0bbdef132445" @@ -5131,7 +5139,8 @@ "Cart.Note" "AKA Chopper Command" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "3c7a7b3a0a7e6319b2fa0f923ef6c9af" @@ -5307,7 +5316,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "3e5ca1afaa27c5da3c54c9942fec528b" @@ -6062,7 +6072,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "47cd61f83457a0890de381e478f5cf5f" @@ -6922,7 +6933,8 @@ "Cart.Name" "Chopper Command (1982) (Activision) (8K)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "521f4dd1eb84a09b2b19959a41839aad" @@ -7723,7 +7735,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "5bcc83677d68f7ef74c1b4a0697ba2a8" @@ -7760,7 +7773,8 @@ "Cart.Note" "AKA Chopper Command" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "5c19f6da638c4c7c1f98d09e63df43e4" @@ -9510,7 +9524,8 @@ "Cart.Note" "AKA Chopper Command" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "6fc27a9233fc69d28d3f190b4ff80f03" @@ -11421,7 +11436,8 @@ "Cart.Name" "Chopper Command (1983) (CCE)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "85b1bca93e69f13905107cc802a02470" @@ -11985,7 +12001,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "8d00a38f4c8f8800f1c237215ac243fc" @@ -12027,7 +12044,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "8e0ab801b1705a740b476b7f588c6d16" @@ -14134,7 +14152,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "a97733b0852ee3096300102cb0689175" @@ -14819,7 +14838,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "b23ebf427713dd0198b7ef47dbd07ef4" @@ -15396,7 +15416,8 @@ "Cart.Name" "Chopper Command (SuperVision) (PAL)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "ba257438f8a78862a9e014d831143690" @@ -15472,7 +15493,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "bb579404924c40ca378b4aff6ccf302d" @@ -15911,7 +15933,8 @@ "Cart.Name" "Chopper Command (1982) (Activision)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "c1e6e4e7ef5f146388a090f1c469a2fa" @@ -16025,7 +16048,8 @@ "Cart.Rarity" "Hack" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "c2c8eb642765137bb82b83a65232961f" @@ -16862,7 +16886,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "cccfe9e9a11b1dad04beba46eefb7351" @@ -17680,7 +17705,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "d573089534ca596e64efef474be7b6bc" @@ -18071,7 +18097,8 @@ "Cart.Name" "Chopper Command (1983) (Digitel)" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "da732c57697ad7d7af414998fa527e75" @@ -18370,7 +18397,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "dd8a2124d4eda200df715c698a6ea887" @@ -18529,7 +18557,8 @@ "Display.Phosphor" "YES" "Cart.Players" "2" "Cart.Variations" "66" -"Cart.Addresses" "h,1,80,c7,b,10,2,bd,be,c0,c1" +"Cart.Formats" "2,10,b,h,1" +"Cart.Addresses" "bd,be,c0,c1,80,c7" "" "Cart.MD5" "df5cc5cccdc140eb7107f5b8adfacda1" @@ -20814,7 +20843,8 @@ "Cart.Rarity" "Hack" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "f8b2a6a4d73ebff10d805a9b59041986" @@ -21481,7 +21511,8 @@ "Cart.Name" "Chopper Command (1983) (CCE) [a]" "Cart.Players" "2" "Cart.Variations" "4" -"Cart.Addresses" "b,1,e0,eb,b,1,3,ec,ee,f0,ed,ef,f1" +"Cart.Formats" "3,1,b,b,1" +"Cart.Addresses" "ec,ee,f0,ed,ef,f1,e0,eb" "" "Cart.MD5" "ffe51989ba6da2c6ae5a12d277862e16"