From 218969eb59c373f6632c2effa478b19f1df60870 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 16 Sep 2019 21:29:08 -0230 Subject: [PATCH] Changed uInt32 to size_t where necessary. Finally decided to stop fighting C++, and just use size_t everywhere an array is used. Even though this is a 64-bit value, it seems that C++/STL expects it when dealing with arrays, so I guess we will too. --- src/debugger/CartDebug.cxx | 4 +- src/debugger/CartDebug.hxx | 2 +- src/debugger/DiStella.cxx | 4 +- src/debugger/gui/Cart3EPlusWidget.cxx | 2 +- src/debugger/gui/Cart3EWidget.cxx | 4 +- src/debugger/gui/Cart3FWidget.cxx | 2 +- src/debugger/gui/CartARWidget.cxx | 2 +- src/debugger/gui/CartCVPlusWidget.cxx | 2 +- src/debugger/gui/CartDASHWidget.cxx | 2 +- src/debugger/gui/CartDPCPlusWidget.cxx | 2 +- src/debugger/gui/CartDPCWidget.cxx | 2 +- src/debugger/gui/CartDebugWidget.cxx | 2 +- src/debugger/gui/CartDebugWidget.hxx | 2 +- src/debugger/gui/CartFA2Widget.cxx | 2 +- src/debugger/gui/CartMDMWidget.cxx | 2 +- src/debugger/gui/CartSBWidget.cxx | 2 +- src/emucore/Cart.cxx | 8 +- src/emucore/Cart.hxx | 6 +- src/emucore/Cart0840.cxx | 6 +- src/emucore/Cart0840.hxx | 4 +- src/emucore/Cart2K.cxx | 4 +- src/emucore/Cart2K.hxx | 4 +- src/emucore/Cart3E.cxx | 4 +- src/emucore/Cart3E.hxx | 6 +- src/emucore/Cart3EPlus.cxx | 6 +- src/emucore/Cart3EPlus.hxx | 6 +- src/emucore/Cart3F.cxx | 8 +- src/emucore/Cart3F.hxx | 6 +- src/emucore/Cart4A50.cxx | 4 +- src/emucore/Cart4A50.hxx | 6 +- src/emucore/Cart4K.cxx | 6 +- src/emucore/Cart4K.hxx | 4 +- src/emucore/Cart4KSC.cxx | 6 +- src/emucore/Cart4KSC.hxx | 4 +- src/emucore/CartAR.cxx | 8 +- src/emucore/CartAR.hxx | 6 +- src/emucore/CartBF.cxx | 6 +- src/emucore/CartBF.hxx | 4 +- src/emucore/CartBFSC.cxx | 6 +- src/emucore/CartBFSC.hxx | 4 +- src/emucore/CartBUS.cxx | 8 +- src/emucore/CartBUS.hxx | 4 +- src/emucore/CartCDF.cxx | 8 +- src/emucore/CartCDF.hxx | 4 +- src/emucore/CartCM.cxx | 6 +- src/emucore/CartCM.hxx | 4 +- src/emucore/CartCTY.cxx | 6 +- src/emucore/CartCTY.hxx | 4 +- src/emucore/CartCV.cxx | 4 +- src/emucore/CartCV.hxx | 6 +- src/emucore/CartCVPlus.cxx | 6 +- src/emucore/CartCVPlus.hxx | 6 +- src/emucore/CartDASH.cxx | 4 +- src/emucore/CartDASH.hxx | 6 +- src/emucore/CartDF.cxx | 6 +- src/emucore/CartDF.hxx | 4 +- src/emucore/CartDFSC.cxx | 6 +- src/emucore/CartDFSC.hxx | 4 +- src/emucore/CartDPC.cxx | 6 +- src/emucore/CartDPC.hxx | 6 +- src/emucore/CartDPCPlus.cxx | 10 +- src/emucore/CartDPCPlus.hxx | 6 +- src/emucore/CartDetector.cxx | 136 ++++++++++++------------- src/emucore/CartDetector.hxx | 66 ++++++------ src/emucore/CartE0.cxx | 6 +- src/emucore/CartE0.hxx | 4 +- src/emucore/CartE7.cxx | 2 +- src/emucore/CartE7.hxx | 2 +- src/emucore/CartE78K.cxx | 2 +- src/emucore/CartE78K.hxx | 2 +- src/emucore/CartEF.cxx | 6 +- src/emucore/CartEF.hxx | 4 +- src/emucore/CartEFSC.cxx | 6 +- src/emucore/CartEFSC.hxx | 4 +- src/emucore/CartF0.cxx | 6 +- src/emucore/CartF0.hxx | 4 +- src/emucore/CartF4.cxx | 6 +- src/emucore/CartF4.hxx | 4 +- src/emucore/CartF4SC.cxx | 6 +- src/emucore/CartF4SC.hxx | 4 +- src/emucore/CartF6.cxx | 6 +- src/emucore/CartF6.hxx | 4 +- src/emucore/CartF6SC.cxx | 6 +- src/emucore/CartF6SC.hxx | 4 +- src/emucore/CartF8.cxx | 6 +- src/emucore/CartF8.hxx | 4 +- src/emucore/CartF8SC.cxx | 6 +- src/emucore/CartF8SC.hxx | 4 +- src/emucore/CartFA.cxx | 6 +- src/emucore/CartFA.hxx | 4 +- src/emucore/CartFA2.cxx | 8 +- src/emucore/CartFA2.hxx | 6 +- src/emucore/CartFE.cxx | 6 +- src/emucore/CartFE.hxx | 4 +- src/emucore/CartMDM.cxx | 6 +- src/emucore/CartMDM.hxx | 6 +- src/emucore/CartMNetwork.cxx | 12 +-- src/emucore/CartMNetwork.hxx | 10 +- src/emucore/CartSB.cxx | 6 +- src/emucore/CartSB.hxx | 6 +- src/emucore/CartUA.cxx | 6 +- src/emucore/CartUA.hxx | 4 +- src/emucore/CartWD.cxx | 6 +- src/emucore/CartWD.hxx | 6 +- src/emucore/CartX07.cxx | 6 +- src/emucore/CartX07.hxx | 4 +- src/emucore/Console.cxx | 2 +- src/emucore/Serializer.cxx | 12 +-- src/emucore/Serializer.hxx | 12 +-- 109 files changed, 371 insertions(+), 371 deletions(-) diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 9ee8a7576..8739e2895 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -74,11 +74,11 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem) // Banksizes greater than 4096 indicate multi-bank ROMs, but we handle only // 4K pieces at a time // Banksizes less than 4K use the actual value - uInt32 banksize = 0; + size_t banksize = 0; myConsole.cartridge().getImage(banksize); BankInfo info; - info.size = std::min(banksize, 4096u); + info.size = std::min(banksize, 4_KB); for(uInt32 i = 0; i < myConsole.cartridge().bankCount(); ++i) myBankInfo.push_back(info); diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 304763304..77f24e070 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -271,7 +271,7 @@ class CartDebug : public DebuggerSystem uInt16 start; // start of address space uInt16 end; // end of address space uInt16 offset; // ORG value - uInt32 size; // size of a bank (in bytes) + size_t size; // size of a bank (in bytes) AddressList addressList; // addresses which PC has hit DirectiveList directiveList; // overrides for automatic code determination diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 81d0342ed..afeea3e93 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -43,7 +43,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, myOffset = info.offset; if (start & 0x1000) { info.start = myAppData.start = 0x0000; - info.end = myAppData.end = info.size - 1; + info.end = myAppData.end = static_cast(info.size - 1); // Keep previous offset; it may be different between banks if (info.offset == 0) info.offset = myOffset = (start - (start % info.size)); @@ -56,7 +56,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, // Resolve code is never used in ZP RAM mode resolve_code = false; } - myAppData.length = info.size; + myAppData.length = static_cast(info.size); myLabels.fill(0); myDirectives.fill(0); diff --git a/src/debugger/gui/Cart3EPlusWidget.cxx b/src/debugger/gui/Cart3EPlusWidget.cxx index fb1cfcc99..8d074bc59 100644 --- a/src/debugger/gui/Cart3EPlusWidget.cxx +++ b/src/debugger/gui/Cart3EPlusWidget.cxx @@ -27,7 +27,7 @@ Cartridge3EPlusWidget::Cartridge3EPlusWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt32 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "3EPlus cartridge - (64K ROM + RAM)\n" diff --git a/src/debugger/gui/Cart3EWidget.cxx b/src/debugger/gui/Cart3EWidget.cxx index 530dc673b..bf6fcacb4 100644 --- a/src/debugger/gui/Cart3EWidget.cxx +++ b/src/debugger/gui/Cart3EWidget.cxx @@ -25,10 +25,10 @@ Cartridge3EWidget::Cartridge3EWidget( int x, int y, int w, int h, Cartridge3E& cart) : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart), - myNumRomBanks(cart.mySize >> 11), + myNumRomBanks(uInt32(cart.mySize >> 11)), myNumRamBanks(32) { - uInt32 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "3E cartridge - (3F + RAM)\n" diff --git a/src/debugger/gui/Cart3FWidget.cxx b/src/debugger/gui/Cart3FWidget.cxx index c25f9c1a8..e4bbd1b96 100644 --- a/src/debugger/gui/Cart3FWidget.cxx +++ b/src/debugger/gui/Cart3FWidget.cxx @@ -26,7 +26,7 @@ Cartridge3FWidget::Cartridge3FWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt32 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "Tigervision 3F cartridge, 2-256 2K banks\n" diff --git a/src/debugger/gui/CartARWidget.cxx b/src/debugger/gui/CartARWidget.cxx index 6cabee843..22f67ee56 100644 --- a/src/debugger/gui/CartARWidget.cxx +++ b/src/debugger/gui/CartARWidget.cxx @@ -26,7 +26,7 @@ CartridgeARWidget::CartridgeARWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt16 size = myCart.mySize; + size_t size = myCart.mySize; string info = "Supercharger cartridge, four 2K slices (3 RAM, 1 ROM)\n" diff --git a/src/debugger/gui/CartCVPlusWidget.cxx b/src/debugger/gui/CartCVPlusWidget.cxx index da8fe28ea..cc5441192 100644 --- a/src/debugger/gui/CartCVPlusWidget.cxx +++ b/src/debugger/gui/CartCVPlusWidget.cxx @@ -28,7 +28,7 @@ CartridgeCVPlusWidget::CartridgeCVPlusWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt32 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "LS_Dracon CV+ cartridge, 1K RAM, 2-256 2K ROM\n" diff --git a/src/debugger/gui/CartDASHWidget.cxx b/src/debugger/gui/CartDASHWidget.cxx index 77b2b8c02..d122cb0a5 100644 --- a/src/debugger/gui/CartDASHWidget.cxx +++ b/src/debugger/gui/CartDASHWidget.cxx @@ -27,7 +27,7 @@ CartridgeDASHWidget::CartridgeDASHWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt32 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "DASH cartridge - (64K ROM + RAM)\n" diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx index d1bf010d1..6d32178bc 100644 --- a/src/debugger/gui/CartDPCPlusWidget.cxx +++ b/src/debugger/gui/CartDPCPlusWidget.cxx @@ -27,7 +27,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt16 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "Extended DPC cartridge, six 4K banks, 4K display bank, 1K frequency table, " diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx index ec78962fa..c5f294736 100644 --- a/src/debugger/gui/CartDPCWidget.cxx +++ b/src/debugger/gui/CartDPCWidget.cxx @@ -27,7 +27,7 @@ CartridgeDPCWidget::CartridgeDPCWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt16 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "DPC cartridge, two 4K banks + 2K display bank\n" diff --git a/src/debugger/gui/CartDebugWidget.cxx b/src/debugger/gui/CartDebugWidget.cxx index 397617a0b..ac7de2158 100644 --- a/src/debugger/gui/CartDebugWidget.cxx +++ b/src/debugger/gui/CartDebugWidget.cxx @@ -37,7 +37,7 @@ CartDebugWidget::CartDebugWidget(GuiObject* boss, const GUI::Font& lfont, myDesc(nullptr) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int CartDebugWidget::addBaseInformation(int bytes, const string& manufacturer, +int CartDebugWidget::addBaseInformation(size_t bytes, const string& manufacturer, const string& desc, const uInt16 maxlines) { const int lwidth = _font.getStringWidth("Manufacturer "), diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index ec802cbc0..0b2d1af44 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -41,7 +41,7 @@ class CartDebugWidget : public Widget, public CommandSender virtual ~CartDebugWidget() = default; public: - int addBaseInformation(int bytes, const string& manufacturer, + int addBaseInformation(size_t bytes, const string& manufacturer, const string& desc, const uInt16 maxlines = 10); // Inform the ROM Widget that the underlying cart has somehow changed diff --git a/src/debugger/gui/CartFA2Widget.cxx b/src/debugger/gui/CartFA2Widget.cxx index 7e505c3c2..e368007b1 100644 --- a/src/debugger/gui/CartFA2Widget.cxx +++ b/src/debugger/gui/CartFA2Widget.cxx @@ -28,7 +28,7 @@ CartridgeFA2Widget::CartridgeFA2Widget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt16 size = cart.mySize; + size_t size = cart.mySize; ostringstream info; info << "Modified FA RAM+, six or seven 4K banks\n" diff --git a/src/debugger/gui/CartMDMWidget.cxx b/src/debugger/gui/CartMDMWidget.cxx index bca23965a..1cf45666f 100644 --- a/src/debugger/gui/CartMDMWidget.cxx +++ b/src/debugger/gui/CartMDMWidget.cxx @@ -27,7 +27,7 @@ CartridgeMDMWidget::CartridgeMDMWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt32 size = myCart.mySize; + size_t size = myCart.mySize; ostringstream info; info << "Menu Driven Megacart, containing up to 128 4K banks\n" diff --git a/src/debugger/gui/CartSBWidget.cxx b/src/debugger/gui/CartSBWidget.cxx index 41e81c2a2..d62ac1b6c 100644 --- a/src/debugger/gui/CartSBWidget.cxx +++ b/src/debugger/gui/CartSBWidget.cxx @@ -26,7 +26,7 @@ CartridgeSBWidget::CartridgeSBWidget( : CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) { - uInt32 size = myCart.mySize; + size_t size = myCart.mySize; VariantList items; ostringstream info, bank; diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 2845645cb..319b9dcca 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -59,7 +59,7 @@ void Cartridge::setAbout(const string& about, const string& type, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge::saveROM(ofstream& out) const { - uInt32 size = 0; + size_t size = 0; const uInt8* image = getImage(size); if(image == nullptr || size == 0) @@ -119,7 +119,7 @@ void Cartridge::pokeRAM(uInt8& dest, uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge::createCodeAccessBase(uInt32 size) +void Cartridge::createCodeAccessBase(size_t size) { #ifdef DEBUGGER_SUPPORT myCodeAccessBase = make_unique(size); @@ -130,10 +130,10 @@ void Cartridge::createCodeAccessBase(uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const +void Cartridge::initializeRAM(uInt8* arr, size_t size, uInt8 val) const { if(randomInitialRAM()) - for(uInt32 i = 0; i < size; ++i) + for(size_t i = 0; i < size; ++i) arr[i] = mySystem->randGenerator().next(); else std::fill_n(arr, size, val); diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index 6da1e72c7..d3151977d 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -192,7 +192,7 @@ class Cartridge : public Device @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - virtual const uInt8* getImage(uInt32& size) const = 0; + virtual const uInt8* getImage(size_t& size) const = 0; /** Get a descriptor for the cart name. @@ -273,7 +273,7 @@ class Cartridge : public Device @param size The size of the code-access array to create */ - void createCodeAccessBase(uInt32 size); + void createCodeAccessBase(size_t size); /** Fill the given RAM array with (possibly random) data. @@ -282,7 +282,7 @@ class Cartridge : public Device @param size The size of the RAM array @param val If provided, the value to store in the RAM array */ - void initializeRAM(uInt8* arr, uInt32 size, uInt8 val = 0) const; + void initializeRAM(uInt8* arr, size_t size, uInt8 val = 0) const; /** Set the start bank to be used when the cart is reset. This method diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index 9676a244a..bdce3222c 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -19,13 +19,13 @@ #include "Cart0840.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge0840::Cartridge0840(const ByteBuffer& image, uInt32 size, +Cartridge0840::Cartridge0840(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -164,7 +164,7 @@ bool Cartridge0840::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge0840::getImage(uInt32& size) const +const uInt8* Cartridge0840::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/Cart0840.hxx b/src/emucore/Cart0840.hxx index 2fa2abec4..7da7c052c 100644 --- a/src/emucore/Cart0840.hxx +++ b/src/emucore/Cart0840.hxx @@ -45,7 +45,7 @@ class Cartridge0840 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge0840(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge0840(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge0840() = default; @@ -97,7 +97,7 @@ class Cartridge0840 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/Cart2K.cxx b/src/emucore/Cart2K.cxx index 35555edc6..a806f3b48 100644 --- a/src/emucore/Cart2K.cxx +++ b/src/emucore/Cart2K.cxx @@ -19,7 +19,7 @@ #include "Cart2K.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge2K::Cartridge2K(const ByteBuffer& image, uInt32 size, +Cartridge2K::Cartridge2K(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5) { @@ -78,7 +78,7 @@ bool Cartridge2K::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge2K::getImage(uInt32& size) const +const uInt8* Cartridge2K::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/Cart2K.hxx b/src/emucore/Cart2K.hxx index e603d83bc..fd636e0cf 100644 --- a/src/emucore/Cart2K.hxx +++ b/src/emucore/Cart2K.hxx @@ -48,7 +48,7 @@ class Cartridge2K : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge2K(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge2K(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge2K() = default; @@ -81,7 +81,7 @@ class Cartridge2K : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index a50b9772b..8e86d7491 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -20,7 +20,7 @@ #include "Cart3E.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge3E::Cartridge3E(const ByteBuffer& image, uInt32 size, +Cartridge3E::Cartridge3E(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -236,7 +236,7 @@ bool Cartridge3E::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge3E::getImage(uInt32& size) const +const uInt8* Cartridge3E::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index 04cdace86..5b755cc81 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -74,7 +74,7 @@ class Cartridge3E : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge3E(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge3E(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge3E() = default; @@ -126,7 +126,7 @@ class Cartridge3E : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -188,7 +188,7 @@ class Cartridge3E : public Cartridge std::array myRAM; // Size of the ROM image - uInt32 mySize; + size_t mySize; // Indicates which bank is currently active for the first segment uInt16 myCurrentBank; diff --git a/src/emucore/Cart3EPlus.cxx b/src/emucore/Cart3EPlus.cxx index 4b607f0d6..aa9755613 100644 --- a/src/emucore/Cart3EPlus.cxx +++ b/src/emucore/Cart3EPlus.cxx @@ -20,7 +20,7 @@ #include "Cart3EPlus.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge3EPlus::Cartridge3EPlus(const ByteBuffer& image, uInt32 size, +Cartridge3EPlus::Cartridge3EPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size) @@ -87,7 +87,7 @@ uInt16 Cartridge3EPlus::getBank(uInt16 address) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 Cartridge3EPlus::bankCount() const { - return mySize >> 10; // 1K slices + return uInt16(mySize >> 10); // 1K slices } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -307,7 +307,7 @@ bool Cartridge3EPlus::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge3EPlus::getImage(uInt32& size) const +const uInt8* Cartridge3EPlus::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/Cart3EPlus.hxx b/src/emucore/Cart3EPlus.hxx index 305b3377f..5cecbf5c4 100644 --- a/src/emucore/Cart3EPlus.hxx +++ b/src/emucore/Cart3EPlus.hxx @@ -54,7 +54,7 @@ class Cartridge3EPlus: public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge3EPlus(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge3EPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge3EPlus() = default; @@ -97,7 +97,7 @@ class Cartridge3EPlus: public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -191,7 +191,7 @@ class Cartridge3EPlus: public Cartridge static constexpr uInt16 RAM_WRITE_OFFSET = 0x200; ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge - uInt32 mySize; // Size of the ROM image + size_t mySize; // Size of the ROM image std::array myRAM; private: diff --git a/src/emucore/Cart3F.cxx b/src/emucore/Cart3F.cxx index f68875e87..85a36ee13 100644 --- a/src/emucore/Cart3F.cxx +++ b/src/emucore/Cart3F.cxx @@ -20,7 +20,7 @@ #include "Cart3F.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge3F::Cartridge3F(const ByteBuffer& image, uInt32 size, +Cartridge3F::Cartridge3F(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -128,7 +128,7 @@ bool Cartridge3F::bank(uInt16 bank) uInt16 Cartridge3F::getBank(uInt16 address) const { if (address & 0x800) - return (mySize >> 11) - 1; // 2K slices, fixed bank + return uInt16((mySize >> 11) - 1); // 2K slices, fixed bank else return myCurrentBank; } @@ -136,7 +136,7 @@ uInt16 Cartridge3F::getBank(uInt16 address) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 Cartridge3F::bankCount() const { - return mySize >> 11; // 2K slices + return uInt16(mySize >> 11); // 2K slices } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -153,7 +153,7 @@ bool Cartridge3F::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge3F::getImage(uInt32& size) const +const uInt8* Cartridge3F::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx index 1b2017363..d26b396ea 100644 --- a/src/emucore/Cart3F.hxx +++ b/src/emucore/Cart3F.hxx @@ -51,7 +51,7 @@ class Cartridge3F : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge3F(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge3F(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge3F() = default; @@ -103,7 +103,7 @@ class Cartridge3F : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -162,7 +162,7 @@ class Cartridge3F : public Cartridge ByteBuffer myImage; // Size of the ROM image - uInt32 mySize; + size_t mySize; // Indicates which bank is currently active for the first segment uInt16 myCurrentBank; diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 02de19e30..2e550e108 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -21,7 +21,7 @@ #include "Cart4A50.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge4A50::Cartridge4A50(const ByteBuffer& image, uInt32 size, +Cartridge4A50::Cartridge4A50(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -356,7 +356,7 @@ bool Cartridge4A50::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge4A50::getImage(uInt32& size) const +const uInt8* Cartridge4A50::getImage(size_t& size) const { size = mySize; return myImage.data(); diff --git a/src/emucore/Cart4A50.hxx b/src/emucore/Cart4A50.hxx index d36f50603..90239aaee 100644 --- a/src/emucore/Cart4A50.hxx +++ b/src/emucore/Cart4A50.hxx @@ -65,7 +65,7 @@ class Cartridge4A50 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge4A50(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge4A50(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge4A50() = default; @@ -98,7 +98,7 @@ class Cartridge4A50 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -225,7 +225,7 @@ class Cartridge4A50 : public Cartridge std::array myRAM; // (Actual) Size of the ROM image - uInt32 mySize; + size_t mySize; // Indicates the slice mapped into each of the three segments uInt16 mySliceLow; /* index pointer for $1000-$17ff slice */ diff --git a/src/emucore/Cart4K.cxx b/src/emucore/Cart4K.cxx index 55440af1a..89196c993 100644 --- a/src/emucore/Cart4K.cxx +++ b/src/emucore/Cart4K.cxx @@ -19,12 +19,12 @@ #include "Cart4K.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge4K::Cartridge4K(const ByteBuffer& image, uInt32 size, +Cartridge4K::Cartridge4K(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5) { // 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()); createCodeAccessBase(myImage.size()); } @@ -59,7 +59,7 @@ bool Cartridge4K::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge4K::getImage(uInt32& size) const +const uInt8* Cartridge4K::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/Cart4K.hxx b/src/emucore/Cart4K.hxx index fb16ce2fa..2cd5f6adb 100644 --- a/src/emucore/Cart4K.hxx +++ b/src/emucore/Cart4K.hxx @@ -45,7 +45,7 @@ class Cartridge4K : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge4K(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge4K(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge4K() = default; @@ -78,7 +78,7 @@ class Cartridge4K : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/Cart4KSC.cxx b/src/emucore/Cart4KSC.cxx index cc5389748..6f1550c7e 100644 --- a/src/emucore/Cart4KSC.cxx +++ b/src/emucore/Cart4KSC.cxx @@ -19,12 +19,12 @@ #include "Cart4KSC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cartridge4KSC::Cartridge4KSC(const ByteBuffer& image, uInt32 size, +Cartridge4KSC::Cartridge4KSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5) { // 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()); createCodeAccessBase(myImage.size()); } @@ -118,7 +118,7 @@ bool Cartridge4KSC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* Cartridge4KSC::getImage(uInt32& size) const +const uInt8* Cartridge4KSC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/Cart4KSC.hxx b/src/emucore/Cart4KSC.hxx index 3b005c743..fb9b81786 100644 --- a/src/emucore/Cart4KSC.hxx +++ b/src/emucore/Cart4KSC.hxx @@ -44,7 +44,7 @@ class Cartridge4KSC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge4KSC(const ByteBuffer& image, uInt32 size, const string& md5, + Cartridge4KSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~Cartridge4KSC() = default; @@ -77,7 +77,7 @@ class Cartridge4KSC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 75a667d0e..a8f84fa1e 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -20,10 +20,10 @@ #include "CartAR.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeAR::CartridgeAR(const ByteBuffer& image, uInt32 size, +CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(std::max(size, 8448u)), + mySize(std::max(size, 8448)), myWriteEnabled(false), myPower(true), myDataHoldRegister(0), @@ -33,7 +33,7 @@ CartridgeAR::CartridgeAR(const ByteBuffer& image, uInt32 size, { // Create a load image buffer and copy the given image myLoadImages = make_unique(mySize); - myNumberOfLoadImages = mySize / 8448; + myNumberOfLoadImages = uInt8(mySize / 8448); std::copy_n(image.get(), size, myLoadImages.get()); // Add header if image doesn't include it @@ -422,7 +422,7 @@ bool CartridgeAR::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeAR::getImage(uInt32& size) const +const uInt8* CartridgeAR::getImage(size_t& size) const { size = mySize; return myLoadImages.get(); diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index cb0debd89..2529c3e4a 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -52,7 +52,7 @@ class CartridgeAR : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeAR(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeAR(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeAR() = default; @@ -104,7 +104,7 @@ class CartridgeAR : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -196,7 +196,7 @@ class CartridgeAR : public Cartridge std::array myHeader; // Size of the ROM image - uInt32 mySize; + size_t mySize; // All of the 8448 byte loads associated with the game ByteBuffer myLoadImages; diff --git a/src/emucore/CartBF.cxx b/src/emucore/CartBF.cxx index d937a9184..07334fe52 100644 --- a/src/emucore/CartBF.cxx +++ b/src/emucore/CartBF.cxx @@ -19,13 +19,13 @@ #include "CartBF.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeBF::CartridgeBF(const ByteBuffer& image, uInt32 size, +CartridgeBF::CartridgeBF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -124,7 +124,7 @@ bool CartridgeBF::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeBF::getImage(uInt32& size) const +const uInt8* CartridgeBF::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartBF.hxx b/src/emucore/CartBF.hxx index 1c4c8c91b..a5ede3780 100644 --- a/src/emucore/CartBF.hxx +++ b/src/emucore/CartBF.hxx @@ -46,7 +46,7 @@ class CartridgeBF : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeBF(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeBF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeBF() = default; @@ -98,7 +98,7 @@ class CartridgeBF : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index 509293b25..92332d436 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -19,13 +19,13 @@ #include "CartBFSC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeBFSC::CartridgeBFSC(const ByteBuffer& image, uInt32 size, +CartridgeBFSC::CartridgeBFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -174,7 +174,7 @@ bool CartridgeBFSC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeBFSC::getImage(uInt32& size) const +const uInt8* CartridgeBFSC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartBFSC.hxx b/src/emucore/CartBFSC.hxx index 69dea9880..6af2424ca 100644 --- a/src/emucore/CartBFSC.hxx +++ b/src/emucore/CartBFSC.hxx @@ -46,7 +46,7 @@ class CartridgeBFSC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeBFSC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeBFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeBFSC() = default; @@ -98,7 +98,7 @@ class CartridgeBFSC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index 1df765931..f916f5cef 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -41,7 +41,7 @@ #define DIGITAL_AUDIO_ON ((myMode & 0xF0) == 0) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeBUS::CartridgeBUS(const ByteBuffer& image, uInt32 size, +CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myAudioCycles(0), @@ -49,7 +49,7 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, uInt32 size, myFractionalClocks(0.0) { // 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()); // Even though the ROM is 32K, only 28K is accessible to the 6507 createCodeAccessBase(28_KB); @@ -69,7 +69,7 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, uInt32 size, myThumbEmulator = make_unique( reinterpret_cast(myImage.data()), reinterpret_cast(myBUSRAM.data()), - myImage.size(), + static_cast(myImage.size()), devSettings ? settings.getBool("dev.thumb.trapfatal") : false, Thumbulator::ConfigureFor::BUS, this ); @@ -477,7 +477,7 @@ bool CartridgeBUS::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeBUS::getImage(uInt32& size) const +const uInt8* CartridgeBUS::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartBUS.hxx b/src/emucore/CartBUS.hxx index 760e8f1f7..25a63194e 100644 --- a/src/emucore/CartBUS.hxx +++ b/src/emucore/CartBUS.hxx @@ -54,7 +54,7 @@ class CartridgeBUS : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeBUS(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeBUS(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeBUS() = default; @@ -115,7 +115,7 @@ class CartridgeBUS : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 977ea8fce..d1a79a16d 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -57,7 +57,7 @@ namespace { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeCDF::CartridgeCDF(const ByteBuffer& image, uInt32 size, +CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myAudioCycles(0), @@ -65,7 +65,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, uInt32 size, myFractionalClocks(0.0) { // 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()); // even though the ROM is 32K, only 28K is accessible to the 6507 createCodeAccessBase(4096 * 7); @@ -87,7 +87,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, uInt32 size, myThumbEmulator = make_unique( reinterpret_cast(myImage.data()), reinterpret_cast(myCDFRAM.data()), - myImage.size(), + static_cast(myImage.size()), devSettings ? settings.getBool("dev.thumb.trapfatal") : false, thumulatorConfiguration(myCDFSubtype), this); setInitialState(); @@ -449,7 +449,7 @@ bool CartridgeCDF::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeCDF::getImage(uInt32& size) const +const uInt8* CartridgeCDF::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartCDF.hxx b/src/emucore/CartCDF.hxx index 8ef3b88ab..81c41c7f8 100644 --- a/src/emucore/CartCDF.hxx +++ b/src/emucore/CartCDF.hxx @@ -62,7 +62,7 @@ class CartridgeCDF : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeCDF(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeCDF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeCDF() = default; @@ -123,7 +123,7 @@ class CartridgeCDF : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 4690b4541..37e889dd0 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -21,14 +21,14 @@ #include "CartCM.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeCM::CartridgeCM(const ByteBuffer& image, uInt32 size, +CartridgeCM::CartridgeCM(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySWCHA(0xFF), // portA is all 1's myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -180,7 +180,7 @@ bool CartridgeCM::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeCM::getImage(uInt32& size) const +const uInt8* CartridgeCM::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index f1225d410..8b55be14a 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -120,7 +120,7 @@ class CartridgeCM : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeCM(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeCM(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeCM() = default; @@ -172,7 +172,7 @@ class CartridgeCM : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 48484dc82..9d73ad522 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -22,7 +22,7 @@ #include "CartCTY.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeCTY::CartridgeCTY(const ByteBuffer& image, uInt32 size, +CartridgeCTY::CartridgeCTY(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myOperationType(0), @@ -35,7 +35,7 @@ CartridgeCTY::CartridgeCTY(const ByteBuffer& image, uInt32 size, myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); // Default to no tune data in case user is utilizing an old ROM @@ -285,7 +285,7 @@ bool CartridgeCTY::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeCTY::getImage(uInt32& size) const +const uInt8* CartridgeCTY::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartCTY.hxx b/src/emucore/CartCTY.hxx index 512787e09..4f09b4d79 100644 --- a/src/emucore/CartCTY.hxx +++ b/src/emucore/CartCTY.hxx @@ -118,7 +118,7 @@ class CartridgeCTY : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the settings object */ - CartridgeCTY(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeCTY(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeCTY() = default; @@ -170,7 +170,7 @@ class CartridgeCTY : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 6f8821616..c1dbd81b9 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -19,7 +19,7 @@ #include "CartCV.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeCV::CartridgeCV(const ByteBuffer& image, uInt32 size, +CartridgeCV::CartridgeCV(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size) @@ -128,7 +128,7 @@ bool CartridgeCV::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeCV::getImage(uInt32& size) const +const uInt8* CartridgeCV::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index 7bca6e900..4b26d87de 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -48,7 +48,7 @@ class CartridgeCV : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeCV(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeCV(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeCV() = default; @@ -81,7 +81,7 @@ class CartridgeCV : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -140,7 +140,7 @@ class CartridgeCV : public Cartridge std::array myImage; // Initial size of the cart data - uInt32 mySize; + size_t mySize; // The 1024 bytes of RAM std::array myRAM; diff --git a/src/emucore/CartCVPlus.cxx b/src/emucore/CartCVPlus.cxx index 67ad2da2b..1f68e85f1 100644 --- a/src/emucore/CartCVPlus.cxx +++ b/src/emucore/CartCVPlus.cxx @@ -20,7 +20,7 @@ #include "CartCVPlus.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeCVPlus::CartridgeCVPlus(const ByteBuffer& image, uInt32 size, +CartridgeCVPlus::CartridgeCVPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -152,7 +152,7 @@ uInt16 CartridgeCVPlus::getBank(uInt16) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 CartridgeCVPlus::bankCount() const { - return mySize >> 11; + return uInt16(mySize >> 11); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -175,7 +175,7 @@ bool CartridgeCVPlus::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeCVPlus::getImage(uInt32& size) const +const uInt8* CartridgeCVPlus::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/CartCVPlus.hxx b/src/emucore/CartCVPlus.hxx index 701a781f2..101018b51 100644 --- a/src/emucore/CartCVPlus.hxx +++ b/src/emucore/CartCVPlus.hxx @@ -57,7 +57,7 @@ class CartridgeCVPlus : public Cartridge @param size The size of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeCVPlus(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeCVPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeCVPlus() = default; @@ -109,7 +109,7 @@ class CartridgeCVPlus : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -171,7 +171,7 @@ class CartridgeCVPlus : public Cartridge std::array myRAM; // Size of the ROM image - uInt32 mySize; + size_t mySize; // Indicates which bank is currently active for the first segment uInt16 myCurrentBank; diff --git a/src/emucore/CartDASH.cxx b/src/emucore/CartDASH.cxx index 81ed2ec57..160625a9f 100644 --- a/src/emucore/CartDASH.cxx +++ b/src/emucore/CartDASH.cxx @@ -20,7 +20,7 @@ #include "CartDASH.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeDASH::CartridgeDASH(const ByteBuffer& image, uInt32 size, +CartridgeDASH::CartridgeDASH(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size) @@ -300,7 +300,7 @@ bool CartridgeDASH::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeDASH::getImage(uInt32& size) const +const uInt8* CartridgeDASH::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/CartDASH.hxx b/src/emucore/CartDASH.hxx index 261a347cc..8f2568e97 100644 --- a/src/emucore/CartDASH.hxx +++ b/src/emucore/CartDASH.hxx @@ -136,7 +136,7 @@ class CartridgeDASH: public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeDASH(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeDASH(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeDASH() = default; @@ -167,7 +167,7 @@ class CartridgeDASH: public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -262,7 +262,7 @@ class CartridgeDASH: public Cartridge static constexpr uInt16 RAM_WRITE_OFFSET = 0x800; ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge - uInt32 mySize; // Size of the ROM image + size_t mySize; // Size of the ROM image std::array myRAM; private: diff --git a/src/emucore/CartDF.cxx b/src/emucore/CartDF.cxx index b8ec1f727..283ba62eb 100644 --- a/src/emucore/CartDF.cxx +++ b/src/emucore/CartDF.cxx @@ -19,13 +19,13 @@ #include "CartDF.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeDF::CartridgeDF(const ByteBuffer& image, uInt32 size, +CartridgeDF::CartridgeDF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -120,7 +120,7 @@ bool CartridgeDF::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeDF::getImage(uInt32& size) const +const uInt8* CartridgeDF::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartDF.hxx b/src/emucore/CartDF.hxx index 2d721abc1..55226a2b5 100644 --- a/src/emucore/CartDF.hxx +++ b/src/emucore/CartDF.hxx @@ -46,7 +46,7 @@ class CartridgeDF : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeDF(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeDF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeDF() = default; @@ -98,7 +98,7 @@ class CartridgeDF : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index fa8c980b2..18df1cbd0 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -19,13 +19,13 @@ #include "CartDFSC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeDFSC::CartridgeDFSC(const ByteBuffer& image, uInt32 size, +CartridgeDFSC::CartridgeDFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -174,7 +174,7 @@ bool CartridgeDFSC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeDFSC::getImage(uInt32& size) const +const uInt8* CartridgeDFSC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartDFSC.hxx b/src/emucore/CartDFSC.hxx index cc2776b25..45635db46 100644 --- a/src/emucore/CartDFSC.hxx +++ b/src/emucore/CartDFSC.hxx @@ -46,7 +46,7 @@ class CartridgeDFSC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeDFSC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeDFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeDFSC() = default; @@ -98,7 +98,7 @@ class CartridgeDFSC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index 1f52d71bf..f129c7a23 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -20,7 +20,7 @@ #include "CartDPC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeDPC::CartridgeDPC(const ByteBuffer& image, uInt32 size, +CartridgeDPC::CartridgeDPC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -29,7 +29,7 @@ CartridgeDPC::CartridgeDPC(const ByteBuffer& image, uInt32 size, myBankOffset(0) { // Make a copy of the entire image - std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); + std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); createCodeAccessBase(8192); // Pointer to the program ROM (8K @ 0 byte offset) @@ -431,7 +431,7 @@ bool CartridgeDPC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeDPC::getImage(uInt32& size) const +const uInt8* CartridgeDPC::getImage(size_t& size) const { size = mySize; return myImage.data(); diff --git a/src/emucore/CartDPC.hxx b/src/emucore/CartDPC.hxx index 444dbbeda..8a4018c35 100644 --- a/src/emucore/CartDPC.hxx +++ b/src/emucore/CartDPC.hxx @@ -50,7 +50,7 @@ class CartridgeDPC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeDPC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeDPC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeDPC() = default; @@ -102,7 +102,7 @@ class CartridgeDPC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -175,7 +175,7 @@ class CartridgeDPC : public Cartridge std::array myImage; // (Actual) Size of the ROM image - uInt32 mySize; + size_t mySize; // Pointer to the 8K program ROM image of the cartridge uInt8* myProgramImage; diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 14ad928eb..75aa3dd12 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -26,10 +26,10 @@ #include "exception/FatalEmulationError.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, uInt32 size, +CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(std::min(size, myImage.size())), + mySize(std::min(size, myImage.size())), myFastFetch(false), myLDAimmediate(false), myParameterPointer(0), @@ -44,7 +44,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, uInt32 size, if(mySize < myImage.size()) myImage.fill(0); std::copy_n(image.get(), size, myImage.begin() + (myImage.size() - mySize)); - createCodeAccessBase(4096 * 6); + createCodeAccessBase(4_KB * 6); // Pointer to the program ROM (24K @ 3072 byte offset; ignore first 3K) myProgramImage = myImage.data() + 0xC00; @@ -60,7 +60,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, uInt32 size, myThumbEmulator = make_unique (reinterpret_cast(myImage.data()), reinterpret_cast(myDPCRAM.data()), - myImage.size(), + static_cast(myImage.size()), devSettings ? settings.getBool("dev.thumb.trapfatal") : false, Thumbulator::ConfigureFor::DPCplus, this); @@ -629,7 +629,7 @@ bool CartridgeDPCPlus::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeDPCPlus::getImage(uInt32& size) const +const uInt8* CartridgeDPCPlus::getImage(size_t& size) const { size = mySize; return myImage.data() + (myImage.size() - mySize); diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index c91a58f2a..be833f922 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -56,7 +56,7 @@ class CartridgeDPCPlus : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeDPCPlus(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeDPCPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeDPCPlus() = default; @@ -117,7 +117,7 @@ class CartridgeDPCPlus : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -201,7 +201,7 @@ class CartridgeDPCPlus : public Cartridge private: // The ROM image and size std::array myImage; - uInt32 mySize; + size_t mySize; // Pointer to the 24K program ROM image of the cartridge uInt8* myProgramImage; diff --git a/src/emucore/CartDetector.cxx b/src/emucore/CartDetector.cxx index 81ca1a1c9..b6c52a339 100644 --- a/src/emucore/CartDetector.cxx +++ b/src/emucore/CartDetector.cxx @@ -66,7 +66,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr CartDetector::create(const FilesystemNode& file, - const ByteBuffer& image, uInt32 size, string& md5, + const ByteBuffer& image, size_t size, string& md5, const string& propertiesType, Settings& settings) { unique_ptr cartridge; @@ -104,7 +104,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, { case Bankswitch::Type::_2IN1: // Make sure we have a valid sized image - if(size == 2*2048 || size == 2*4096 || size == 2*8192 || size == 2*16384) + if(size == 2*2_KB || size == 2*4_KB || size == 2*8_KB || size == 2*16_KB) { cartridge = createFromMultiCart(image, size, 2, md5, detectedType, id, settings); @@ -117,7 +117,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, case Bankswitch::Type::_4IN1: // Make sure we have a valid sized image - if(size == 4*2048 || size == 4*4096 || size == 4*8192) + if(size == 4*2_KB || size == 4*4_KB || size == 4*8_KB) { cartridge = createFromMultiCart(image, size, 4, md5, detectedType, id, settings); @@ -130,7 +130,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, case Bankswitch::Type::_8IN1: // Make sure we have a valid sized image - if(size == 8*2048 || size == 8*4096 || size == 8*8192) + if(size == 8*2_KB || size == 8*4_KB || size == 8*8_KB) { cartridge = createFromMultiCart(image, size, 8, md5, detectedType, id, settings); @@ -143,7 +143,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, case Bankswitch::Type::_16IN1: // Make sure we have a valid sized image - if(size == 16*2048 || size == 16*4096 || size == 16*8192) + if(size == 16*2_KB || size == 16*4_KB || size == 16*8_KB) { cartridge = createFromMultiCart(image, size, 16, md5, detectedType, id, settings); @@ -156,7 +156,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, case Bankswitch::Type::_32IN1: // Make sure we have a valid sized image - if(size == 32*2048 || size == 32*4096) + if(size == 32*2_KB || size == 32*4_KB) { cartridge = createFromMultiCart(image, size, 32, md5, detectedType, id, settings); @@ -169,7 +169,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, case Bankswitch::Type::_64IN1: // Make sure we have a valid sized image - if(size == 64*2048 || size == 64*4096) + if(size == 64*2_KB || size == 64*4_KB) { cartridge = createFromMultiCart(image, size, 64, md5, detectedType, id, settings); @@ -182,7 +182,7 @@ unique_ptr CartDetector::create(const FilesystemNode& file, case Bankswitch::Type::_128IN1: // Make sure we have a valid sized image - if(size == 128*2048 || size == 128*4096) + if(size == 128*2_KB || size == 128*4_KB) { cartridge = createFromMultiCart(image, size, 128, md5, detectedType, id, settings); @@ -198,10 +198,10 @@ unique_ptr CartDetector::create(const FilesystemNode& file, break; } - if(size < 1024) + if(size < 1_KB) buf << " (" << size << "B) "; else - buf << " (" << (size/1024) << "K) "; + buf << " (" << (size/1_KB) << "K) "; cartridge->setAbout(buf.str(), Bankswitch::typeToName(type), id); @@ -210,17 +210,17 @@ unique_ptr CartDetector::create(const FilesystemNode& file, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr -CartDetector::createFromMultiCart(const ByteBuffer& image, uInt32& size, +CartDetector::createFromMultiCart(const ByteBuffer& image, size_t& size, uInt32 numroms, string& md5, Bankswitch::Type type, string& id, Settings& settings) { // Get a piece of the larger image uInt32 i = settings.getInt("romloadcount"); size /= numroms; ByteBuffer slice = make_unique(size); - memcpy(slice.get(), image.get()+i*size, size); + std::copy_n(image.get()+i*size, size, slice.get()); // We need a new md5 and name - md5 = MD5::hash(slice, size); + md5 = MD5::hash(slice, uInt32(size)); // FIXME ostringstream buf; buf << " [G" << (i+1) << "]"; id = buf.str(); @@ -228,9 +228,9 @@ CartDetector::createFromMultiCart(const ByteBuffer& image, uInt32& size, // Move to the next game the next time this ROM is loaded settings.setValue("romloadcount", (i+1)%numroms); - if(size <= 2048) type = Bankswitch::Type::_2K; - else if(size == 4096) type = Bankswitch::Type::_4K; - else if(size == 8192) type = Bankswitch::Type::_F8; + if(size <= 2_KB) type = Bankswitch::Type::_2K; + else if(size == 4_KB) type = Bankswitch::Type::_4K; + else if(size == 8_KB) type = Bankswitch::Type::_F8; else /* default */ type = Bankswitch::Type::_4K; return createFromImage(slice, size, type, md5, settings); @@ -238,7 +238,7 @@ CartDetector::createFromMultiCart(const ByteBuffer& image, uInt32& size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr -CartDetector::createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type, +CartDetector::createFromImage(const ByteBuffer& image, size_t size, Bankswitch::Type type, const string& md5, Settings& settings) { // We should know the cart's type by now so let's create it @@ -336,7 +336,7 @@ CartDetector::createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch:: } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 size) +Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t size) { // Guess type based on size Bankswitch::Type type = Bankswitch::Type::_AUTO; @@ -349,16 +349,16 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si { type = Bankswitch::Type::_AR; } - else if(size < 2048) // Sub2K images + else if(size < 2_KB) // Sub2K images { type = Bankswitch::Type::_2K; } - else if((size == 2048) || - (size == 4096 && memcmp(image.get(), image.get() + 2048, 2048) == 0)) + else if((size == 2_KB) || + (size == 4_KB && std::memcmp(image.get(), image.get() + 2_KB, 2_KB) == 0)) { type = isProbablyCV(image, size) ? Bankswitch::Type::_CV : Bankswitch::Type::_2K; } - else if(size == 4096) + else if(size == 4_KB) { if(isProbablyCV(image, size)) type = Bankswitch::Type::_CV; @@ -367,7 +367,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si else type = Bankswitch::Type::_4K; } - else if(size == 8*1024) // 8K + else if(size == 8_KB) { // First check for *potential* F8 uInt8 signature[2][3] = { @@ -379,7 +379,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si if(isProbablySC(image, size)) type = Bankswitch::Type::_F8SC; - else if(memcmp(image.get(), image.get() + 4096, 4096) == 0) + else if(std::memcmp(image.get(), image.get() + 4_KB, 4_KB) == 0) type = Bankswitch::Type::_4K; else if(isProbablyE0(image, size)) type = Bankswitch::Type::_E0; @@ -398,7 +398,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si else type = Bankswitch::Type::_F8; } - else if(size == 8*1024 + 3) // 8195 bytes (Experimental) + else if(size == 8_KB + 3) // 8195 bytes (Experimental) { type = Bankswitch::Type::_WD; } @@ -406,11 +406,11 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si { type = Bankswitch::Type::_DPC; } - else if(size == 12*1024) // 12K + else if(size == 12_KB) { type = Bankswitch::Type::_FA; } - else if(size == 16*1024) // 16K + else if(size == 16_KB) { if(isProbablySC(image, size)) type = Bankswitch::Type::_F6SC; @@ -425,18 +425,18 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si else type = Bankswitch::Type::_F6; } - else if(size == 24*1024 || size == 28*1024) // 24K & 28K + else if(size == 24_KB || size == 28_KB) { type = Bankswitch::Type::_FA2; } - else if(size == 29*1024) // 29K + else if(size == 29_KB) { if(isProbablyARM(image, size)) type = Bankswitch::Type::_FA2; else /*if(isProbablyDPCplus(image, size))*/ type = Bankswitch::Type::_DPCP; } - else if(size == 32*1024) // 32K + else if(size == 32_KB) { if (isProbablyCTY(image, size)) type = Bankswitch::Type::_CTY; @@ -457,14 +457,14 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si else type = Bankswitch::Type::_F4; } - else if(size == 60*1024) // 60K + else if(size == 60_KB) { if(isProbablyCTY(image, size)) type = Bankswitch::Type::_CTY; else type = Bankswitch::Type::_F4; } - else if(size == 64*1024) // 64K + else if(size == 64_KB) { if(isProbably3E(image, size)) type = Bankswitch::Type::_3E; @@ -479,7 +479,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si else type = Bankswitch::Type::_F0; } - else if(size == 128*1024) // 128K + else if(size == 128_KB) { if(isProbably3E(image, size)) type = Bankswitch::Type::_3E; @@ -492,7 +492,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si else if(isProbablySB(image, size)) type = Bankswitch::Type::_SB; } - else if(size == 256*1024) // 256K + else if(size == 256_KB) { if(isProbably3E(image, size)) type = Bankswitch::Type::_3E; @@ -525,7 +525,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 si } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::searchForBytes(const uInt8* image, uInt32 imagesize, +bool CartDetector::searchForBytes(const uInt8* image, size_t imagesize, const uInt8* signature, uInt32 sigsize, uInt32 minhits) { @@ -553,24 +553,24 @@ bool CartDetector::searchForBytes(const uInt8* image, uInt32 imagesize, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablySC(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablySC(const ByteBuffer& image, size_t size) { // We assume a Superchip cart repeats the first 128 bytes for the second // 128 bytes in the RAM area, which is the first 256 bytes of each 4K bank const uInt8* ptr = image.get(); while(size) { - if(memcmp(ptr, ptr + 128, 128) != 0) + if(std::memcmp(ptr, ptr + 128, 128) != 0) return false; - ptr += 4096; - size -= 4096; + ptr += 4_KB; + size -= 4_KB; } return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyARM(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyARM(const ByteBuffer& image, size_t size) { // ARM code contains the following 'loader' patterns in the first 1K // Thanks to Thomas Jentzsch of AtariAge for this advice @@ -578,14 +578,14 @@ bool CartDetector::isProbablyARM(const ByteBuffer& image, uInt32 size) { 0xA0, 0xC1, 0x1F, 0xE0 }, { 0x00, 0x80, 0x02, 0xE0 } }; - if(searchForBytes(image.get(), std::min(size, 1024u), signature[0], 4, 1)) + if(searchForBytes(image.get(), std::min(size, 1_KB), signature[0], 4, 1)) return true; else - return searchForBytes(image.get(), std::min(size, 1024u), signature[1], 4, 1); + return searchForBytes(image.get(), std::min(size, 1_KB), signature[1], 4, 1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbably0840(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbably0840(const ByteBuffer& image, size_t size) { // 0840 cart bankswitching is triggered by accessing addresses 0x0800 // or 0x0840 at least twice @@ -610,7 +610,7 @@ bool CartDetector::isProbably0840(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbably3E(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbably3E(const ByteBuffer& image, size_t size) { // 3E cart bankswitching is triggered by storing the bank number // in address 3E using 'STA $3E', commonly followed by an @@ -620,7 +620,7 @@ bool CartDetector::isProbably3E(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbably3EPlus(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbably3EPlus(const ByteBuffer& image, size_t size) { // 3E+ cart is identified key 'TJ3E' in the ROM uInt8 tj3e[] = { 'T', 'J', '3', 'E' }; @@ -628,7 +628,7 @@ bool CartDetector::isProbably3EPlus(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbably3F(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbably3F(const ByteBuffer& image, size_t size) { // 3F cart bankswitching is triggered by storing the bank number // in address 3F using 'STA $3F' @@ -639,7 +639,7 @@ bool CartDetector::isProbably3F(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbably4A50(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbably4A50(const ByteBuffer& image, size_t size) { // 4A50 carts store address $4A50 at the NMI vector, which // in this scheme is always in the last page of ROM at @@ -657,7 +657,7 @@ bool CartDetector::isProbably4A50(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbably4KSC(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbably4KSC(const ByteBuffer& image, size_t size) { // We check if the first 256 bytes are identical *and* if there's // an "SC" signature for one of our larger SC types at 1FFA. @@ -674,7 +674,7 @@ bool CartDetector::isProbably4KSC(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyBF(const ByteBuffer& image, uInt32 size, +bool CartDetector::isProbablyBF(const ByteBuffer& image, size_t size, Bankswitch::Type& type) { // BF carts store strings 'BFBF' and 'BFSC' starting at address $FFF8 @@ -696,7 +696,7 @@ bool CartDetector::isProbablyBF(const ByteBuffer& image, uInt32 size, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyBUS(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyBUS(const ByteBuffer& image, size_t size) { // BUS ARM code has 2 occurrences of the string BUS // Note: all Harmony/Melody custom drivers also contain the value @@ -706,7 +706,7 @@ bool CartDetector::isProbablyBUS(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyCDF(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyCDF(const ByteBuffer& image, size_t size) { // CDF ARM code has 3 occurrences of the string CDF // Note: all Harmony/Melody custom drivers also contain the value @@ -716,14 +716,14 @@ bool CartDetector::isProbablyCDF(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyCTY(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyCTY(const ByteBuffer& image, size_t size) { uInt8 lenin[] = { 'L', 'E', 'N', 'I', 'N' }; return searchForBytes(image.get(), size, lenin, 5, 1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyCV(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyCV(const ByteBuffer& image, size_t size) { // CV RAM access occurs at addresses $f3ff and $f400 // These signatures are attributed to the MESS project @@ -738,7 +738,7 @@ bool CartDetector::isProbablyCV(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyCVPlus(const ByteBuffer& image, uInt32) +bool CartDetector::isProbablyCVPlus(const ByteBuffer& image, size_t) { // CV+ cart is identified key 'commavidplus' @ $04 in the ROM // We inspect only this area to speed up the search @@ -748,7 +748,7 @@ bool CartDetector::isProbablyCVPlus(const ByteBuffer& image, uInt32) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyDASH(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyDASH(const ByteBuffer& image, size_t size) { // DASH cart is identified key 'TJAD' in the ROM uInt8 tjad[] = { 'T', 'J', 'A', 'D' }; @@ -756,7 +756,7 @@ bool CartDetector::isProbablyDASH(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyDF(const ByteBuffer& image, uInt32 size, +bool CartDetector::isProbablyDF(const ByteBuffer& image, size_t size, Bankswitch::Type& type) { @@ -779,7 +779,7 @@ bool CartDetector::isProbablyDF(const ByteBuffer& image, uInt32 size, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyDPCplus(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyDPCplus(const ByteBuffer& image, size_t size) { // DPC+ ARM code has 2 occurrences of the string DPC+ // Note: all Harmony/Melody custom drivers also contain the value @@ -789,7 +789,7 @@ bool CartDetector::isProbablyDPCplus(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyE0(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyE0(const ByteBuffer& image, size_t size) { // E0 cart bankswitching is triggered by accessing addresses // $FE0 to $FF9 using absolute non-indexed addressing @@ -815,7 +815,7 @@ bool CartDetector::isProbablyE0(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyE7(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyE7(const ByteBuffer& image, size_t size) { // E7 cart bankswitching is triggered by accessing addresses // $FE0 to $FE6 using absolute non-indexed addressing @@ -840,7 +840,7 @@ bool CartDetector::isProbablyE7(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyE78K(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyE78K(const ByteBuffer& image, size_t size) { // E78K cart bankswitching is triggered by accessing addresses // $FE4 to $FE6 using absolute non-indexed addressing @@ -859,7 +859,7 @@ bool CartDetector::isProbablyE78K(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyEF(const ByteBuffer& image, uInt32 size, +bool CartDetector::isProbablyEF(const ByteBuffer& image, size_t size, Bankswitch::Type& type) { // Newer EF carts store strings 'EFEF' and 'EFSC' starting at address $FFF8 @@ -908,7 +908,7 @@ bool CartDetector::isProbablyEF(const ByteBuffer& image, uInt32 size, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyFA2(const ByteBuffer& image, uInt32) +bool CartDetector::isProbablyFA2(const ByteBuffer& image, size_t) { // This currently tests only the 32K version of FA2; the 24 and 28K // versions are easy, in that they're the only possibility with those @@ -923,7 +923,7 @@ bool CartDetector::isProbablyFA2(const ByteBuffer& image, uInt32) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyFE(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyFE(const ByteBuffer& image, size_t size) { // FE bankswitching is very weird, but always seems to include a // 'JSR $xxxx' @@ -942,15 +942,15 @@ bool CartDetector::isProbablyFE(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyMDM(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyMDM(const ByteBuffer& image, size_t size) { // MDM cart is identified key 'MDMC' in the first 8K of ROM uInt8 mdmc[] = { 'M', 'D', 'M', 'C' }; - return searchForBytes(image.get(), std::min(size, 8192u), mdmc, 4, 1); + return searchForBytes(image.get(), std::min(size, 8_KB), mdmc, 4, 1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablySB(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablySB(const ByteBuffer& image, size_t size) { // SB cart bankswitching switches banks by accessing address 0x0800 uInt8 signature[2][3] = { @@ -964,7 +964,7 @@ bool CartDetector::isProbablySB(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyUA(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyUA(const ByteBuffer& image, size_t size) { // UA cart bankswitching switches to bank 1 by accessing address 0x240 // using 'STA $240' or 'LDA $240' @@ -986,7 +986,7 @@ bool CartDetector::isProbablyUA(const ByteBuffer& image, uInt32 size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDetector::isProbablyX07(const ByteBuffer& image, uInt32 size) +bool CartDetector::isProbablyX07(const ByteBuffer& image, size_t size) { // X07 bankswitching switches to bank 0, 1, 2, etc by accessing address 0x08xd uInt8 signature[6][3] = { diff --git a/src/emucore/CartDetector.hxx b/src/emucore/CartDetector.hxx index f11f94da7..727f5ba77 100644 --- a/src/emucore/CartDetector.hxx +++ b/src/emucore/CartDetector.hxx @@ -46,7 +46,7 @@ class CartDetector @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr create(const FilesystemNode& file, - const ByteBuffer& image, uInt32 size, string& md5, + const ByteBuffer& image, size_t size, string& md5, const string& dtype, Settings& settings); /** @@ -57,7 +57,7 @@ class CartDetector @return The "best guess" for the cartridge type */ - static Bankswitch::Type autodetectType(const ByteBuffer& image, uInt32 size); + static Bankswitch::Type autodetectType(const ByteBuffer& image, size_t size); private: /** @@ -75,7 +75,7 @@ class CartDetector @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr - createFromMultiCart(const ByteBuffer& image, uInt32& size, + createFromMultiCart(const ByteBuffer& image, size_t& size, uInt32 numroms, string& md5, Bankswitch::Type type, string& id, Settings& settings); @@ -91,7 +91,7 @@ class CartDetector @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr - createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type, + createFromImage(const ByteBuffer& image, size_t size, Bankswitch::Type type, const string& md5, Settings& settings); /** @@ -105,7 +105,7 @@ class CartDetector @return True if the signature was found at least 'minhits' time, else false */ - static bool searchForBytes(const uInt8* image, uInt32 imagesize, + static bool searchForBytes(const uInt8* image, size_t imagesize, const uInt8* signature, uInt32 sigsize, uInt32 minhits); @@ -113,142 +113,142 @@ class CartDetector Returns true if the image is probably a SuperChip (128 bytes RAM) Note: should be called only on ROMs with size multiple of 4K */ - static bool isProbablySC(const ByteBuffer& image, uInt32 size); + static bool isProbablySC(const ByteBuffer& image, size_t size); /** Returns true if the image probably contains ARM code in the first 1K */ - static bool isProbablyARM(const ByteBuffer& image, uInt32 size); + static bool isProbablyARM(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a 0840 bankswitching cartridge */ - static bool isProbably0840(const ByteBuffer& image, uInt32 size); + static bool isProbably0840(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a 3E bankswitching cartridge */ - static bool isProbably3E(const ByteBuffer& image, uInt32 size); + static bool isProbably3E(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a 3E+ bankswitching cartridge */ - static bool isProbably3EPlus(const ByteBuffer& image, uInt32 size); + static bool isProbably3EPlus(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a 3F bankswitching cartridge */ - static bool isProbably3F(const ByteBuffer& image, uInt32 size); + static bool isProbably3F(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a 4A50 bankswitching cartridge */ - static bool isProbably4A50(const ByteBuffer& image, uInt32 size); + static bool isProbably4A50(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a 4K SuperChip (128 bytes RAM) */ - static bool isProbably4KSC(const ByteBuffer& image, uInt32 size); + static bool isProbably4KSC(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a BF/BFSC bankswitching cartridge */ - static bool isProbablyBF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type); + static bool isProbablyBF(const ByteBuffer& image, size_t size, Bankswitch::Type& type); /** Returns true if the image is probably a BUS bankswitching cartridge */ - static bool isProbablyBUS(const ByteBuffer& image, uInt32 size); + static bool isProbablyBUS(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a CDF bankswitching cartridge */ - static bool isProbablyCDF(const ByteBuffer& image, uInt32 size); + static bool isProbablyCDF(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a CTY bankswitching cartridge */ - static bool isProbablyCTY(const ByteBuffer& image, uInt32 size); + static bool isProbablyCTY(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a CV bankswitching cartridge */ - static bool isProbablyCV(const ByteBuffer& image, uInt32 size); + static bool isProbablyCV(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a CV+ bankswitching cartridge */ - static bool isProbablyCVPlus(const ByteBuffer& image, uInt32 size); + static bool isProbablyCVPlus(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a DASH bankswitching cartridge */ - static bool isProbablyDASH(const ByteBuffer& image, uInt32 size); + static bool isProbablyDASH(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a DF/DFSC bankswitching cartridge */ - static bool isProbablyDF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type); + static bool isProbablyDF(const ByteBuffer& image, size_t size, Bankswitch::Type& type); /** Returns true if the image is probably a DPC+ bankswitching cartridge */ - static bool isProbablyDPCplus(const ByteBuffer& image, uInt32 size); + static bool isProbablyDPCplus(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a E0 bankswitching cartridge */ - static bool isProbablyE0(const ByteBuffer& image, uInt32 size); + static bool isProbablyE0(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a E7 bankswitching cartridge */ - static bool isProbablyE7(const ByteBuffer& image, uInt32 size); + static bool isProbablyE7(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a E78K bankswitching cartridge */ - static bool isProbablyE78K(const ByteBuffer& image, uInt32 size); + static bool isProbablyE78K(const ByteBuffer& image, size_t size); /** Returns true if the image is probably an EF/EFSC bankswitching cartridge */ - static bool isProbablyEF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type); + static bool isProbablyEF(const ByteBuffer& image, size_t size, Bankswitch::Type& type); /** Returns true if the image is probably an F6 bankswitching cartridge */ - //static bool isProbablyF6(const ByteBuffer& image, uInt32 size); + //static bool isProbablyF6(const ByteBuffer& image, size_t size); /** Returns true if the image is probably an FA2 bankswitching cartridge */ - static bool isProbablyFA2(const ByteBuffer& image, uInt32 size); + static bool isProbablyFA2(const ByteBuffer& image, size_t size); /** Returns true if the image is probably an FE bankswitching cartridge */ - static bool isProbablyFE(const ByteBuffer& image, uInt32 size); + static bool isProbablyFE(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a MDM bankswitching cartridge */ - static bool isProbablyMDM(const ByteBuffer& image, uInt32 size); + static bool isProbablyMDM(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a SB bankswitching cartridge */ - static bool isProbablySB(const ByteBuffer& image, uInt32 size); + static bool isProbablySB(const ByteBuffer& image, size_t size); /** Returns true if the image is probably a UA bankswitching cartridge */ - static bool isProbablyUA(const ByteBuffer& image, uInt32 size); + static bool isProbablyUA(const ByteBuffer& image, size_t size); /** Returns true if the image is probably an X07 bankswitching cartridge */ - static bool isProbablyX07(const ByteBuffer& image, uInt32 size); + static bool isProbablyX07(const ByteBuffer& image, size_t size); private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index ee177b1ab..91a41de06 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -19,12 +19,12 @@ #include "CartE0.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeE0::CartridgeE0(const ByteBuffer& image, uInt32 size, +CartridgeE0::CartridgeE0(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5) { // 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()); createCodeAccessBase(myImage.size()); } @@ -201,7 +201,7 @@ bool CartridgeE0::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeE0::getImage(uInt32& size) const +const uInt8* CartridgeE0::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartE0.hxx b/src/emucore/CartE0.hxx index 40af37922..d80a9ff0c 100644 --- a/src/emucore/CartE0.hxx +++ b/src/emucore/CartE0.hxx @@ -54,7 +54,7 @@ class CartridgeE0 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeE0(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeE0(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeE0() = default; @@ -100,7 +100,7 @@ class CartridgeE0 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index 87a3b7a98..0ef0f0eb8 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -19,7 +19,7 @@ #include "CartE7.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeE7::CartridgeE7(const ByteBuffer& image, uInt32 size, +CartridgeE7::CartridgeE7(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : CartridgeMNetwork(image, size, md5, settings) { diff --git a/src/emucore/CartE7.hxx b/src/emucore/CartE7.hxx index 6b1c36973..ca98dd739 100644 --- a/src/emucore/CartE7.hxx +++ b/src/emucore/CartE7.hxx @@ -43,7 +43,7 @@ class CartridgeE7 : public CartridgeMNetwork @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeE7(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeE7(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeE7() = default; diff --git a/src/emucore/CartE78K.cxx b/src/emucore/CartE78K.cxx index 04f7b2c82..024031fb0 100644 --- a/src/emucore/CartE78K.cxx +++ b/src/emucore/CartE78K.cxx @@ -19,7 +19,7 @@ #include "CartE78K.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeE78K::CartridgeE78K(const ByteBuffer& image, uInt32 size, +CartridgeE78K::CartridgeE78K(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : CartridgeMNetwork(image, size, md5, settings) { diff --git a/src/emucore/CartE78K.hxx b/src/emucore/CartE78K.hxx index 91fe1b785..6c0dafdaa 100644 --- a/src/emucore/CartE78K.hxx +++ b/src/emucore/CartE78K.hxx @@ -41,7 +41,7 @@ class CartridgeE78K : public CartridgeMNetwork @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeE78K(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeE78K(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeE78K() = default; diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index 06fb84945..b8807e430 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -19,13 +19,13 @@ #include "CartEF.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeEF::CartridgeEF(const ByteBuffer& image, uInt32 size, +CartridgeEF::CartridgeEF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -120,7 +120,7 @@ bool CartridgeEF::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeEF::getImage(uInt32& size) const +const uInt8* CartridgeEF::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartEF.hxx b/src/emucore/CartEF.hxx index 06622b00f..558bf87f0 100644 --- a/src/emucore/CartEF.hxx +++ b/src/emucore/CartEF.hxx @@ -46,7 +46,7 @@ class CartridgeEF : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeEF(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeEF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeEF() = default; @@ -98,7 +98,7 @@ class CartridgeEF : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index f9622de5e..c630c79f3 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -19,13 +19,13 @@ #include "CartEFSC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeEFSC::CartridgeEFSC(const ByteBuffer& image, uInt32 size, +CartridgeEFSC::CartridgeEFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -174,7 +174,7 @@ bool CartridgeEFSC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeEFSC::getImage(uInt32& size) const +const uInt8* CartridgeEFSC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartEFSC.hxx b/src/emucore/CartEFSC.hxx index c4c90f475..33bcd1857 100644 --- a/src/emucore/CartEFSC.hxx +++ b/src/emucore/CartEFSC.hxx @@ -47,7 +47,7 @@ class CartridgeEFSC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeEFSC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeEFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeEFSC() = default; @@ -99,7 +99,7 @@ class CartridgeEFSC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index d4004c999..25e886652 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -19,13 +19,13 @@ #include "CartF0.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF0::CartridgeF0(const ByteBuffer& image, uInt32 size, +CartridgeF0::CartridgeF0(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -128,7 +128,7 @@ bool CartridgeF0::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF0::getImage(uInt32& size) const +const uInt8* CartridgeF0::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF0.hxx b/src/emucore/CartF0.hxx index a4e6fae09..0ad75808b 100644 --- a/src/emucore/CartF0.hxx +++ b/src/emucore/CartF0.hxx @@ -46,7 +46,7 @@ class CartridgeF0 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF0(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF0(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF0() = default; @@ -98,7 +98,7 @@ class CartridgeF0 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index b50679ff1..8e57359da 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -20,13 +20,13 @@ #include "CartF4.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF4::CartridgeF4(const ByteBuffer& image, uInt32 size, +CartridgeF4::CartridgeF4(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -124,7 +124,7 @@ bool CartridgeF4::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF4::getImage(uInt32& size) const +const uInt8* CartridgeF4::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF4.hxx b/src/emucore/CartF4.hxx index 090f49dea..2c03fcabd 100644 --- a/src/emucore/CartF4.hxx +++ b/src/emucore/CartF4.hxx @@ -45,7 +45,7 @@ class CartridgeF4 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF4(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF4(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF4() = default; @@ -97,7 +97,7 @@ class CartridgeF4 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 8b282075c..8d075302a 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -19,13 +19,13 @@ #include "CartF4SC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF4SC::CartridgeF4SC(const ByteBuffer& image, uInt32 size, +CartridgeF4SC::CartridgeF4SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -174,7 +174,7 @@ bool CartridgeF4SC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF4SC::getImage(uInt32& size) const +const uInt8* CartridgeF4SC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index d20b58d74..155122d9e 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -46,7 +46,7 @@ class CartridgeF4SC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF4SC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF4SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF4SC() = default; @@ -98,7 +98,7 @@ class CartridgeF4SC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index d4b54a63a..9ff62dda9 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -19,13 +19,13 @@ #include "CartF6.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF6::CartridgeF6(const ByteBuffer& image, uInt32 size, +CartridgeF6::CartridgeF6(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -164,7 +164,7 @@ bool CartridgeF6::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF6::getImage(uInt32& size) const +const uInt8* CartridgeF6::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF6.hxx b/src/emucore/CartF6.hxx index 515eaf1e4..275d0c57f 100644 --- a/src/emucore/CartF6.hxx +++ b/src/emucore/CartF6.hxx @@ -45,7 +45,7 @@ class CartridgeF6 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF6(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF6(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF6() = default; @@ -97,7 +97,7 @@ class CartridgeF6 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index 95ca133ed..f5d64517e 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -19,13 +19,13 @@ #include "CartF6SC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF6SC::CartridgeF6SC(const ByteBuffer& image, uInt32 size, +CartridgeF6SC::CartridgeF6SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -214,7 +214,7 @@ bool CartridgeF6SC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF6SC::getImage(uInt32& size) const +const uInt8* CartridgeF6SC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index ed83b05e5..d9a9d9493 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -46,7 +46,7 @@ class CartridgeF6SC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF6SC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF6SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF6SC() = default; @@ -98,7 +98,7 @@ class CartridgeF6SC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index 08d40651b..5b660e2e4 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -19,13 +19,13 @@ #include "CartF8.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF8::CartridgeF8(const ByteBuffer& image, uInt32 size, +CartridgeF8::CartridgeF8(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -145,7 +145,7 @@ bool CartridgeF8::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF8::getImage(uInt32& size) const +const uInt8* CartridgeF8::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF8.hxx b/src/emucore/CartF8.hxx index a9fe62bb5..c72fd4db9 100644 --- a/src/emucore/CartF8.hxx +++ b/src/emucore/CartF8.hxx @@ -45,7 +45,7 @@ class CartridgeF8 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF8(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF8(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF8() = default; @@ -97,7 +97,7 @@ class CartridgeF8 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 82d005897..60299169a 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -19,13 +19,13 @@ #include "CartF8SC.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeF8SC::CartridgeF8SC(const ByteBuffer& image, uInt32 size, +CartridgeF8SC::CartridgeF8SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -194,7 +194,7 @@ bool CartridgeF8SC::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeF8SC::getImage(uInt32& size) const +const uInt8* CartridgeF8SC::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartF8SC.hxx b/src/emucore/CartF8SC.hxx index 460bdb7fa..714c1ef44 100644 --- a/src/emucore/CartF8SC.hxx +++ b/src/emucore/CartF8SC.hxx @@ -46,7 +46,7 @@ class CartridgeF8SC : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeF8SC(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeF8SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeF8SC() = default; @@ -98,7 +98,7 @@ class CartridgeF8SC : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index f69bd9409..f5a3c9230 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -19,13 +19,13 @@ #include "CartFA.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeFA::CartridgeFA(const ByteBuffer& image, uInt32 size, +CartridgeFA::CartridgeFA(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -204,7 +204,7 @@ bool CartridgeFA::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeFA::getImage(uInt32& size) const +const uInt8* CartridgeFA::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx index 04422ca01..c5005fbf4 100644 --- a/src/emucore/CartFA.hxx +++ b/src/emucore/CartFA.hxx @@ -46,7 +46,7 @@ class CartridgeFA : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeFA(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeFA(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeFA() = default; @@ -98,7 +98,7 @@ class CartridgeFA : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 5fe0b7e2a..5b701a628 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -22,10 +22,10 @@ #include "CartFA2.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeFA2::CartridgeFA2(const ByteBuffer& image, uInt32 size, +CartridgeFA2::CartridgeFA2(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(28 * 1024), + mySize(28_KB), myRamAccessTimeout(0), myBankOffset(0) { @@ -249,7 +249,7 @@ uInt16 CartridgeFA2::getBank(uInt16) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 CartridgeFA2::bankCount() const { - return (mySize / 4_KB); + return uInt16(mySize / 4_KB); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -271,7 +271,7 @@ bool CartridgeFA2::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeFA2::getImage(uInt32& size) const +const uInt8* CartridgeFA2::getImage(size_t& size) const { size = mySize; return myImage.data(); diff --git a/src/emucore/CartFA2.hxx b/src/emucore/CartFA2.hxx index c4b43d72b..5f10b9651 100644 --- a/src/emucore/CartFA2.hxx +++ b/src/emucore/CartFA2.hxx @@ -58,7 +58,7 @@ class CartridgeFA2 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the settings object */ - CartridgeFA2(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeFA2(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeFA2() = default; @@ -110,7 +110,7 @@ class CartridgeFA2 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -196,7 +196,7 @@ class CartridgeFA2 : public Cartridge std::array myImage; // Actual usable size of the ROM image - uInt32 mySize; + size_t mySize; // The 256 bytes of RAM on the cartridge std::array myRAM; diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index e811bb966..a8458aea6 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -20,14 +20,14 @@ #include "CartFE.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeFE::CartridgeFE(const ByteBuffer& image, uInt32 size, +CartridgeFE::CartridgeFE(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myBankOffset(0), myLastAccessWasFE(false) { // 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()); createCodeAccessBase(myImage.size()); } @@ -129,7 +129,7 @@ bool CartridgeFE::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeFE::getImage(uInt32& size) const +const uInt8* CartridgeFE::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index 1ea11d6a0..fc7e09af1 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -88,7 +88,7 @@ class CartridgeFE : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeFE(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeFE(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeFE() = default; @@ -140,7 +140,7 @@ class CartridgeFE : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index f2bf265b6..3539a0167 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -19,7 +19,7 @@ #include "CartMDM.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeMDM::CartridgeMDM(const ByteBuffer& image, uInt32 size, +CartridgeMDM::CartridgeMDM(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -132,7 +132,7 @@ uInt16 CartridgeMDM::getBank(uInt16) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 CartridgeMDM::bankCount() const { - return mySize >> 12; + return uInt16(mySize >> 12); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -143,7 +143,7 @@ bool CartridgeMDM::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeMDM::getImage(uInt32& size) const +const uInt8* CartridgeMDM::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index af19471d5..8006a24cb 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -57,7 +57,7 @@ class CartridgeMDM : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeMDM(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeMDM(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeMDM() = default; @@ -109,7 +109,7 @@ class CartridgeMDM : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -168,7 +168,7 @@ class CartridgeMDM : public Cartridge ByteBuffer myImage; // Size of the ROM image - uInt32 mySize; + size_t mySize; // Previous Device's page access std::array myHotSpotPageAccess; diff --git a/src/emucore/CartMNetwork.cxx b/src/emucore/CartMNetwork.cxx index ad4c28021..70c403eb3 100644 --- a/src/emucore/CartMNetwork.cxx +++ b/src/emucore/CartMNetwork.cxx @@ -19,7 +19,7 @@ #include "CartMNetwork.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, uInt32 size, +CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -29,13 +29,13 @@ CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, uInt32 size, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeMNetwork::initialize(const ByteBuffer& image, uInt32 size) +void CartridgeMNetwork::initialize(const ByteBuffer& image, size_t size) { // Allocate array for the ROM image myImage = make_unique(size); // Copy the ROM image into my buffer - std::copy_n(image.get(), std::min(romSize(), size), myImage.get()); + std::copy_n(image.get(), std::min(romSize(), size), myImage.get()); createCodeAccessBase(romSize() + myRAM.size()); myRAMSlice = bankCount() - 1; @@ -232,7 +232,7 @@ bool CartridgeMNetwork::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeMNetwork::getImage(uInt32& size) const +const uInt8* CartridgeMNetwork::getImage(size_t& size) const { size = bankCount() * BANK_SIZE; return myImage.get(); @@ -281,11 +281,11 @@ bool CartridgeMNetwork::load(Serializer& in) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 CartridgeMNetwork::bankCount() const { - return mySize >> 11; + return uInt16(mySize >> 11); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 CartridgeMNetwork::romSize() const +uInt16 CartridgeMNetwork::romSize() const { return bankCount() * BANK_SIZE; } diff --git a/src/emucore/CartMNetwork.hxx b/src/emucore/CartMNetwork.hxx index fed4d8789..6202c33ab 100644 --- a/src/emucore/CartMNetwork.hxx +++ b/src/emucore/CartMNetwork.hxx @@ -73,7 +73,7 @@ class CartridgeMNetwork : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeMNetwork(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeMNetwork(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeMNetwork() = default; @@ -125,7 +125,7 @@ class CartridgeMNetwork : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -164,7 +164,7 @@ class CartridgeMNetwork : public Cartridge /** Class initialization */ - void initialize(const ByteBuffer& image, uInt32 size); + void initialize(const ByteBuffer& image, size_t size); /** Install pages for the specified 256 byte bank of RAM @@ -185,7 +185,7 @@ class CartridgeMNetwork : public Cartridge /** Query the size of the BS type. */ - uInt32 romSize() const; + uInt16 romSize() const; /** Check hotspots and switch bank if triggered. @@ -202,7 +202,7 @@ class CartridgeMNetwork : public Cartridge //uInt8 myImage[BANK_SIZE * 8]; // Size of the ROM image - uInt32 mySize; + size_t mySize; // The 2K of RAM std::array myRAM; diff --git a/src/emucore/CartSB.cxx b/src/emucore/CartSB.cxx index 776c20140..c0464abec 100644 --- a/src/emucore/CartSB.cxx +++ b/src/emucore/CartSB.cxx @@ -19,7 +19,7 @@ #include "CartSB.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeSB::CartridgeSB(const ByteBuffer& image, uInt32 size, +CartridgeSB::CartridgeSB(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), mySize(size), @@ -137,7 +137,7 @@ uInt16 CartridgeSB::getBank(uInt16) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt16 CartridgeSB::bankCount() const { - return mySize >> 12; + return uInt16(mySize >> 12); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -148,7 +148,7 @@ bool CartridgeSB::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeSB::getImage(uInt32& size) const +const uInt8* CartridgeSB::getImage(size_t& size) const { size = mySize; return myImage.get(); diff --git a/src/emucore/CartSB.hxx b/src/emucore/CartSB.hxx index f89b0db38..b44f03db8 100644 --- a/src/emucore/CartSB.hxx +++ b/src/emucore/CartSB.hxx @@ -46,7 +46,7 @@ class CartridgeSB : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeSB(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeSB(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeSB() = default; @@ -98,7 +98,7 @@ class CartridgeSB : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -155,7 +155,7 @@ class CartridgeSB : public Cartridge private: // The 128-256K ROM image and size of the cartridge ByteBuffer myImage; - uInt32 mySize; + size_t mySize; // Indicates the offset into the ROM image (aligns to current bank) uInt32 myBankOffset; diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index 336b19d1c..079ae8cc8 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -19,7 +19,7 @@ #include "CartUA.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeUA::CartridgeUA(const ByteBuffer& image, uInt32 size, +CartridgeUA::CartridgeUA(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings, bool swapHotspots) : Cartridge(settings, md5), @@ -27,7 +27,7 @@ CartridgeUA::CartridgeUA(const ByteBuffer& image, uInt32 size, mySwappedHotspots(swapHotspots) { // 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()); createCodeAccessBase(myImage.size()); } @@ -162,7 +162,7 @@ bool CartridgeUA::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeUA::getImage(uInt32& size) const +const uInt8* CartridgeUA::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index 817f509b0..5b55d2e9c 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -46,7 +46,7 @@ class CartridgeUA : public Cartridge @param settings A reference to the various settings (read-only) @param swapHotspots Swap hotspots */ - CartridgeUA(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeUA(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings, bool swapHotspots = false); virtual ~CartridgeUA() = default; @@ -98,7 +98,7 @@ class CartridgeUA : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index fa9782a98..45e550155 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -21,10 +21,10 @@ #include "CartWD.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeWD::CartridgeWD(const ByteBuffer& image, uInt32 size, +CartridgeWD::CartridgeWD(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(std::min(8_KB + 3, size)), + mySize(std::min(8_KB + 3, size)), myCyclesAtBankswitchInit(0), myPendingBank(0), myCurrentBank(0) @@ -258,7 +258,7 @@ bool CartridgeWD::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeWD::getImage(uInt32& size) const +const uInt8* CartridgeWD::getImage(size_t& size) const { size = mySize; return myImage.data(); diff --git a/src/emucore/CartWD.hxx b/src/emucore/CartWD.hxx index a70db8d78..1afb7c856 100644 --- a/src/emucore/CartWD.hxx +++ b/src/emucore/CartWD.hxx @@ -74,7 +74,7 @@ class CartridgeWD : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeWD(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeWD(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeWD() = default; @@ -126,7 +126,7 @@ class CartridgeWD : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. @@ -216,7 +216,7 @@ class CartridgeWD : public Cartridge std::array myImage; // Indicates the actual size of the ROM image (either 8K or 8K + 3) - uInt32 mySize; + size_t mySize; // The 64 bytes RAM of the cartridge std::array myRAM; diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 1f14952f3..57b617e7d 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -21,13 +21,13 @@ #include "CartX07.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeX07::CartridgeX07(const ByteBuffer& image, uInt32 size, +CartridgeX07::CartridgeX07(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), myCurrentBank(0) { // 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()); createCodeAccessBase(myImage.size()); } @@ -142,7 +142,7 @@ bool CartridgeX07::patch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8* CartridgeX07::getImage(uInt32& size) const +const uInt8* CartridgeX07::getImage(size_t& size) const { size = myImage.size(); return myImage.data(); diff --git a/src/emucore/CartX07.hxx b/src/emucore/CartX07.hxx index aeb00138f..04a995aba 100644 --- a/src/emucore/CartX07.hxx +++ b/src/emucore/CartX07.hxx @@ -55,7 +55,7 @@ class CartridgeX07 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeX07(const ByteBuffer& image, uInt32 size, const string& md5, + CartridgeX07(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings); virtual ~CartridgeX07() = default; @@ -107,7 +107,7 @@ class CartridgeX07 : public Cartridge @param size Set to the size of the internal ROM image data @return A pointer to the internal ROM image data */ - const uInt8* getImage(uInt32& size) const override; + const uInt8* getImage(size_t& size) const override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 58eef7d20..ac5a822b9 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -816,7 +816,7 @@ void Console::setControllers(const string& romMd5) // Setup the controllers based on properties Controller::Type leftType = Controller::getType(myProperties.get(PropType::Controller_Left)); Controller::Type rightType = Controller::getType(myProperties.get(PropType::Controller_Right)); - uInt32 size = 0; + size_t size = 0; const uInt8* image = myCart->getImage(size); const bool swappedPorts = myProperties.get(PropType::Console_SwapPorts) == "YES"; diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx index 138b5e7c5..3b7b21f27 100644 --- a/src/emucore/Serializer.cxx +++ b/src/emucore/Serializer.cxx @@ -104,7 +104,7 @@ uInt8 Serializer::getByte() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::getByteArray(uInt8* array, uInt32 size) const +void Serializer::getByteArray(uInt8* array, size_t size) const { myStream->read(reinterpret_cast(array), size); } @@ -119,7 +119,7 @@ uInt16 Serializer::getShort() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::getShortArray(uInt16* array, uInt32 size) const +void Serializer::getShortArray(uInt16* array, size_t size) const { myStream->read(reinterpret_cast(array), sizeof(uInt16)*size); } @@ -134,7 +134,7 @@ uInt32 Serializer::getInt() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::getIntArray(uInt32* array, uInt32 size) const +void Serializer::getIntArray(uInt32* array, size_t size) const { myStream->read(reinterpret_cast(array), sizeof(uInt32)*size); } @@ -181,7 +181,7 @@ void Serializer::putByte(uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::putByteArray(const uInt8* array, uInt32 size) +void Serializer::putByteArray(const uInt8* array, size_t size) { myStream->write(reinterpret_cast(array), size); } @@ -193,7 +193,7 @@ void Serializer::putShort(uInt16 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::putShortArray(const uInt16* array, uInt32 size) +void Serializer::putShortArray(const uInt16* array, size_t size) { myStream->write(reinterpret_cast(array), sizeof(uInt16)*size); } @@ -205,7 +205,7 @@ void Serializer::putInt(uInt32 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::putIntArray(const uInt32* array, uInt32 size) +void Serializer::putIntArray(const uInt32* array, size_t size) { myStream->write(reinterpret_cast(array), sizeof(uInt32)*size); } diff --git a/src/emucore/Serializer.hxx b/src/emucore/Serializer.hxx index 6dce4555d..d9d0de408 100644 --- a/src/emucore/Serializer.hxx +++ b/src/emucore/Serializer.hxx @@ -82,7 +82,7 @@ class Serializer @param array The location to store the bytes read @param size The size of the array (number of bytes to read) */ - void getByteArray(uInt8* array, uInt32 size) const; + void getByteArray(uInt8* array, size_t size) const; /** Reads a short value (unsigned 16-bit) from the current input stream. @@ -97,7 +97,7 @@ class Serializer @param array The location to store the shorts read @param size The size of the array (number of shorts to read) */ - void getShortArray(uInt16* array, uInt32 size) const; + void getShortArray(uInt16* array, size_t size) const; /** Reads an int value (unsigned 32-bit) from the current input stream. @@ -112,7 +112,7 @@ class Serializer @param array The location to store the integers read @param size The size of the array (number of integers to read) */ - void getIntArray(uInt32* array, uInt32 size) const; + void getIntArray(uInt32* array, size_t size) const; /** Reads a long int value (unsigned 64-bit) from the current input stream. @@ -155,7 +155,7 @@ class Serializer @param array The bytes to write @param size The size of the array (number of bytes to write) */ - void putByteArray(const uInt8* array, uInt32 size); + void putByteArray(const uInt8* array, size_t size); /** Writes a short value (unsigned 16-bit) to the current output stream. @@ -170,7 +170,7 @@ class Serializer @param array The short to write @param size The size of the array (number of shorts to write) */ - void putShortArray(const uInt16* array, uInt32 size); + void putShortArray(const uInt16* array, size_t size); /** Writes an int value (unsigned 32-bit) to the current output stream. @@ -185,7 +185,7 @@ class Serializer @param array The integers to write @param size The size of the array (number of integers to write) */ - void putIntArray(const uInt32* array, uInt32 size); + void putIntArray(const uInt32* array, size_t size); /** Writes a long int value (unsigned 64-bit) to the current output stream.