mirror of https://github.com/stella-emu/stella.git
commit
fbb8ea0db0
|
@ -21,6 +21,7 @@ _build_joystick=yes
|
|||
_build_cheats=yes
|
||||
_build_png=yes
|
||||
_build_zip=yes
|
||||
_build_sqlite=no
|
||||
_build_static=no
|
||||
_build_profile=no
|
||||
_build_debug=no
|
||||
|
@ -201,6 +202,8 @@ Optional Features:
|
|||
--disable-png
|
||||
--enable-zip enable/disable ZIP file support [enabled]
|
||||
--disable-zip
|
||||
--enable-sqlite enable SQLite for storing settings and preferences [disabled]
|
||||
--disable-sqlite
|
||||
--enable-windowed enable/disable windowed rendering modes [enabled]
|
||||
--disable-windowed
|
||||
--enable-shared build shared binary [enabled]
|
||||
|
@ -215,6 +218,7 @@ Optional Libraries:
|
|||
--with-sdl-prefix=DIR Prefix where the sdl2-config script is installed (optional)
|
||||
--with-libpng-prefix=DIR Prefix where libpng is installed (optional)
|
||||
--with-zlib-prefix=DIR Prefix where zlib is installed (optional)
|
||||
--with-sqlite-prefix=DIR PREFIX where sqlite is installed (optional)
|
||||
|
||||
Some influential environment variables:
|
||||
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
|
||||
|
@ -243,6 +247,8 @@ for ac_option in $@; do
|
|||
--disable-png) _build_png=no ;;
|
||||
--enable-zip) _build_zip=yes ;;
|
||||
--disable-zip) _build_zip=no ;;
|
||||
--enable-sqlite) _build_sqlite=yes ;;
|
||||
--disable-sqlite) _build_sqlite=no ;;
|
||||
--enable-windowed) _build_windowed=yes ;;
|
||||
--disable-windowed) _build_windowed=no ;;
|
||||
--enable-shared) _build_static=no ;;
|
||||
|
@ -265,6 +271,11 @@ for ac_option in $@; do
|
|||
_prefix=`echo $ac_option | cut -d '=' -f 2`
|
||||
ZLIB_CFLAGS="-I$_prefix/include"
|
||||
ZLIB_LIBS="-L$_prefix/lib"
|
||||
;;
|
||||
--with-sqlite-prefix=*)
|
||||
_prefix=`echo $ac_option | cut -d '=' -f 2`
|
||||
SQLITE_CFLAGS="-I$_prefix/include"
|
||||
SQLITE_LIBS="-L$_prefix/lib"
|
||||
;;
|
||||
--host=*)
|
||||
_host=`echo $ac_option | cut -d '=' -f 2`
|
||||
|
@ -640,6 +651,30 @@ else
|
|||
_build_png=no
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for SQLite
|
||||
#
|
||||
echocheck "SQLite"
|
||||
if test "$_build_sqlite" = yes ; then
|
||||
_sqlite=no
|
||||
cat > $TMPC << EOF
|
||||
#include <stdio.h>
|
||||
#include <sqlite3.h>
|
||||
int main(void) { printf("%s\n", SQLITE_VERSION); }
|
||||
EOF
|
||||
cc_check $LDFLAGS $CXXFLAGS $SQLITE_CFLAGS $SQLITE_LIBS -lsqlite3 && _sqlite=yes
|
||||
|
||||
if test "$_sqlite" = yes ; then
|
||||
echo "$_sqlite"
|
||||
else
|
||||
echo "disabled"
|
||||
_build_sqlite=no
|
||||
fi
|
||||
else
|
||||
echo "disabled"
|
||||
_build_sqlite=no
|
||||
fi
|
||||
|
||||
#
|
||||
# figure out installation directories
|
||||
#
|
||||
|
@ -699,6 +734,14 @@ else
|
|||
echo
|
||||
fi
|
||||
|
||||
if test "$_build_sqlite" = yes ; then
|
||||
echo_n " SQLite enabled"
|
||||
echo
|
||||
else
|
||||
echo_n " SQLite disabled"
|
||||
echo
|
||||
fi
|
||||
|
||||
if test "$_build_windowed" = "yes" ; then
|
||||
echo_n " Windowed rendering modes enabled"
|
||||
echo
|
||||
|
@ -752,6 +795,7 @@ YACC="$SRC/yacc"
|
|||
CHEAT="$SRC/cheat"
|
||||
LIBPNG="$SRC/libpng"
|
||||
ZLIB="$SRC/zlib"
|
||||
SQLITE="$SRC/common/repository/sqlite"
|
||||
|
||||
INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI -I$TIA -I$TIA_FRAME_MANAGER"
|
||||
|
||||
|
@ -828,6 +872,13 @@ if test "$_build_png" = yes ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "$_build_sqlite" = yes; then
|
||||
DEFINES="$DEFINES -DSQLITE_SUPPORT"
|
||||
MODULES="$MODULES $SQLITE"
|
||||
INCLUDES="$INCLUDES -I$SQLITE"
|
||||
LIBS="$LIBS -lsqlite3"
|
||||
fi
|
||||
|
||||
if test "$_build_zip" = yes ; then
|
||||
DEFINES="$DEFINES -DZIP_SUPPORT"
|
||||
if test "$_zlib" = yes ; then
|
||||
|
|
|
@ -184,7 +184,7 @@ bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 FilesystemNodeZIP::read(BytePtr& image) const
|
||||
uInt32 FilesystemNodeZIP::read(ByteBuffer& image) const
|
||||
{
|
||||
switch(_error)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ class FilesystemNodeZIP : public AbstractFSNode
|
|||
bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const override;
|
||||
AbstractFSNodePtr getParent() const override;
|
||||
|
||||
uInt32 read(BytePtr& image) const override;
|
||||
uInt32 read(ByteBuffer& image) const override;
|
||||
|
||||
private:
|
||||
FilesystemNodeZIP(const string& zipfile, const string& virtualpath,
|
||||
|
|
|
@ -32,22 +32,18 @@
|
|||
#include "SettingsR77.hxx"
|
||||
#include "OSystemR77.hxx"
|
||||
#else
|
||||
#include "SettingsUNIX.hxx"
|
||||
#include "OSystemUNIX.hxx"
|
||||
#endif
|
||||
#elif defined(BSPF_WINDOWS)
|
||||
#include "SerialPortWINDOWS.hxx"
|
||||
#include "SettingsWINDOWS.hxx"
|
||||
#include "OSystemWINDOWS.hxx"
|
||||
#elif defined(BSPF_MACOS)
|
||||
#include "SerialPortMACOS.hxx"
|
||||
#include "SettingsMACOS.hxx"
|
||||
#include "OSystemMACOS.hxx"
|
||||
extern "C" {
|
||||
int stellaMain(int argc, char* argv[]);
|
||||
}
|
||||
#elif defined(__LIB_RETRO__)
|
||||
#include "SettingsLIBRETRO.hxx"
|
||||
#include "OSystemLIBRETRO.hxx"
|
||||
#else
|
||||
#error Unsupported platform!
|
||||
|
@ -112,20 +108,10 @@ class MediaFactory
|
|||
|
||||
static unique_ptr<Settings> createSettings()
|
||||
{
|
||||
#if defined(BSPF_UNIX)
|
||||
#if defined(RETRON77)
|
||||
return make_unique<SettingsR77>();
|
||||
#else
|
||||
return make_unique<SettingsUNIX>();
|
||||
#endif
|
||||
#elif defined(BSPF_WINDOWS)
|
||||
return make_unique<SettingsWINDOWS>();
|
||||
#elif defined(BSPF_MACOS)
|
||||
return make_unique<SettingsMACOS>();
|
||||
#elif defined(__LIB_RETRO__)
|
||||
return make_unique<SettingsLIBRETRO>();
|
||||
#ifdef RETRON77
|
||||
return make_unique<SettingsR77>();
|
||||
#else
|
||||
#error Unsupported platform for Settings!
|
||||
return make_unique<Settings>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ class PNGLibrary
|
|||
// The following data remains between invocations of allocateStorage,
|
||||
// and is only changed when absolutely necessary.
|
||||
struct ReadInfoType {
|
||||
BytePtr buffer;
|
||||
ByteBuffer buffer;
|
||||
unique_ptr<png_bytep[]> row_pointers;
|
||||
png_uint_32 width, height, pitch;
|
||||
uInt32 buffer_size, row_size;
|
||||
|
|
|
@ -105,7 +105,7 @@ const string& ZipHandler::next()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt64 ZipHandler::decompress(BytePtr& image)
|
||||
uInt64 ZipHandler::decompress(ByteBuffer& image)
|
||||
{
|
||||
if(myZip && myZip->myHeader.uncompressedLength > 0)
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ void ZipHandler::ZipFile::close()
|
|||
void ZipHandler::ZipFile::readEcd()
|
||||
{
|
||||
uInt64 buflen = 1024;
|
||||
BytePtr buffer;
|
||||
ByteBuffer buffer;
|
||||
|
||||
// We may need multiple tries
|
||||
while(buflen < 65536)
|
||||
|
@ -323,7 +323,7 @@ void ZipHandler::ZipFile::readEcd()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool ZipHandler::ZipFile::readStream(BytePtr& out, uInt64 offset,
|
||||
bool ZipHandler::ZipFile::readStream(ByteBuffer& out, uInt64 offset,
|
||||
uInt64 length, uInt64& actual)
|
||||
{
|
||||
try
|
||||
|
@ -367,7 +367,7 @@ const ZipHandler::ZipHeader* const ZipHandler::ZipFile::nextFile()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ZipHandler::ZipFile::decompress(BytePtr& out, uInt64 length)
|
||||
void ZipHandler::ZipFile::decompress(ByteBuffer& out, uInt64 length)
|
||||
{
|
||||
// If we don't have enough buffer, error
|
||||
if(length < myHeader.uncompressedLength)
|
||||
|
@ -434,7 +434,7 @@ uInt64 ZipHandler::ZipFile::getCompressedDataOffset()
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ZipHandler::ZipFile::decompressDataType0(
|
||||
uInt64 offset, BytePtr& out, uInt64 length)
|
||||
uInt64 offset, ByteBuffer& out, uInt64 length)
|
||||
{
|
||||
// The data is uncompressed; just read it
|
||||
uInt64 read_length = 0;
|
||||
|
@ -447,7 +447,7 @@ void ZipHandler::ZipFile::decompressDataType0(
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ZipHandler::ZipFile::decompressDataType8(
|
||||
uInt64 offset, BytePtr& out, uInt64 length)
|
||||
uInt64 offset, ByteBuffer& out, uInt64 length)
|
||||
{
|
||||
uInt64 input_remaining = myHeader.compressedLength;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class ZipHandler
|
|||
|
||||
// Decompress the currently selected file and return its length
|
||||
// An exception will be thrown on any errors
|
||||
uInt64 decompress(BytePtr& image);
|
||||
uInt64 decompress(ByteBuffer& image);
|
||||
|
||||
// Answer the number of ROM files (with a valid extension) found
|
||||
uInt16 romFiles() const { return myZip ? myZip->myRomfiles : 0; }
|
||||
|
@ -112,11 +112,11 @@ class ZipHandler
|
|||
|
||||
ZipEcd myEcd; // end of central directory
|
||||
|
||||
BytePtr myCd; // central directory raw data
|
||||
ByteBuffer myCd; // central directory raw data
|
||||
uInt64 myCdPos; // position in central directory
|
||||
ZipHeader myHeader; // current file header
|
||||
|
||||
BytePtr myBuffer; // buffer for decompression
|
||||
ByteBuffer myBuffer; // buffer for decompression
|
||||
|
||||
/** Constructor */
|
||||
explicit ZipFile(const string& filename);
|
||||
|
@ -134,22 +134,22 @@ class ZipHandler
|
|||
void readEcd();
|
||||
|
||||
/** Read data from stream */
|
||||
bool readStream(BytePtr& out, uInt64 offset, uInt64 length, uInt64& actual);
|
||||
bool readStream(ByteBuffer& out, uInt64 offset, uInt64 length, uInt64& actual);
|
||||
|
||||
/** Return the next entry in the ZIP file */
|
||||
const ZipHeader* const nextFile();
|
||||
|
||||
/** Decompress the most recently found file in the ZIP into target buffer */
|
||||
void decompress(BytePtr& out, uInt64 length);
|
||||
void decompress(ByteBuffer& out, uInt64 length);
|
||||
|
||||
/** Return the offset of the compressed data */
|
||||
uInt64 getCompressedDataOffset();
|
||||
|
||||
/** Decompress type 0 data (which is uncompressed) */
|
||||
void decompressDataType0(uInt64 offset, BytePtr& out, uInt64 length);
|
||||
void decompressDataType0(uInt64 offset, ByteBuffer& out, uInt64 length);
|
||||
|
||||
/** Decompress type 8 data (which is deflated) */
|
||||
void decompressDataType8(uInt64 offset, BytePtr& out, uInt64 length);
|
||||
void decompressDataType8(uInt64 offset, ByteBuffer& out, uInt64 length);
|
||||
};
|
||||
using ZipFilePtr = unique_ptr<ZipFile>;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ using BoolArray = std::vector<bool>;
|
|||
using ByteArray = std::vector<uInt8>;
|
||||
using ShortArray = std::vector<uInt16>;
|
||||
using StringList = std::vector<std::string>;
|
||||
using BytePtr = std::unique_ptr<uInt8[]>;
|
||||
using ByteBuffer = std::unique_ptr<uInt8[]>;
|
||||
|
||||
static const string EmptyString("");
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ MODULE_OBJS := \
|
|||
src/common/AudioSettings.o \
|
||||
src/common/FpsMeter.o \
|
||||
src/common/ThreadDebugging.o \
|
||||
src/common/StaggeredLogger.o
|
||||
src/common/StaggeredLogger.o \
|
||||
src/common/repository/KeyValueRepositoryConfigfile.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/common
|
||||
|
|
|
@ -15,10 +15,23 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "SettingsWINDOWS.hxx"
|
||||
#ifndef KEY_VALUE_REPOSITORY_HXX
|
||||
#define KEY_VALUE_REPOSITORY_HXX
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsWINDOWS::SettingsWINDOWS()
|
||||
: Settings()
|
||||
#include <map>
|
||||
|
||||
#include "Variant.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class KeyValueRepository
|
||||
{
|
||||
}
|
||||
public:
|
||||
|
||||
virtual ~KeyValueRepository() = default;
|
||||
|
||||
virtual std::map<string, Variant> load() = 0;
|
||||
|
||||
virtual void save(const std::map<string, Variant>& values) = 0;
|
||||
};
|
||||
|
||||
#endif // KEY_VALUE_REPOSITORY_HXX
|
|
@ -0,0 +1,107 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "KeyValueRepositoryConfigfile.hxx"
|
||||
|
||||
namespace {
|
||||
string trim(const string& str)
|
||||
{
|
||||
string::size_type first = str.find_first_not_of(' ');
|
||||
return (first == string::npos) ? EmptyString :
|
||||
str.substr(first, str.find_last_not_of(' ')-first+1);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const string& filename)
|
||||
: myFilename(filename)
|
||||
{}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
std::map<string, Variant> KeyValueRepositoryConfigfile::load()
|
||||
{
|
||||
std::map<string, Variant> values;
|
||||
|
||||
string line, key, value;
|
||||
string::size_type equalPos, garbage;
|
||||
|
||||
ifstream in(myFilename);
|
||||
if(!in || !in.is_open()) {
|
||||
// FIXME - make logger available everywhere
|
||||
cout << "ERROR: Couldn't load from settings file " << myFilename << endl;
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
while(getline(in, line))
|
||||
{
|
||||
// Strip all whitespace and tabs from the line
|
||||
while((garbage = line.find("\t")) != string::npos)
|
||||
line.erase(garbage, 1);
|
||||
|
||||
// Ignore commented and empty lines
|
||||
if((line.length() == 0) || (line[0] == ';'))
|
||||
continue;
|
||||
|
||||
// Search for the equal sign and discard the line if its not found
|
||||
if((equalPos = line.find("=")) == string::npos)
|
||||
continue;
|
||||
|
||||
// Split the line into key/value pairs and trim any whitespace
|
||||
key = trim(line.substr(0, equalPos));
|
||||
value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1));
|
||||
|
||||
// Skip absent key
|
||||
if(key.length() == 0)
|
||||
continue;
|
||||
|
||||
values[key] = value;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void KeyValueRepositoryConfigfile::save(const std::map<string, Variant>& values)
|
||||
{
|
||||
ofstream out(myFilename);
|
||||
if(!out || !out.is_open()) {
|
||||
// FIXME - make logger available everywhere
|
||||
cout << "ERROR: Couldn't save to settings file " << myFilename << endl;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
out << "; Stella configuration file" << endl
|
||||
<< ";" << endl
|
||||
<< "; Lines starting with ';' are comments and are ignored." << endl
|
||||
<< "; Spaces and tabs are ignored." << endl
|
||||
<< ";" << endl
|
||||
<< "; Format MUST be as follows:" << endl
|
||||
<< "; command = value" << endl
|
||||
<< ";" << endl
|
||||
<< "; Commands are the same as those specified on the commandline," << endl
|
||||
<< "; without the '-' character." << endl
|
||||
<< ";" << endl
|
||||
<< "; Values are the same as those allowed on the commandline." << endl
|
||||
<< "; Boolean values are specified as 1 (or true) and 0 (or false)" << endl
|
||||
<< ";" << endl;
|
||||
|
||||
// Write out each of the key and value pairs
|
||||
for(const auto& pair: values)
|
||||
out << pair.first << " = " << pair.second << endl;
|
||||
}
|
|
@ -15,23 +15,24 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#ifndef KEY_VALUE_REPOSITORY_CONFIGFILE_HXX
|
||||
#define KEY_VALUE_REPOSITORY_CONFIGFILE_HXX
|
||||
|
||||
void prefsSetString(const char* key, const char* value);
|
||||
void prefsGetString(const char* key, char* value, int size);
|
||||
void prefsSave(void);
|
||||
#include "KeyValueRepository.hxx"
|
||||
|
||||
/**
|
||||
Preferences class and support functions for the macOS
|
||||
SDL2 port of Stella.
|
||||
class KeyValueRepositoryConfigfile : public KeyValueRepository
|
||||
{
|
||||
public:
|
||||
|
||||
@author Mark Grebe <atarimac@cox.net>
|
||||
*/
|
||||
@interface Preferences : NSObject
|
||||
KeyValueRepositoryConfigfile(const string& filename);
|
||||
|
||||
+ (Preferences *)sharedInstance;
|
||||
- (void)setString:(const char *)key : (const char *)value;
|
||||
- (void)getString:(const char *)key : (char *)value : (int)size;
|
||||
- (void)save;
|
||||
virtual std::map<string, Variant> load();
|
||||
|
||||
@end
|
||||
virtual void save(const std::map<string, Variant>& values);
|
||||
|
||||
private:
|
||||
|
||||
const string& myFilename;
|
||||
};
|
||||
|
||||
#endif // KEY_VALUE_REPOSITORY_CONFIGFILE_HXX
|
|
@ -15,10 +15,20 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "SettingsUNIX.hxx"
|
||||
#ifndef KEY_VALUE_REPOSITORY_NOOP_HXX
|
||||
#define KEY_VALUE_REPOSITORY_NOOP_HXX
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsUNIX::SettingsUNIX()
|
||||
: Settings()
|
||||
#include "KeyValueRepository.hxx"
|
||||
|
||||
class KeyValueRepositoryNoop : public KeyValueRepository
|
||||
{
|
||||
}
|
||||
public:
|
||||
|
||||
virtual std::map<string, Variant> load() {
|
||||
return std::map<string, Variant>();
|
||||
}
|
||||
|
||||
virtual void save(const std::map<string, Variant>& values) {}
|
||||
};
|
||||
|
||||
#endif // KEY_VALUE_REPOSITORY_NOOP_HXX
|
|
@ -0,0 +1,168 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include <sqlite3.h>
|
||||
#include <cstdio>
|
||||
|
||||
#include "KeyValueRepositorySqlite.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
#ifdef BSPF_WINDOWS
|
||||
#define SEPARATOR "\"
|
||||
#else
|
||||
#define SEPARATOR "/"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
struct SqliteError {
|
||||
SqliteError(const string _message) : message(_message) {}
|
||||
|
||||
const string message;
|
||||
};
|
||||
|
||||
class Statement {
|
||||
public:
|
||||
|
||||
Statement(sqlite3* handle, string sql) : myStmt(nullptr)
|
||||
{
|
||||
if (sqlite3_prepare_v2(handle, sql.c_str(), -1, &myStmt, nullptr) != SQLITE_OK)
|
||||
throw SqliteError(sqlite3_errmsg(handle));
|
||||
}
|
||||
|
||||
~Statement()
|
||||
{
|
||||
if (myStmt) sqlite3_finalize(myStmt);
|
||||
}
|
||||
|
||||
operator sqlite3_stmt*() const { return myStmt; }
|
||||
|
||||
private:
|
||||
|
||||
sqlite3_stmt* myStmt;
|
||||
|
||||
private:
|
||||
|
||||
Statement() = delete;
|
||||
Statement(const Statement&) = delete;
|
||||
Statement(Statement&&) = delete;
|
||||
Statement& operator=(const Statement&) = delete;
|
||||
Statement& operator=(Statement&&) = delete;
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
KeyValueRepositorySqlite::KeyValueRepositorySqlite(
|
||||
const string& databaseDirectory,
|
||||
const string& databaseName
|
||||
) : myDatabaseFile(databaseDirectory + SEPARATOR + databaseName + ".sqlite3"),
|
||||
myIsFailed(false),
|
||||
myDbHandle(nullptr)
|
||||
{}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
KeyValueRepositorySqlite::~KeyValueRepositorySqlite()
|
||||
{
|
||||
if (myDbHandle) sqlite3_close(myDbHandle);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
std::map<string, Variant> KeyValueRepositorySqlite::load()
|
||||
{
|
||||
std::map<string, Variant> values;
|
||||
if (myIsFailed) return values;
|
||||
|
||||
try {
|
||||
initializeDb();
|
||||
Statement stmt(myDbHandle, "SELECT `key`, `VALUE` FROM `values`");
|
||||
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW)
|
||||
values[reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0))] =
|
||||
reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1));
|
||||
}
|
||||
catch (SqliteError err) {
|
||||
cout << "failed to load from sqlite DB " << myDatabaseFile << ": " << err.message << endl;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void KeyValueRepositorySqlite::save(const std::map<string, Variant>& values)
|
||||
{
|
||||
if (myIsFailed) return;
|
||||
|
||||
try {
|
||||
initializeDb();
|
||||
Statement stmt(myDbHandle, "INSERT OR REPLACE INTO `values` VALUES (?, ?)");
|
||||
|
||||
if (sqlite3_exec(myDbHandle, "BEGIN TRANSACTION", nullptr, nullptr, nullptr) != SQLITE_OK)
|
||||
throw SqliteError(sqlite3_errmsg(myDbHandle));
|
||||
|
||||
for (const auto& pair: values) {
|
||||
sqlite3_bind_text(stmt, 1, pair.first.c_str(), -1, SQLITE_STATIC);
|
||||
sqlite3_bind_text(stmt, 2, pair.second.toCString(), -1, SQLITE_STATIC);
|
||||
sqlite3_step(stmt);
|
||||
|
||||
if (sqlite3_reset(stmt) != SQLITE_OK) throw SqliteError(sqlite3_errmsg(myDbHandle));
|
||||
}
|
||||
|
||||
if (sqlite3_exec(myDbHandle, "COMMIT", nullptr, nullptr, nullptr) != SQLITE_OK)
|
||||
throw SqliteError(sqlite3_errmsg(myDbHandle));
|
||||
}
|
||||
catch (SqliteError err) {
|
||||
cout << "failed to write to sqlite DB " << myDatabaseFile << ": " << err.message << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void KeyValueRepositorySqlite::initializeDb()
|
||||
{
|
||||
if (myIsFailed || myDbHandle) return;
|
||||
|
||||
bool dbInitialized = false;
|
||||
|
||||
for (int tries = 1; tries < 3 && !dbInitialized; tries++) {
|
||||
dbInitialized = (sqlite3_open(myDatabaseFile.c_str(), &myDbHandle) == SQLITE_OK);
|
||||
|
||||
dbInitialized = dbInitialized && (sqlite3_exec(
|
||||
myDbHandle,
|
||||
"CREATE TABLE IF NOT EXISTS `values` (`key` TEXT PRIMARY KEY, `value` TEXT) WITHOUT ROWID",
|
||||
nullptr, nullptr, nullptr
|
||||
) == SQLITE_OK);
|
||||
|
||||
if (!dbInitialized && tries == 1) {
|
||||
cout << "sqlite DB " << myDatabaseFile << " seems to be corrupt, removing and retrying..." << endl;
|
||||
|
||||
remove(myDatabaseFile.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
myIsFailed = !dbInitialized;
|
||||
|
||||
if (myIsFailed) {
|
||||
if (myDbHandle) {
|
||||
string emsg = sqlite3_errmsg(myDbHandle);
|
||||
|
||||
sqlite3_close(myDbHandle);
|
||||
myDbHandle = nullptr;
|
||||
|
||||
throw SqliteError(emsg);
|
||||
}
|
||||
|
||||
throw SqliteError("unable to initialize sqlite DB " + myDatabaseFile);
|
||||
};
|
||||
}
|
|
@ -15,28 +15,37 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_WINDOWS_HXX
|
||||
#define SETTINGS_WINDOWS_HXX
|
||||
#ifndef KEY_VALUE_REPOSITORY_SQLITE_HXX
|
||||
#define KEY_VALUE_REPOSITORY_SQLITE_HXX
|
||||
|
||||
class OSystem;
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include "Settings.hxx"
|
||||
#include "repository/KeyValueRepository.hxx"
|
||||
|
||||
class SettingsWINDOWS : public Settings
|
||||
class KeyValueRepositorySqlite : public KeyValueRepository
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create a new UNIX settings object
|
||||
*/
|
||||
explicit SettingsWINDOWS();
|
||||
virtual ~SettingsWINDOWS() = default;
|
||||
|
||||
KeyValueRepositorySqlite(const string& databaseDirectory, const string& databaseName);
|
||||
|
||||
~KeyValueRepositorySqlite();
|
||||
|
||||
virtual std::map<string, Variant> load();
|
||||
|
||||
virtual void save(const std::map<string, Variant>& values);
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
SettingsWINDOWS(const SettingsWINDOWS&) = delete;
|
||||
SettingsWINDOWS(SettingsWINDOWS&&) = delete;
|
||||
SettingsWINDOWS& operator=(const SettingsWINDOWS&) = delete;
|
||||
SettingsWINDOWS& operator=(SettingsWINDOWS&&) = delete;
|
||||
|
||||
void initializeDb();
|
||||
|
||||
private:
|
||||
|
||||
string myDatabaseFile;
|
||||
|
||||
bool myIsFailed;
|
||||
|
||||
sqlite3* myDbHandle;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // KEY_VALUE_REPOSITORY_SQLITE_HXX
|
|
@ -0,0 +1,10 @@
|
|||
MODULE := src/common/repository/sqlite
|
||||
|
||||
MODULE_OBJS := \
|
||||
src/common/repository/sqlite/KeyValueRepositorySqlite.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/common/repository/sqlite
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/common.rules
|
|
@ -302,7 +302,7 @@ class Cartridge : public Device
|
|||
|
||||
// The array containing information about every byte of ROM indicating
|
||||
// whether it is used as code.
|
||||
BytePtr myCodeAccessBase;
|
||||
ByteBuffer myCodeAccessBase;
|
||||
|
||||
private:
|
||||
// The startup bank to use (where to look for the reset vector address)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "Cart0840.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge0840::Cartridge0840(const BytePtr& image, uInt32 size,
|
||||
Cartridge0840::Cartridge0840(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge0840(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge0840() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "Cart2K.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge2K::Cartridge2K(const BytePtr& image, uInt32 size,
|
||||
Cartridge2K::Cartridge2K(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5)
|
||||
{
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge2K(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge2K() = default;
|
||||
|
||||
|
@ -127,7 +127,7 @@ class Cartridge2K : public Cartridge
|
|||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
|
||||
// Size of the ROM image
|
||||
uInt32 mySize;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "Cart3E.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge3E::Cartridge3E(const BytePtr& image, uInt32 size,
|
||||
Cartridge3E::Cartridge3E(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge3E(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge3E() = default;
|
||||
|
||||
|
@ -180,7 +180,7 @@ class Cartridge3E : public Cartridge
|
|||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
|
||||
// RAM contents. For now every ROM gets all 32K of potential RAM
|
||||
uInt8 myRAM[32 * 1024];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "Cart3EPlus.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge3EPlus::Cartridge3EPlus(const BytePtr& image, uInt32 size,
|
||||
Cartridge3EPlus::Cartridge3EPlus(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge3EPlus(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge3EPlus() = default;
|
||||
|
||||
|
@ -178,7 +178,7 @@ class Cartridge3EPlus: public Cartridge
|
|||
|
||||
static constexpr uInt16 RAM_WRITE_OFFSET = 0x200;
|
||||
|
||||
BytePtr myImage; // Pointer to a dynamically allocated ROM image of the cartridge
|
||||
ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge
|
||||
uInt32 mySize; // Size of the ROM image
|
||||
uInt8 myRAM[RAM_TOTAL_SIZE];
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "Cart3F.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge3F::Cartridge3F(const BytePtr& image, uInt32 size,
|
||||
Cartridge3F::Cartridge3F(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge3F(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge3F() = default;
|
||||
|
||||
|
@ -157,7 +157,7 @@ class Cartridge3F : public Cartridge
|
|||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
|
||||
// Size of the ROM image
|
||||
uInt32 mySize;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "Cart4A50.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge4A50::Cartridge4A50(const BytePtr& image, uInt32 size,
|
||||
Cartridge4A50::Cartridge4A50(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge4A50(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge4A50() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "Cart4K.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge4K::Cartridge4K(const BytePtr& image, uInt32 size,
|
||||
Cartridge4K::Cartridge4K(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5)
|
||||
{
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge4K(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge4K() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "Cart4KSC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Cartridge4KSC::Cartridge4KSC(const BytePtr& image, uInt32 size,
|
||||
Cartridge4KSC::Cartridge4KSC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5)
|
||||
{
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
Cartridge4KSC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~Cartridge4KSC() = default;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "CartAR.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeAR::CartridgeAR(const BytePtr& image, uInt32 size,
|
||||
CartridgeAR::CartridgeAR(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(std::max(size, 8448u)),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeAR(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeAR() = default;
|
||||
|
||||
|
@ -197,7 +197,7 @@ class CartridgeAR : public Cartridge
|
|||
uInt32 mySize;
|
||||
|
||||
// All of the 8448 byte loads associated with the game
|
||||
BytePtr myLoadImages;
|
||||
ByteBuffer myLoadImages;
|
||||
|
||||
// Indicates how many 8448 loads there are
|
||||
uInt8 myNumberOfLoadImages;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartBF.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeBF::CartridgeBF(const BytePtr& image, uInt32 size,
|
||||
CartridgeBF::CartridgeBF(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeBF(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeBF() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartBFSC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeBFSC::CartridgeBFSC(const BytePtr& image, uInt32 size,
|
||||
CartridgeBFSC::CartridgeBFSC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeBFSC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeBFSC() = default;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#define DIGITAL_AUDIO_ON ((myMode & 0xF0) == 0)
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size,
|
||||
CartridgeBUS::CartridgeBUS(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myAudioCycles(0),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeBUS(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeBUS() = default;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace {
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
|
||||
CartridgeCDF::CartridgeCDF(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myAudioCycles(0),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeCDF(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeCDF() = default;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "CartCM.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeCM::CartridgeCM(const BytePtr& image, uInt32 size,
|
||||
CartridgeCM::CartridgeCM(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySWCHA(0xFF), // portA is all 1's
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeCM(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeCM() = default;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "CartCTY.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeCTY::CartridgeCTY(const BytePtr& image, uInt32 size,
|
||||
CartridgeCTY::CartridgeCTY(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myOperationType(0),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeCTY(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeCTY() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartCV.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeCV::CartridgeCV(const BytePtr& image, uInt32 size,
|
||||
CartridgeCV::CartridgeCV(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeCV(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeCV() = default;
|
||||
|
||||
|
@ -138,7 +138,7 @@ class CartridgeCV : public Cartridge
|
|||
private:
|
||||
// Pointer to the initial RAM data from the cart
|
||||
// This doesn't always exist, so we don't pre-allocate it
|
||||
BytePtr myInitialRAM;
|
||||
ByteBuffer myInitialRAM;
|
||||
|
||||
// Initial size of the cart data
|
||||
uInt32 mySize;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "CartCVPlus.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeCVPlus::CartridgeCVPlus(const BytePtr& image, uInt32 size,
|
||||
CartridgeCVPlus::CartridgeCVPlus(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeCVPlus(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeCVPlus() = default;
|
||||
|
||||
|
@ -163,7 +163,7 @@ class CartridgeCVPlus : public Cartridge
|
|||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
|
||||
// The 1024 bytes of RAM
|
||||
uInt8 myRAM[1024];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "CartDASH.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDASH::CartridgeDASH(const BytePtr& image, uInt32 size,
|
||||
CartridgeDASH::CartridgeDASH(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeDASH(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeDASH() = default;
|
||||
|
||||
|
@ -261,7 +261,7 @@ class CartridgeDASH: public Cartridge
|
|||
|
||||
static constexpr uInt16 RAM_WRITE_OFFSET = 0x800;
|
||||
|
||||
BytePtr myImage; // Pointer to a dynamically allocated ROM image of the cartridge
|
||||
ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge
|
||||
uInt32 mySize; // Size of the ROM image
|
||||
uInt8 myRAM[RAM_TOTAL_SIZE];
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartDF.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDF::CartridgeDF(const BytePtr& image, uInt32 size,
|
||||
CartridgeDF::CartridgeDF(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeDF(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeDF() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartDFSC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDFSC::CartridgeDFSC(const BytePtr& image, uInt32 size,
|
||||
CartridgeDFSC::CartridgeDFSC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeDFSC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeDFSC() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartDPC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDPC::CartridgeDPC(const BytePtr& image, uInt32 size,
|
||||
CartridgeDPC::CartridgeDPC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeDPC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeDPC() = default;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "exception/FatalEmulationError.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size,
|
||||
CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(std::min(size, 32768u)),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeDPCPlus(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeDPCPlus() = default;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unique_ptr<Cartridge> CartDetector::create(const FilesystemNode& file,
|
||||
const BytePtr& image, uInt32 size, string& md5,
|
||||
const ByteBuffer& image, uInt32 size, string& md5,
|
||||
const string& propertiesType, Settings& settings)
|
||||
{
|
||||
unique_ptr<Cartridge> cartridge;
|
||||
|
@ -210,13 +210,13 @@ unique_ptr<Cartridge> CartDetector::create(const FilesystemNode& file,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unique_ptr<Cartridge>
|
||||
CartDetector::createFromMultiCart(const BytePtr& image, uInt32& size,
|
||||
CartDetector::createFromMultiCart(const ByteBuffer& image, uInt32& 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;
|
||||
BytePtr slice = make_unique<uInt8[]>(size);
|
||||
ByteBuffer slice = make_unique<uInt8[]>(size);
|
||||
memcpy(slice.get(), image.get()+i*size, size);
|
||||
|
||||
// We need a new md5 and name
|
||||
|
@ -238,7 +238,7 @@ CartDetector::createFromMultiCart(const BytePtr& image, uInt32& size,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unique_ptr<Cartridge>
|
||||
CartDetector::createFromImage(const BytePtr& image, uInt32 size, Bankswitch::Type type,
|
||||
CartDetector::createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type,
|
||||
const string& md5, Settings& settings)
|
||||
{
|
||||
// We should know the cart's type by now so let's create it
|
||||
|
@ -334,7 +334,7 @@ CartDetector::createFromImage(const BytePtr& image, uInt32 size, Bankswitch::Typ
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Bankswitch::Type CartDetector::autodetectType(const BytePtr& image, uInt32 size)
|
||||
Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// Guess type based on size
|
||||
Bankswitch::Type type = Bankswitch::Type::_AUTO;
|
||||
|
@ -551,7 +551,7 @@ bool CartDetector::searchForBytes(const uInt8* image, uInt32 imagesize,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablySC(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablySC(const ByteBuffer& image, uInt32 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
|
||||
|
@ -568,7 +568,7 @@ bool CartDetector::isProbablySC(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyARM(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyARM(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// ARM code contains the following 'loader' patterns in the first 1K
|
||||
// Thanks to Thomas Jentzsch of AtariAge for this advice
|
||||
|
@ -583,7 +583,7 @@ bool CartDetector::isProbablyARM(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbably0840(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbably0840(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// 0840 cart bankswitching is triggered by accessing addresses 0x0800
|
||||
// or 0x0840 at least twice
|
||||
|
@ -608,7 +608,7 @@ bool CartDetector::isProbably0840(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbably3E(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbably3E(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// 3E cart bankswitching is triggered by storing the bank number
|
||||
// in address 3E using 'STA $3E', commonly followed by an
|
||||
|
@ -618,7 +618,7 @@ bool CartDetector::isProbably3E(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbably3EPlus(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbably3EPlus(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// 3E+ cart is identified key 'TJ3E' in the ROM
|
||||
uInt8 tj3e[] = { 'T', 'J', '3', 'E' };
|
||||
|
@ -626,7 +626,7 @@ bool CartDetector::isProbably3EPlus(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbably3F(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbably3F(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// 3F cart bankswitching is triggered by storing the bank number
|
||||
// in address 3F using 'STA $3F'
|
||||
|
@ -637,7 +637,7 @@ bool CartDetector::isProbably3F(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbably4A50(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbably4A50(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// 4A50 carts store address $4A50 at the NMI vector, which
|
||||
// in this scheme is always in the last page of ROM at
|
||||
|
@ -655,7 +655,7 @@ bool CartDetector::isProbably4A50(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbably4KSC(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbably4KSC(const ByteBuffer& image, uInt32 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.
|
||||
|
@ -672,7 +672,7 @@ bool CartDetector::isProbably4KSC(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyBF(const BytePtr& image, uInt32 size,
|
||||
bool CartDetector::isProbablyBF(const ByteBuffer& image, uInt32 size,
|
||||
Bankswitch::Type& type)
|
||||
{
|
||||
// BF carts store strings 'BFBF' and 'BFSC' starting at address $FFF8
|
||||
|
@ -694,7 +694,7 @@ bool CartDetector::isProbablyBF(const BytePtr& image, uInt32 size,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyBUS(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyBUS(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// BUS ARM code has 2 occurrences of the string BUS
|
||||
// Note: all Harmony/Melody custom drivers also contain the value
|
||||
|
@ -704,7 +704,7 @@ bool CartDetector::isProbablyBUS(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyCDF(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyCDF(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// CDF ARM code has 3 occurrences of the string CDF
|
||||
// Note: all Harmony/Melody custom drivers also contain the value
|
||||
|
@ -714,14 +714,14 @@ bool CartDetector::isProbablyCDF(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyCTY(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyCTY(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
uInt8 lenin[] = { 'L', 'E', 'N', 'I', 'N' };
|
||||
return searchForBytes(image.get(), size, lenin, 5, 1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyCV(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyCV(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// CV RAM access occurs at addresses $f3ff and $f400
|
||||
// These signatures are attributed to the MESS project
|
||||
|
@ -736,7 +736,7 @@ bool CartDetector::isProbablyCV(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyCVPlus(const BytePtr& image, uInt32)
|
||||
bool CartDetector::isProbablyCVPlus(const ByteBuffer& image, uInt32)
|
||||
{
|
||||
// CV+ cart is identified key 'commavidplus' @ $04 in the ROM
|
||||
// We inspect only this area to speed up the search
|
||||
|
@ -746,7 +746,7 @@ bool CartDetector::isProbablyCVPlus(const BytePtr& image, uInt32)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyDASH(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyDASH(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// DASH cart is identified key 'TJAD' in the ROM
|
||||
uInt8 tjad[] = { 'T', 'J', 'A', 'D' };
|
||||
|
@ -754,7 +754,7 @@ bool CartDetector::isProbablyDASH(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyDF(const BytePtr& image, uInt32 size,
|
||||
bool CartDetector::isProbablyDF(const ByteBuffer& image, uInt32 size,
|
||||
Bankswitch::Type& type)
|
||||
{
|
||||
|
||||
|
@ -777,7 +777,7 @@ bool CartDetector::isProbablyDF(const BytePtr& image, uInt32 size,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyDPCplus(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyDPCplus(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// DPC+ ARM code has 2 occurrences of the string DPC+
|
||||
// Note: all Harmony/Melody custom drivers also contain the value
|
||||
|
@ -787,7 +787,7 @@ bool CartDetector::isProbablyDPCplus(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyE0(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyE0(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// E0 cart bankswitching is triggered by accessing addresses
|
||||
// $FE0 to $FF9 using absolute non-indexed addressing
|
||||
|
@ -813,7 +813,7 @@ bool CartDetector::isProbablyE0(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyE7(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyE7(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// E7 cart bankswitching is triggered by accessing addresses
|
||||
// $FE0 to $FE6 using absolute non-indexed addressing
|
||||
|
@ -838,7 +838,7 @@ bool CartDetector::isProbablyE7(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyE78K(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyE78K(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// E78K cart bankswitching is triggered by accessing addresses
|
||||
// $FE4 to $FE6 using absolute non-indexed addressing
|
||||
|
@ -857,7 +857,7 @@ bool CartDetector::isProbablyE78K(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyEF(const BytePtr& image, uInt32 size,
|
||||
bool CartDetector::isProbablyEF(const ByteBuffer& image, uInt32 size,
|
||||
Bankswitch::Type& type)
|
||||
{
|
||||
// Newer EF carts store strings 'EFEF' and 'EFSC' starting at address $FFF8
|
||||
|
@ -906,7 +906,7 @@ bool CartDetector::isProbablyEF(const BytePtr& image, uInt32 size,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyFA2(const BytePtr& image, uInt32)
|
||||
bool CartDetector::isProbablyFA2(const ByteBuffer& image, uInt32)
|
||||
{
|
||||
// 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
|
||||
|
@ -921,7 +921,7 @@ bool CartDetector::isProbablyFA2(const BytePtr& image, uInt32)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyFE(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyFE(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// FE bankswitching is very weird, but always seems to include a
|
||||
// 'JSR $xxxx'
|
||||
|
@ -940,7 +940,7 @@ bool CartDetector::isProbablyFE(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyMDM(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyMDM(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// MDM cart is identified key 'MDMC' in the first 8K of ROM
|
||||
uInt8 mdmc[] = { 'M', 'D', 'M', 'C' };
|
||||
|
@ -948,7 +948,7 @@ bool CartDetector::isProbablyMDM(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablySB(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablySB(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// SB cart bankswitching switches banks by accessing address 0x0800
|
||||
uInt8 signature[2][3] = {
|
||||
|
@ -962,7 +962,7 @@ bool CartDetector::isProbablySB(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyUA(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyUA(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// UA cart bankswitching switches to bank 1 by accessing address 0x240
|
||||
// using 'STA $240' or 'LDA $240'
|
||||
|
@ -979,7 +979,7 @@ bool CartDetector::isProbablyUA(const BytePtr& image, uInt32 size)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyX07(const BytePtr& image, uInt32 size)
|
||||
bool CartDetector::isProbablyX07(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// X07 bankswitching switches to bank 0, 1, 2, etc by accessing address 0x08xd
|
||||
uInt8 signature[6][3] = {
|
||||
|
|
|
@ -46,7 +46,7 @@ class CartDetector
|
|||
@return Pointer to the new cartridge object allocated on the heap
|
||||
*/
|
||||
static unique_ptr<Cartridge> create(const FilesystemNode& file,
|
||||
const BytePtr& image, uInt32 size, string& md5,
|
||||
const ByteBuffer& image, uInt32 size, string& md5,
|
||||
const string& dtype, Settings& settings);
|
||||
|
||||
private:
|
||||
|
@ -65,7 +65,7 @@ class CartDetector
|
|||
@return Pointer to the new cartridge object allocated on the heap
|
||||
*/
|
||||
static unique_ptr<Cartridge>
|
||||
createFromMultiCart(const BytePtr& image, uInt32& size,
|
||||
createFromMultiCart(const ByteBuffer& image, uInt32& size,
|
||||
uInt32 numroms, string& md5, Bankswitch::Type type, string& id,
|
||||
Settings& settings);
|
||||
|
||||
|
@ -81,7 +81,7 @@ class CartDetector
|
|||
@return Pointer to the new cartridge object allocated on the heap
|
||||
*/
|
||||
static unique_ptr<Cartridge>
|
||||
createFromImage(const BytePtr& image, uInt32 size, Bankswitch::Type type,
|
||||
createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type,
|
||||
const string& md5, Settings& settings);
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ class CartDetector
|
|||
|
||||
@return The "best guess" for the cartridge type
|
||||
*/
|
||||
static Bankswitch::Type autodetectType(const BytePtr& image, uInt32 size);
|
||||
static Bankswitch::Type autodetectType(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Search the image for the specified byte signature
|
||||
|
@ -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 BytePtr& image, uInt32 size);
|
||||
static bool isProbablySC(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image probably contains ARM code in the first 1K
|
||||
*/
|
||||
static bool isProbablyARM(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyARM(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 0840 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbably0840(const BytePtr& image, uInt32 size);
|
||||
static bool isProbably0840(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 3E bankswitching cartridge
|
||||
*/
|
||||
static bool isProbably3E(const BytePtr& image, uInt32 size);
|
||||
static bool isProbably3E(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 3E+ bankswitching cartridge
|
||||
*/
|
||||
static bool isProbably3EPlus(const BytePtr& image, uInt32 size);
|
||||
static bool isProbably3EPlus(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 3F bankswitching cartridge
|
||||
*/
|
||||
static bool isProbably3F(const BytePtr& image, uInt32 size);
|
||||
static bool isProbably3F(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 4A50 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbably4A50(const BytePtr& image, uInt32 size);
|
||||
static bool isProbably4A50(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 4K SuperChip (128 bytes RAM)
|
||||
*/
|
||||
static bool isProbably4KSC(const BytePtr& image, uInt32 size);
|
||||
static bool isProbably4KSC(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a BF/BFSC bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyBF(const BytePtr& image, uInt32 size, Bankswitch::Type& type);
|
||||
static bool isProbablyBF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a BUS bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyBUS(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyBUS(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a CDF bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyCDF(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyCDF(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a CTY bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyCTY(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyCTY(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a CV bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyCV(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyCV(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a CV+ bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyCVPlus(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyCVPlus(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a DASH bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyDASH(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyDASH(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a DF/DFSC bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyDF(const BytePtr& image, uInt32 size, Bankswitch::Type& type);
|
||||
static bool isProbablyDF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a DPC+ bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyDPCplus(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyDPCplus(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a E0 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyE0(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyE0(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a E7 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyE7(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyE7(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a E78K bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyE78K(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyE78K(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an EF/EFSC bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyEF(const BytePtr& image, uInt32 size, Bankswitch::Type& type);
|
||||
static bool isProbablyEF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an F6 bankswitching cartridge
|
||||
*/
|
||||
//static bool isProbablyF6(const BytePtr& image, uInt32 size);
|
||||
//static bool isProbablyF6(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an FA2 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyFA2(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyFA2(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an FE bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyFE(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyFE(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a MDM bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyMDM(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyMDM(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a SB bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablySB(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablySB(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a UA bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyUA(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyUA(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an X07 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyX07(const BytePtr& image, uInt32 size);
|
||||
static bool isProbablyX07(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartE0.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeE0::CartridgeE0(const BytePtr& image, uInt32 size,
|
||||
CartridgeE0::CartridgeE0(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5)
|
||||
{
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeE0(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeE0() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartE7.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeE7::CartridgeE7(const BytePtr& image, uInt32 size,
|
||||
CartridgeE7::CartridgeE7(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: CartridgeMNetwork(image, size, md5, settings)
|
||||
{
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeE7(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeE7() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartE78K.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeE78K::CartridgeE78K(const BytePtr& image, uInt32 size,
|
||||
CartridgeE78K::CartridgeE78K(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: CartridgeMNetwork(image, size, md5, settings)
|
||||
{
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeE78K(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeE78K() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartEF.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeEF::CartridgeEF(const BytePtr& image, uInt32 size,
|
||||
CartridgeEF::CartridgeEF(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeEF(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeEF() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartEFSC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeEFSC::CartridgeEFSC(const BytePtr& image, uInt32 size,
|
||||
CartridgeEFSC::CartridgeEFSC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeEFSC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeEFSC() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartF0.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF0::CartridgeF0(const BytePtr& image, uInt32 size,
|
||||
CartridgeF0::CartridgeF0(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF0(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF0() = default;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "CartF4.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF4::CartridgeF4(const BytePtr& image, uInt32 size,
|
||||
CartridgeF4::CartridgeF4(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF4(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF4() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartF4SC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF4SC::CartridgeF4SC(const BytePtr& image, uInt32 size,
|
||||
CartridgeF4SC::CartridgeF4SC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF4SC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF4SC() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartF6.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF6::CartridgeF6(const BytePtr& image, uInt32 size,
|
||||
CartridgeF6::CartridgeF6(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF6(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF6() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartF6SC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF6SC::CartridgeF6SC(const BytePtr& image, uInt32 size,
|
||||
CartridgeF6SC::CartridgeF6SC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF6SC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF6SC() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartF8.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF8::CartridgeF8(const BytePtr& image, uInt32 size,
|
||||
CartridgeF8::CartridgeF8(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF8(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF8() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartF8SC.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeF8SC::CartridgeF8SC(const BytePtr& image, uInt32 size,
|
||||
CartridgeF8SC::CartridgeF8SC(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeF8SC(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeF8SC() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartFA.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeFA::CartridgeFA(const BytePtr& image, uInt32 size,
|
||||
CartridgeFA::CartridgeFA(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeFA(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeFA() = default;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "CartFA2.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeFA2::CartridgeFA2(const BytePtr& image, uInt32 size,
|
||||
CartridgeFA2::CartridgeFA2(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(28 * 1024),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeFA2(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeFA2() = default;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "CartFE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeFE::CartridgeFE(const BytePtr& image, uInt32 size,
|
||||
CartridgeFE::CartridgeFE(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeFE(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeFE() = default;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartMDM.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeMDM::CartridgeMDM(const BytePtr& image, uInt32 size,
|
||||
CartridgeMDM::CartridgeMDM(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeMDM(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeMDM() = default;
|
||||
|
||||
|
@ -163,7 +163,7 @@ class CartridgeMDM : public Cartridge
|
|||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
|
||||
// Size of the ROM image
|
||||
uInt32 mySize;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartMNetwork.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeMNetwork::CartridgeMNetwork(const BytePtr& image, uInt32 size,
|
||||
CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
@ -29,7 +29,7 @@ CartridgeMNetwork::CartridgeMNetwork(const BytePtr& image, uInt32 size,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeMNetwork::initialize(const BytePtr& image, uInt32 size)
|
||||
void CartridgeMNetwork::initialize(const ByteBuffer& image, uInt32 size)
|
||||
{
|
||||
// Allocate array for the ROM image
|
||||
myImage = make_unique<uInt8[]>(size);
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeMNetwork(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeMNetwork() = default;
|
||||
|
||||
|
@ -162,7 +162,7 @@ class CartridgeMNetwork : public Cartridge
|
|||
/**
|
||||
Class initialization
|
||||
*/
|
||||
void initialize(const BytePtr& image, uInt32 size);
|
||||
void initialize(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Install pages for the specified 256 byte bank of RAM
|
||||
|
@ -195,7 +195,7 @@ class CartridgeMNetwork : public Cartridge
|
|||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
// The 16K ROM image of the cartridge (works for E78K too)
|
||||
//uInt8 myImage[BANK_SIZE * 8];
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartSB.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeSB::CartridgeSB(const BytePtr& image, uInt32 size,
|
||||
CartridgeSB::CartridgeSB(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize(size),
|
||||
|
|
|
@ -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 BytePtr& image, uInt32 size, const string& md5,
|
||||
CartridgeSB(const ByteBuffer& image, uInt32 size, const string& md5,
|
||||
const Settings& settings);
|
||||
virtual ~CartridgeSB() = default;
|
||||
|
||||
|
@ -152,7 +152,7 @@ class CartridgeSB : public Cartridge
|
|||
|
||||
private:
|
||||
// The 128-256K ROM image and size of the cartridge
|
||||
BytePtr myImage;
|
||||
ByteBuffer myImage;
|
||||
uInt32 mySize;
|
||||
|
||||
// Indicates the offset into the ROM image (aligns to current bank)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CartUA.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeUA::CartridgeUA(const BytePtr& image, uInt32 size,
|
||||
CartridgeUA::CartridgeUA(const ByteBuffer& image, uInt32 size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
myBankOffset(0)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue