mirror of https://github.com/stella-emu/stella.git
Moved 'max ROM size' function to more appropriate place.
This commit is contained in:
parent
29fee4c580
commit
f0e2b357cf
src
|
@ -128,9 +128,6 @@ namespace BSPF
|
||||||
static const string ARCH = "NOARCH";
|
static const string ARCH = "NOARCH";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Maximum size of a ROM that Stella can support
|
|
||||||
inline constexpr size_t romMaxSize() { return 512_KB; }
|
|
||||||
|
|
||||||
// Get next power of two greater than or equal to the given value
|
// Get next power of two greater than or equal to the given value
|
||||||
inline size_t nextPowerOfTwo(size_t size) {
|
inline size_t nextPowerOfTwo(size_t size) {
|
||||||
if(size < 2) return 1;
|
if(size < 2) return 1;
|
||||||
|
|
|
@ -48,6 +48,9 @@ class Cartridge : public Device
|
||||||
public:
|
public:
|
||||||
using StartBankFromPropsFunc = std::function<int()>;
|
using StartBankFromPropsFunc = std::function<int()>;
|
||||||
|
|
||||||
|
// Maximum size of a ROM cart that Stella can support
|
||||||
|
static constexpr size_t maxSize() { return 512_KB; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Create a new cartridge
|
Create a new cartridge
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Cart.hxx"
|
||||||
#include "FSNodeFactory.hxx"
|
#include "FSNodeFactory.hxx"
|
||||||
#include "FSNode.hxx"
|
#include "FSNode.hxx"
|
||||||
|
|
||||||
|
@ -237,7 +238,7 @@ size_t FilesystemNode::read(ByteBuffer& image) const
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// Otherwise, the default behaviour is to read from a normal C++ ifstream
|
// Otherwise, the default behaviour is to read from a normal C++ ifstream
|
||||||
image = make_unique<uInt8[]>(BSPF::romMaxSize());
|
image = make_unique<uInt8[]>(Cartridge::maxSize());
|
||||||
ifstream in(getPath(), std::ios::binary);
|
ifstream in(getPath(), std::ios::binary);
|
||||||
if (in)
|
if (in)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +249,7 @@ size_t FilesystemNode::read(ByteBuffer& image) const
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
throw runtime_error("Zero-byte file");
|
throw runtime_error("Zero-byte file");
|
||||||
|
|
||||||
size = std::min<size_t>(length, BSPF::romMaxSize());
|
size = std::min<size_t>(length, Cartridge::maxSize());
|
||||||
in.read(reinterpret_cast<char*>(image.get()), size);
|
in.read(reinterpret_cast<char*>(image.get()), size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
#include "Cart.hxx"
|
||||||
#include "FSNodeLIBRETRO.hxx"
|
#include "FSNodeLIBRETRO.hxx"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -93,7 +94,7 @@ AbstractFSNodePtr FilesystemNodeLIBRETRO::getParent() const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
size_t FilesystemNodeLIBRETRO::read(ByteBuffer& image) const
|
size_t FilesystemNodeLIBRETRO::read(ByteBuffer& image) const
|
||||||
{
|
{
|
||||||
image = make_unique<uInt8[]>(BSPF::romMaxSize());
|
image = make_unique<uInt8[]>(Cartridge::maxSize());
|
||||||
|
|
||||||
extern uInt32 libretro_read_rom(void* data);
|
extern uInt32 libretro_read_rom(void* data);
|
||||||
return libretro_read_rom(image.get());
|
return libretro_read_rom(image.get());
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "OSystemLIBRETRO.hxx"
|
#include "OSystemLIBRETRO.hxx"
|
||||||
|
|
||||||
|
#include "Cart.hxx"
|
||||||
#include "Console.hxx"
|
#include "Console.hxx"
|
||||||
#include "ConsoleTiming.hxx"
|
#include "ConsoleTiming.hxx"
|
||||||
#include "Control.hxx"
|
#include "Control.hxx"
|
||||||
|
@ -59,7 +60,7 @@ class StellaLIBRETRO
|
||||||
|
|
||||||
void* getROM() const { return rom_image.get(); }
|
void* getROM() const { return rom_image.get(); }
|
||||||
uInt32 getROMSize() const { return rom_size; }
|
uInt32 getROMSize() const { return rom_size; }
|
||||||
constexpr uInt32 getROMMax() const { return BSPF::romMaxSize(); }
|
constexpr uInt32 getROMMax() const { return Cartridge::maxSize(); }
|
||||||
|
|
||||||
uInt8* getRAM() { return system_ram; }
|
uInt8* getRAM() { return system_ram; }
|
||||||
constexpr uInt32 getRAMSize() const { return 128; }
|
constexpr uInt32 getRAMSize() const { return 128; }
|
||||||
|
|
Loading…
Reference in New Issue