adapt DefProps.hxx generation (TODO: compiler error)

This commit is contained in:
thrust26 2020-02-08 17:21:20 +01:00
parent 915e11dc6c
commit 6930e91fa5
4 changed files with 3036 additions and 3563 deletions

View File

@ -1165,54 +1165,18 @@ Int32 Console::numPlayers()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Console::parseAdresses(Int32& variation, Int32& player, Int32 scores[]) bool Console::parseAdresses(Int32& variation, Int32& player, Int32 scores[])
{ {
// format: // Formats (all optional):
// b, ; variation format (BCD, HEX)
// 0, ; add to variation
// 80, ; variation address in hex
// 81, ; player address in hex
// b, ; score format (BCD, HEX)
// 10, ; score multiplier
// 2, ; score addresses per player // 2, ; score addresses per player
// n-times 82, ; score addresses player 1 in hex, high to low // 1, ; score multiplier
// n-times 83, ; score addresses player 2 in hex, high to low // B, ; score format (BCD, HEX)
// ... // B, ; variation format (BCD, HEX)
// Formats:
// 2, ; score addresses per player
// 10, ; score multiplier
// b, ; score format (BCD, HEX)
// b, ; variation format (BCD, HEX)
// 0, ; add to variation // 0, ; add to variation
// Addresses // Addresses (in hex):
// n*v-times 82, ; score addresses player x in hex, high to low // n*p-times xx, ; score addresses for each player, high to low
// 80, ; variation address in hex // xx, ; variation address (if more than 1 variation)
// 81, ; player address in hex // xx, ; player address (if more than 1 player)
// ...
/*
Frogger
"Cart.Players" "2"
"Cart.Variations" "6"
//"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.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.Formats" "2,10,b,h,1"
"Cart.Addresses" "bd,be,c0,c1,80,c7"
*/
// TODO: // TODO:
// - variation bits (Centipede)
// - player bits (Asteroids) // - player bits (Asteroids)
// - score swaps (Asteroids) // - score swaps (Asteroids)
@ -1239,9 +1203,9 @@ bool Console::parseAdresses(Int32& variation, Int32& player, Int32 scores[])
if (!(formatBuf >> scoreMult)) if (!(formatBuf >> scoreMult))
scoreMult = 1; scoreMult = 1;
if (!(formatBuf >> scoreFormat)) if (!(formatBuf >> scoreFormat))
scoreFormat = 'b'; scoreFormat = 'B';
if (!(formatBuf >> varFormat)) if (!(formatBuf >> varFormat))
varFormat = 'b'; varFormat = 'B';
if (!(formatBuf >> varAdd)) if (!(formatBuf >> varAdd))
varAdd = 0; varAdd = 0;
@ -1257,26 +1221,34 @@ bool Console::parseAdresses(Int32& variation, Int32& player, Int32 scores[])
if (!(addrBuf >> std::hex >> addr)) if (!(addrBuf >> std::hex >> addr))
return false; return false;
totalScore *= (scoreFormat == 'b') ? 100 : 256; totalScore *= (scoreFormat == 'B') ? 100 : 256;
score = mySystem->peek(addr); score = mySystem->peek(addr);
if (scoreFormat == 'b') if (scoreFormat == 'B')
score = (score >> 4) * 10 + score % 16; score = (score >> 4) * 10 + score % 16;
totalScore += score; totalScore += score;
} }
scores[i] = totalScore * scoreMult; scores[i] = totalScore * scoreMult;
} }
variation = 1; player = 0;
// 3. retrieve current variation (0..255) // 3. retrieve current variation (0..255)
if (numVariations() == 1)
return true;
if (!(addrBuf >> std::hex >> addr)) if (!(addrBuf >> std::hex >> addr))
return false; return false;
variation = mySystem->peek(addr); variation = mySystem->peek(addr);
if (varFormat == 'b') if (varFormat == 'B')
variation = (variation >> 4) * 10 + variation % 16; variation = (variation >> 4) * 10 + variation % 16;
variation += varAdd; variation += varAdd;
variation = std::min(variation, numVariations()); variation = std::min(variation, numVariations());
// 4. retrieve current player (0..3) // 4. retrieve current player (0..3)
if (numPlayers() == 1)
return true;
if (!(addrBuf >> std::hex >> addr)) if (!(addrBuf >> std::hex >> addr))
return false; return false;

File diff suppressed because it is too large Load Diff

View File

@ -56,6 +56,8 @@ void Properties::set(PropType key, const string& value)
case PropType::Controller_MouseAxis: case PropType::Controller_MouseAxis:
case PropType::Display_Format: case PropType::Display_Format:
case PropType::Display_Phosphor: case PropType::Display_Phosphor:
case PropType::Cart_Formats:
case PropType::Cart_Addresses:
{ {
BSPF::toUpperCase(myProperties[pos]); BSPF::toUpperCase(myProperties[pos]);
break; break;

View File

@ -23,7 +23,11 @@ my %prop_type = (
"Display.Format" => 17, "Display.Format" => 17,
"Display.VCenter" => 18, "Display.VCenter" => 18,
"Display.Phosphor" => 19, "Display.Phosphor" => 19,
"Display.PPBlend" => 20 "Display.PPBlend" => 20,
"Cart.Players" => 21,
"Cart.Variations" => 22,
"Cart.Formats" => 23,
"Cart.Addresses" => 24
); );
my @prop_type_as_string = ( my @prop_type_as_string = (
"Cart.MD5", "Cart.MD5",
@ -46,7 +50,11 @@ my @prop_type_as_string = (
"Display.Format", "Display.Format",
"Display.VCenter", "Display.VCenter",
"Display.Phosphor", "Display.Phosphor",
"Display.PPBlend" "Display.PPBlend",
"Cart.Players",
"Cart.Variations",
"Cart.Formats",
"Cart.Addresses"
); );
my @prop_defaults = ( my @prop_defaults = (
@ -70,7 +78,11 @@ my @prop_defaults = (
"AUTO", "AUTO",
"0", "0",
"NO", "NO",
"0" "0",
"1",
"1",
"",
""
); );
# Load and parse a properties file into an hash table of property # Load and parse a properties file into an hash table of property