Fix issues with VS project, minor warning from clang, and autoformat

code.
This commit is contained in:
Stephen Anthony 2019-11-02 11:03:15 -02:30
parent c198edbe51
commit e0f7051e5c
3 changed files with 118 additions and 116 deletions

View File

@ -22,10 +22,10 @@
CartridgeFC::CartridgeFC(const ByteBuffer& image, size_t size, CartridgeFC::CartridgeFC(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings) const string& md5, const Settings& settings)
: Cartridge(settings, md5), : Cartridge(settings, md5),
myBankOffset(0), mySize(size),
myCurrentBank(0), myBankOffset(0),
mySize(size), myCurrentBank(0),
myTargetBank(0) myTargetBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin());

View File

@ -22,8 +22,9 @@ class System;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
#include "CartFCWidget.hxx" #include "CartFCWidget.hxx"
#endif #endif
/** /**
@ -38,147 +39,144 @@ class CartridgeFC : public Cartridge
{ {
friend class CartridgeFCWidget; friend class CartridgeFCWidget;
public: public:
/** /**
Create a new cartridge using the specified image Create a new cartridge using the specified image
@param image Pointer to the ROM image @param image Pointer to the ROM image
@param size The size of the ROM image @param size The size of the ROM image
@param md5 The md5sum of the ROM image @param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeFC(const ByteBuffer& image, size_t size, const string& md5, CartridgeFC(const ByteBuffer& image, size_t size, const string& md5,
const Settings& settings); const Settings& settings);
virtual ~CartridgeFC() = default; virtual ~CartridgeFC() = default;
public: public:
/** /**
Reset device to its power-on state Reset device to its power-on state
*/ */
void reset() override; void reset() override;
/** /**
Install cartridge in the specified system. Invoked by the system Install cartridge in the specified system. Invoked by the system
when the cartridge is attached to it. when the cartridge is attached to it.
@param system The system the device should install itself in @param system The system the device should install itself in
*/ */
void install(System& system) override; void install(System& system) override;
/** /**
Install pages for the specified bank in the system. Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system @param bank The bank that should be installed in the system
*/ */
bool bank(uInt16 bank) override; bool bank(uInt16 bank) override;
/** /**
Get the current bank. Get the current bank.
@param address The address to use when querying the bank @param address The address to use when querying the bank
*/ */
uInt16 getBank(uInt16 address = 0) const override; uInt16 getBank(uInt16 address = 0) const override;
/** /**
Query the number of banks supported by the cartridge. Query the number of banks supported by the cartridge.
*/ */
uInt16 bankCount() const override; uInt16 bankCount() const override;
/** /**
Patch the cartridge ROM. Patch the cartridge ROM.
@param address The ROM address to patch @param address The ROM address to patch
@param value The value to place into the address @param value The value to place into the address
@return Success or failure of the patch operation @return Success or failure of the patch operation
*/ */
bool patch(uInt16 address, uInt8 value) override; bool patch(uInt16 address, uInt8 value) override;
/** /**
Access the internal ROM image for this cartridge. Access the internal ROM image for this cartridge.
@param size Set to the size of the internal ROM image data @param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data @return A pointer to the internal ROM image data
*/ */
const uInt8* getImage(size_t& size) const override; const uInt8* getImage(size_t& size) const override;
/** /**
Save the current state of this cart to the given Serializer. Save the current state of this cart to the given Serializer.
@param out The Serializer object to use @param out The Serializer object to use
@return False on any errors, else true @return False on any errors, else true
*/ */
bool save(Serializer& out) const override; bool save(Serializer& out) const override;
/** /**
Load the current state of this cart from the given Serializer. Load the current state of this cart from the given Serializer.
@param in The Serializer object to use @param in The Serializer object to use
@return False on any errors, else true @return False on any errors, else true
*/ */
bool load(Serializer& in) override; bool load(Serializer& in) override;
/** /**
Get a descriptor for the device name (used in error checking). Get a descriptor for the device name (used in error checking).
@return The name of the object @return The name of the object
*/ */
string name() const override { return "CartridgeFC"; } string name() const override { return "CartridgeFC"; }
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
/** /**
Get debugger widget responsible for accessing the inner workings Get debugger widget responsible for accessing the inner workings
of the cart. of the cart.
*/ */
CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont, CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, int x, int y, int w, int h) override const GUI::Font& nfont, int x, int y, int w, int h) override
{ {
return new CartridgeFCWidget(boss, lfont, nfont, x, y, w, h, *this); return new CartridgeFCWidget(boss, lfont, nfont, x, y, w, h, *this);
} }
#endif #endif
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.
@return The byte at the specified address @return The byte at the specified address
*/ */
uInt8 peek(uInt16 address) override; uInt8 peek(uInt16 address) override;
/** /**
Change the byte at the specified address to the given value Change the byte at the specified address to the given value
@param address The address where the value should be stored @param address The address where the value should be stored
@param value The value to be stored at the address @param value The value to be stored at the address
@return True if the poke changed the device address space, else false @return True if the poke changed the device address space, else false
*/ */
bool poke(uInt16 address, uInt8 value) override; bool poke(uInt16 address, uInt8 value) override;
private: private:
// The 32K ROM image of the cartridge // The 32K ROM image of the cartridge
std::array<uInt8, 32_KB> myImage; std::array<uInt8, 32_KB> myImage;
// Size of the ROM image // Size of the ROM image
size_t mySize; size_t mySize;
// Indicates the offset into the ROM image (aligns to current bank)
uInt16 myBankOffset;
// Indicates the offset into the ROM image (aligns to current bank) // Indicates which bank is currently active for the first segment
uInt16 myBankOffset; uInt16 myCurrentBank;
// Indicates which bank is currently active for the first segment // Target bank defined by writing to $1FF8/9
uInt16 myCurrentBank; uInt16 myTargetBank;
private:
// Target bank defined by writing to $1FF8/9 // Following constructors and assignment operators not supported
uInt16 myTargetBank; CartridgeFC() = delete;
CartridgeFC(const CartridgeFC&) = delete;
private: CartridgeFC(CartridgeFC&&) = delete;
// Following constructors and assignment operators not supported CartridgeFC& operator=(const CartridgeFC&) = delete;
CartridgeFC() = delete; CartridgeFC& operator=(CartridgeFC&&) = delete;
CartridgeFC(const CartridgeFC&) = delete;
CartridgeFC(CartridgeFC&&) = delete;
CartridgeFC& operator=(const CartridgeFC&) = delete;
CartridgeFC& operator=(CartridgeFC&&) = delete;
}; };
#endif #endif

View File

@ -436,6 +436,7 @@
<ClCompile Include="..\debugger\gui\CartF8Widget.cxx" /> <ClCompile Include="..\debugger\gui\CartF8Widget.cxx" />
<ClCompile Include="..\debugger\gui\CartFA2Widget.cxx" /> <ClCompile Include="..\debugger\gui\CartFA2Widget.cxx" />
<ClCompile Include="..\debugger\gui\CartFAWidget.cxx" /> <ClCompile Include="..\debugger\gui\CartFAWidget.cxx" />
<ClCompile Include="..\debugger\gui\CartFCWidget.cxx" />
<ClCompile Include="..\debugger\gui\CartFEWidget.cxx" /> <ClCompile Include="..\debugger\gui\CartFEWidget.cxx" />
<ClCompile Include="..\debugger\gui\CartMDMWidget.cxx" /> <ClCompile Include="..\debugger\gui\CartMDMWidget.cxx" />
<ClCompile Include="..\debugger\gui\CartMNetworkWidget.cxx" /> <ClCompile Include="..\debugger\gui\CartMNetworkWidget.cxx" />
@ -471,6 +472,7 @@
<ClCompile Include="..\emucore\CartDF.cxx" /> <ClCompile Include="..\emucore\CartDF.cxx" />
<ClCompile Include="..\emucore\CartDFSC.cxx" /> <ClCompile Include="..\emucore\CartDFSC.cxx" />
<ClCompile Include="..\emucore\CartFA2.cxx" /> <ClCompile Include="..\emucore\CartFA2.cxx" />
<ClCompile Include="..\emucore\CartFC.cxx" />
<ClCompile Include="..\emucore\CartMDM.cxx" /> <ClCompile Include="..\emucore\CartMDM.cxx" />
<ClCompile Include="..\emucore\CartMNetwork.cxx" /> <ClCompile Include="..\emucore\CartMNetwork.cxx" />
<ClCompile Include="..\emucore\CartE78K.cxx" /> <ClCompile Include="..\emucore\CartE78K.cxx" />
@ -1142,6 +1144,7 @@
<ClInclude Include="..\debugger\gui\CartF8Widget.hxx" /> <ClInclude Include="..\debugger\gui\CartF8Widget.hxx" />
<ClInclude Include="..\debugger\gui\CartFA2Widget.hxx" /> <ClInclude Include="..\debugger\gui\CartFA2Widget.hxx" />
<ClInclude Include="..\debugger\gui\CartFAWidget.hxx" /> <ClInclude Include="..\debugger\gui\CartFAWidget.hxx" />
<ClInclude Include="..\debugger\gui\CartFCWidget.hxx" />
<ClInclude Include="..\debugger\gui\CartFEWidget.hxx" /> <ClInclude Include="..\debugger\gui\CartFEWidget.hxx" />
<ClInclude Include="..\debugger\gui\CartMDMWidget.hxx" /> <ClInclude Include="..\debugger\gui\CartMDMWidget.hxx" />
<ClInclude Include="..\debugger\gui\CartMNetworkWidget.hxx" /> <ClInclude Include="..\debugger\gui\CartMNetworkWidget.hxx" />
@ -1183,6 +1186,7 @@
<ClInclude Include="..\emucore\CartDF.hxx" /> <ClInclude Include="..\emucore\CartDF.hxx" />
<ClInclude Include="..\emucore\CartDFSC.hxx" /> <ClInclude Include="..\emucore\CartDFSC.hxx" />
<ClInclude Include="..\emucore\CartFA2.hxx" /> <ClInclude Include="..\emucore\CartFA2.hxx" />
<ClInclude Include="..\emucore\CartFC.hxx" />
<ClInclude Include="..\emucore\CartMDM.hxx" /> <ClInclude Include="..\emucore\CartMDM.hxx" />
<ClInclude Include="..\emucore\CartMNetwork.hxx" /> <ClInclude Include="..\emucore\CartMNetwork.hxx" />
<ClInclude Include="..\emucore\CartE78K.hxx" /> <ClInclude Include="..\emucore\CartE78K.hxx" />