add high score support for CDF, DPC+ and BUS

add high score data for Draconian RC6 and SF2 (RC8)
This commit is contained in:
thrust26 2020-02-21 11:05:52 +01:00
parent 845ad9520a
commit 481b9d1c04
11 changed files with 113 additions and 8 deletions

View File

@ -44,9 +44,11 @@
#include "OSystem.hxx"
#include "PropsSet.hxx"
#include "System.hxx"
#include "Cart.hxx"
#include "Console.hxx"
#include "Launcher.hxx"
#include "System.hxx"
#include "HighScoresManager.hxx"
@ -65,8 +67,10 @@ Int16 HighScoresManager::peek(uInt16 addr) const
{
if (myOSystem.hasConsole())
{
System& system = myOSystem.console().system();
return system.peek(addr);
if(addr < 0x100u || myOSystem.console().cartridge().internalRamSize() == 0)
return myOSystem.console().system().peek(addr);
else
return myOSystem.console().cartridge().internalRamGetValue(addr);
}
return -1;
}
@ -454,6 +458,9 @@ Int32 HighScoresManager::convert(uInt32 val, uInt32 maxVal, bool isBCD, bool zer
if (isBCD)
val = fromBCD(val);
if(val == -1)
return 0;
// limit to maxVal's bits
val %= 1 << bits;
val += zeroBased ? 1 : 0;

View File

@ -123,6 +123,9 @@ class HighScoresManager
// and adjusted for BCD and zero based data
Int32 convert(uInt32 val, uInt32 maxVal, bool isBCD, bool zeroBased) const;
// Peek into memory
Int16 peek(uInt16 addr) const;
private:
enum {
//IDX_ARM_RAM = 0,
@ -177,8 +180,6 @@ class HighScoresManager
Properties& properties(Properties& props) const;
// Get value from highscore propterties at given index
string getPropIdx(const Properties& props, PropType type, uInt32 idx = 0) const;
// Peek into memory
Int16 peek(uInt16 addr) const;
Int32 fromBCD(uInt8 bcd) const;

View File

@ -1,3 +1,11 @@
"Cart.MD5" "05215b73ec33b502449ee726ac6b201f"
"Cart.Name" "draconian_20171013_RC6"
"Display.Phosphor" "YES"
"Cart.Variations" "4"
"Cart.Formats" "8,0,B,0,B,1,SECT.,D,1"
"Cart.Addresses" "177B,177A,1779,1778,811,1780"
""
"Cart.MD5" "081e2c114c9c20b61acf25fc95c71bf4"
"Cart.Manufacturer" "Parker Brothers, Ed English, David Lamkins"
"Cart.ModelNo" "PB5300"
@ -27,6 +35,12 @@
"Cart.Addresses" "FD,FE,FF,FC"
""
"Cart.MD5" "541cac55ebcf7891d9d51c415922303f"
"Cart.Name" "SF2_20131217_RC8_NTSC"
"Cart.Formats" "8"
"Cart.Addresses" "1CF7,1CF6,1CF5,1CF4"
""
"Cart.MD5" "6dda84fb8e442ecf34241ac0d1d91d69"
"Cart.Manufacturer" "Atari - GCC, Douglas B. Macrae"
"Cart.ModelNo" "CX2677"

View File

@ -106,6 +106,20 @@ class Cartridge : public Device
*/
virtual bool bankChanged();
/**
Query the internal RAM size of the cart.
@return The internal RAM size
*/
virtual uInt32 internalRamSize() const { return 0; }
/**
Read a byte from cart internal RAM.
@return The value of the interal RAM byte
*/
virtual uInt8 internalRamGetValue(uInt16 addr) const { return 0; }
#ifdef DEBUGGER_SUPPORT
/**
To be called at the start of each instruction.

View File

@ -541,6 +541,15 @@ uInt32 CartridgeBUS::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeBUS::internalRamGetValue(uInt16 addr) const
{
if(addr < internalRamSize())
return myBUSRAM[addr];
else
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeBUS::save(Serializer& out) const
{

View File

@ -147,6 +147,20 @@ class CartridgeBUS : public Cartridge
*/
uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) override;
/**
Query the internal RAM size of the cart.
@return The internal RAM size
*/
uInt32 internalRamSize() const override { return 8_KB; }
/**
Read a byte from cart internal RAM.
@return The value of the interal RAM byte
*/
uInt8 internalRamGetValue(uInt16 addr) const override;
#ifdef DEBUGGER_SUPPORT
/**

View File

@ -487,6 +487,15 @@ uInt32 CartridgeCDF::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCDF::internalRamGetValue(uInt16 addr) const
{
if(addr < internalRamSize())
return myCDFRAM[addr];
else
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCDF::save(Serializer& out) const
{

View File

@ -151,6 +151,20 @@ class CartridgeCDF : public Cartridge
*/
uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) override;
/**
Query the internal RAM size of the cart.
@return The internal RAM size
*/
uInt32 internalRamSize() const override { return 8_KB; }
/**
Read a byte from cart internal RAM.
@return The value of the interal RAM byte
*/
uInt8 internalRamGetValue(uInt16 addr) const override;
#ifdef DEBUGGER_SUPPORT
/**
Get debugger widget responsible for accessing the inner workings

View File

@ -633,6 +633,15 @@ const uInt8* CartridgeDPCPlus::getImage(size_t& size) const
return myImage.data() + (myImage.size() - mySize);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeDPCPlus::internalRamGetValue(uInt16 addr) const
{
if(addr < internalRamSize())
return myDPCRAM[addr];
else
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPCPlus::save(Serializer& out) const
{

View File

@ -45,7 +45,7 @@ class System;
class CartridgeDPCPlus : public Cartridge
{
friend class CartridgeDPCPlusWidget;
friend class CartridgeRamDPCPlusWidget;
friend class CartridgeRamDPCPlusWidget;
public:
/**
@ -142,6 +142,21 @@ class CartridgeDPCPlus : public Cartridge
*/
string name() const override { return "CartridgeDPC+"; }
/**
Query the internal RAM size of the cart.
@return The internal RAM size
*/
uInt32 internalRamSize() const override { return 8_KB; }
/**
Read a byte from cart internal RAM.
@return The value of the interal RAM byte
*/
uInt8 internalRamGetValue(uInt16 addr) const override;
#ifdef DEBUGGER_SUPPORT
/**
Get debugger widget responsible for accessing the inner workings

View File

@ -1176,14 +1176,13 @@ void GameInfoDialog::setAddressVal(EditTextWidget* addressWidget, EditTextWidget
if (instance().hasConsole() && valWidget->isEnabled())
{
System& system = instance().console().system();
uInt16 addr;
uInt8 val;
ostringstream ss;
// convert to number and read from memory
addr = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
val = system.peek(addr);
val = instance().highScores().peek(addr);
val = instance().highScores().convert(val, maxVal, isBCD, zeroBased);
// format output and display in value widget