Convert BSPF C-style macros to C++ namespace equivalent.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3302 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-04-02 23:47:46 +00:00
parent f431e3e3a5
commit eb56efc3d5
86 changed files with 288 additions and 285 deletions

View File

@ -65,32 +65,32 @@ string Base::toString(int value, Common::Base::Format outputBase)
case Base::F_10: // base 10: 3 or 5 bytes (depending on value)
if(value < 0x100)
BSPF_snprintf(vToS_buf, 4, "%3d", value);
BSPF::snprintf(vToS_buf, 4, "%3d", value);
else
BSPF_snprintf(vToS_buf, 6, "%5d", value);
BSPF::snprintf(vToS_buf, 6, "%5d", value);
break;
case Base::F_16_1: // base 16: 1 byte wide
BSPF_snprintf(vToS_buf, 2, myFmt[0], value);
BSPF::snprintf(vToS_buf, 2, myFmt[0], value);
break;
case Base::F_16_2: // base 16: 2 bytes wide
BSPF_snprintf(vToS_buf, 3, myFmt[1], value);
BSPF::snprintf(vToS_buf, 3, myFmt[1], value);
break;
case Base::F_16_4: // base 16: 4 bytes wide
BSPF_snprintf(vToS_buf, 5, myFmt[2], value);
BSPF::snprintf(vToS_buf, 5, myFmt[2], value);
break;
case Base::F_16_8: // base 16: 8 bytes wide
BSPF_snprintf(vToS_buf, 9, myFmt[3], value);
BSPF::snprintf(vToS_buf, 9, myFmt[3], value);
break;
case Base::F_16: // base 16: 2, 4, 8 bytes (depending on value)
default:
if(value < 0x100)
BSPF_snprintf(vToS_buf, 3, myFmt[1], value);
BSPF::snprintf(vToS_buf, 3, myFmt[1], value);
else if(value < 0x10000)
BSPF_snprintf(vToS_buf, 5, myFmt[2], value);
BSPF::snprintf(vToS_buf, 5, myFmt[2], value);
else
BSPF_snprintf(vToS_buf, 9, myFmt[3], value);
BSPF::snprintf(vToS_buf, 9, myFmt[3], value);
break;
}

View File

@ -202,7 +202,7 @@ EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx)
// havoc with the idea that a joystick will always have the same name.
// So we truncate the number.
const char* sdlname = SDL_JoystickName(myStick);
const string& desc = BSPF_startsWithIgnoreCase(sdlname, "XInput Controller")
const string& desc = BSPF::startsWithIgnoreCase(sdlname, "XInput Controller")
? "XInput Controller" : sdlname;
initialize(SDL_JoystickInstanceID(myStick), desc,

View File

@ -45,13 +45,13 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
// Is this a valid file?
auto isFile = [](const string& file)
{
return BSPF_endsWithIgnoreCase(file, ".a26") ||
BSPF_endsWithIgnoreCase(file, ".bin") ||
BSPF_endsWithIgnoreCase(file, ".rom");
return BSPF::endsWithIgnoreCase(file, ".a26") ||
BSPF::endsWithIgnoreCase(file, ".bin") ||
BSPF::endsWithIgnoreCase(file, ".rom");
};
// Extract ZIP file and virtual file (if specified)
size_t pos = BSPF_findIgnoreCase(p, ".zip");
size_t pos = BSPF::findIgnoreCase(p, ".zip");
if(pos == string::npos)
return;
@ -154,7 +154,7 @@ bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode,
{
// Only consider entries that start with '_virtualPath'
const string& next = zip.next();
if(BSPF_startsWithIgnoreCase(next, _virtualPath))
if(BSPF::startsWithIgnoreCase(next, _virtualPath))
{
// First strip off the leading directory
const string& curr = next.substr(_virtualPath == "" ? 0 : _virtualPath.size()+1);

View File

@ -35,12 +35,12 @@ MouseControl::MouseControl(Console& console, const string& mode)
string m_mode;
m_axis >> m_mode;
if(BSPF_equalsIgnoreCase(m_mode, "none"))
if(BSPF::equalsIgnoreCase(m_mode, "none"))
{
myModeList.push_back(MouseMode("Mouse input is disabled"));
return;
}
else if(!BSPF_equalsIgnoreCase(m_mode, "auto") && m_mode.length() == 2 &&
else if(!BSPF::equalsIgnoreCase(m_mode, "auto") && m_mode.length() == 2 &&
m_mode[0] >= '0' && m_mode[0] <= '8' &&
m_mode[1] >= '0' && m_mode[1] <= '8')
{
@ -148,7 +148,7 @@ MouseControl::MouseControl(Console& console, const string& mode)
// Now consider the possible modes for the mouse based on the left
// and right controllers
bool noswap = BSPF_equalsIgnoreCase(myProps.get(Console_SwapPorts), "NO");
bool noswap = BSPF::equalsIgnoreCase(myProps.get(Console_SwapPorts), "NO");
if(noswap)
{
addLeftControllerModes(noswap);
@ -243,7 +243,7 @@ void MouseControl::addPaddleModes(int lport, int rport, int lname, int rname)
msg << "Mouse is Paddle " << rname << " controller";
MouseMode mode1(type, rport, type, rport, msg.str());
if(BSPF_equalsIgnoreCase(myProps.get(Controller_SwapPaddles), "NO"))
if(BSPF::equalsIgnoreCase(myProps.get(Controller_SwapPaddles), "NO"))
{
myModeList.push_back(mode0);
myModeList.push_back(mode1);

View File

@ -76,7 +76,7 @@ string ZipHandler::next()
// Ignore zero-length files and '__MACOSX' virtual directories
valid = header && (header->uncompressed_length > 0) &&
!BSPF_startsWithIgnoreCase(header->filename, "__MACOSX");
!BSPF::startsWithIgnoreCase(header->filename, "__MACOSX");
}
while(!valid && myZip->cd_pos < myZip->ecd.cd_size);
@ -266,9 +266,9 @@ ZipHandler::zip_error ZipHandler::zip_file_open(const char* filename, zip_file**
while(hasNext())
{
const std::string& file = next();
if(BSPF_endsWithIgnoreCase(file, ".a26") ||
BSPF_endsWithIgnoreCase(file, ".bin") ||
BSPF_endsWithIgnoreCase(file, ".rom"))
if(BSPF::endsWithIgnoreCase(file, ".a26") ||
BSPF::endsWithIgnoreCase(file, ".bin") ||
BSPF::endsWithIgnoreCase(file, ".rom"))
(*zip)->romfiles++;
}
@ -616,7 +616,7 @@ ZipHandler::zip_error
{
// Read in the next chunk of data
bool success = stream_read(zip->file, zip->buffer, offset,
BSPF_min(input_remaining, (uInt32)sizeof(zip->buffer)),
BSPF::min(input_remaining, (uInt32)sizeof(zip->buffer)),
read_length);
if(!success)
{

View File

@ -65,11 +65,15 @@ using ByteArray = vector<uInt8>;
using StringList = vector<string>;
using BytePtr = unique_ptr<uInt8[]>;
static const string EmptyString("");
namespace BSPF
{
// Defines to help with path handling
#if defined(BSPF_UNIX) || defined(BSPF_MAC_OSX)
#define BSPF_PATH_SEPARATOR "/"
static const string PATH_SEPARATOR = "/";
#elif defined(BSPF_WINDOWS)
#define BSPF_PATH_SEPARATOR "\\"
static const string PATH_SEPARATOR = "\\";
#pragma warning(2:4264) // no override available for virtual member function from base 'class'; function is hidden
#pragma warning(2:4265) // class has virtual functions, but destructor is not virtual
#pragma warning(2:4266) // no override available for virtual member function from base 'type'; function is hidden
@ -80,38 +84,36 @@ using BytePtr = unique_ptr<uInt8[]>;
// CPU architecture type
// This isn't complete yet, but takes care of all the major platforms
#if defined(__i386__) || defined(_M_IX86)
#define BSPF_ARCH "i386"
static const string ARCH = "i386";
#elif defined(__x86_64__) || defined(_WIN64)
#define BSPF_ARCH "x86_64"
static const string ARCH = "x86_64";
#elif defined(__powerpc__) || defined(__ppc__)
#define BSPF_ARCH "ppc"
static const string ARCH = "ppc";
#else
#define BSPF_ARCH "NOARCH"
static const string ARCH = "NOARCH";
#endif
// I wish Windows had a complete POSIX layer
#if defined BSPF_WINDOWS && !defined __GNUG__
#define BSPF_snprintf _snprintf
#define BSPF_vsnprintf _vsnprintf
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#else
#define HAVE_UNISTD_H // needed for building zlib
#include <strings.h>
#define BSPF_snprintf snprintf
#define BSPF_vsnprintf vsnprintf
using std::snprintf;
using std::vsnprintf;
#endif
static const string EmptyString("");
//////////////////////////////////////////////////////////////////////
// Some convenience functions
template<typename T> inline void BSPF_swap(T& a, T& b) { std::swap(a, b); }
template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; }
template<typename T> inline T BSPF_min (T a, T b) { return (a<b) ? a : b; }
template<typename T> inline T BSPF_max (T a, T b) { return (a>b) ? a : b; }
template<typename T> inline T BSPF_clamp (T a, T l, T u) { return (a<l) ? l : (a>u) ? u : a; }
template<typename T> inline void swap(T& a, T& b) { std::swap(a, b); }
template<typename T> inline T abs (T x) { return (x>=0) ? x : -x; }
template<typename T> inline T min (T a, T b) { return (a<b) ? a : b; }
template<typename T> inline T max (T a, T b) { return (a>b) ? a : b; }
template<typename T> inline T clamp (T a, T l, T u) { return (a<l) ? l : (a>u) ? u : a; }
// Compare two strings, ignoring case
inline int BSPF_compareIgnoreCase(const string& s1, const string& s2)
inline int compareIgnoreCase(const string& s1, const string& s2)
{
#if defined BSPF_WINDOWS && !defined __GNUG__
return _stricmp(s1.c_str(), s2.c_str());
@ -119,7 +121,7 @@ inline int BSPF_compareIgnoreCase(const string& s1, const string& s2)
return strcasecmp(s1.c_str(), s2.c_str());
#endif
}
inline int BSPF_compareIgnoreCase(const char* s1, const char* s2)
inline int compareIgnoreCase(const char* s1, const char* s2)
{
#if defined BSPF_WINDOWS && !defined __GNUG__
return _stricmp(s1, s2);
@ -129,7 +131,7 @@ inline int BSPF_compareIgnoreCase(const char* s1, const char* s2)
}
// Test whether the first string starts with the second one (case insensitive)
inline bool BSPF_startsWithIgnoreCase(const string& s1, const string& s2)
inline bool startsWithIgnoreCase(const string& s1, const string& s2)
{
#if defined BSPF_WINDOWS && !defined __GNUG__
return _strnicmp(s1.c_str(), s2.c_str(), s2.length()) == 0;
@ -137,7 +139,7 @@ inline bool BSPF_startsWithIgnoreCase(const string& s1, const string& s2)
return strncasecmp(s1.c_str(), s2.c_str(), s2.length()) == 0;
#endif
}
inline bool BSPF_startsWithIgnoreCase(const char* s1, const char* s2)
inline bool startsWithIgnoreCase(const char* s1, const char* s2)
{
#if defined BSPF_WINDOWS && !defined __GNUG__
return _strnicmp(s1, s2, strlen(s2)) == 0;
@ -147,14 +149,14 @@ inline bool BSPF_startsWithIgnoreCase(const char* s1, const char* s2)
}
// Test whether two strings are equal (case insensitive)
inline bool BSPF_equalsIgnoreCase(const string& s1, const string& s2)
inline bool equalsIgnoreCase(const string& s1, const string& s2)
{
return BSPF_compareIgnoreCase(s1, s2) == 0;
return compareIgnoreCase(s1, s2) == 0;
}
// Find location (if any) of the second string within the first,
// starting from 'startpos' in the first string
inline size_t BSPF_findIgnoreCase(const string& s1, const string& s2, int startpos = 0)
inline size_t findIgnoreCase(const string& s1, const string& s2, int startpos = 0)
{
auto pos = std::search(s1.begin()+startpos, s1.end(),
s2.begin(), s2.end(), [](char ch1, char ch2) {
@ -164,20 +166,22 @@ inline size_t BSPF_findIgnoreCase(const string& s1, const string& s2, int startp
}
// Test whether the first string ends with the second one (case insensitive)
inline bool BSPF_endsWithIgnoreCase(const string& s1, const string& s2)
inline bool endsWithIgnoreCase(const string& s1, const string& s2)
{
if(s1.length() >= s2.length())
{
const char* end = s1.c_str() + s1.length() - s2.length();
return BSPF_compareIgnoreCase(end, s2.c_str()) == 0;
return compareIgnoreCase(end, s2.c_str()) == 0;
}
return false;
}
// Test whether the first string contains the second one (case insensitive)
inline bool BSPF_containsIgnoreCase(const string& s1, const string& s2)
inline bool containsIgnoreCase(const string& s1, const string& s2)
{
return BSPF_findIgnoreCase(s1, s2) != string::npos;
return findIgnoreCase(s1, s2) != string::npos;
}
} // namespace BSPF
#endif

View File

@ -186,16 +186,16 @@ string NTSCFilter::decreaseAdjustable()
void NTSCFilter::loadConfig(const Settings& settings)
{
// Load adjustables for custom mode
myCustomSetup.hue = BSPF_clamp(settings.getFloat("tv.hue"), -1.0f, 1.0f);
myCustomSetup.saturation = BSPF_clamp(settings.getFloat("tv.saturation"), -1.0f, 1.0f);
myCustomSetup.contrast = BSPF_clamp(settings.getFloat("tv.contrast"), -1.0f, 1.0f);
myCustomSetup.brightness = BSPF_clamp(settings.getFloat("tv.brightness"), -1.0f, 1.0f);
myCustomSetup.sharpness = BSPF_clamp(settings.getFloat("tv.sharpness"), -1.0f, 1.0f);
myCustomSetup.gamma = BSPF_clamp(settings.getFloat("tv.gamma"), -1.0f, 1.0f);
myCustomSetup.resolution = BSPF_clamp(settings.getFloat("tv.resolution"), -1.0f, 1.0f);
myCustomSetup.artifacts = BSPF_clamp(settings.getFloat("tv.artifacts"), -1.0f, 1.0f);
myCustomSetup.fringing = BSPF_clamp(settings.getFloat("tv.fringing"), -1.0f, 1.0f);
myCustomSetup.bleed = BSPF_clamp(settings.getFloat("tv.bleed"), -1.0f, 1.0f);
myCustomSetup.hue = BSPF::clamp(settings.getFloat("tv.hue"), -1.0f, 1.0f);
myCustomSetup.saturation = BSPF::clamp(settings.getFloat("tv.saturation"), -1.0f, 1.0f);
myCustomSetup.contrast = BSPF::clamp(settings.getFloat("tv.contrast"), -1.0f, 1.0f);
myCustomSetup.brightness = BSPF::clamp(settings.getFloat("tv.brightness"), -1.0f, 1.0f);
myCustomSetup.sharpness = BSPF::clamp(settings.getFloat("tv.sharpness"), -1.0f, 1.0f);
myCustomSetup.gamma = BSPF::clamp(settings.getFloat("tv.gamma"), -1.0f, 1.0f);
myCustomSetup.resolution = BSPF::clamp(settings.getFloat("tv.resolution"), -1.0f, 1.0f);
myCustomSetup.artifacts = BSPF::clamp(settings.getFloat("tv.artifacts"), -1.0f, 1.0f);
myCustomSetup.fringing = BSPF::clamp(settings.getFloat("tv.fringing"), -1.0f, 1.0f);
myCustomSetup.bleed = BSPF::clamp(settings.getFloat("tv.bleed"), -1.0f, 1.0f);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -59,7 +59,7 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
myConsole.cartridge().getImage(banksize);
BankInfo info;
info.size = BSPF_min(banksize, 4096);
info.size = BSPF::min(banksize, 4096);
for(int i = 0; i < myConsole.cartridge().bankCount(); ++i)
myBankInfo.push_back(info);
@ -196,7 +196,7 @@ string CartDebug::toString()
if(state.rport[i] - curraddr > bytesPerLine || bytesSoFar >= 256)
{
char port[37];
BSPF_snprintf(port, 36, "%04x: (rport = %04x, wport = %04x)\n",
BSPF::snprintf(port, 36, "%04x: (rport = %04x, wport = %04x)\n",
state.rport[i], state.rport[i], state.wport[i]);
port[2] = port[3] = 'x';
buf << DebuggerParser::red(port);
@ -347,7 +347,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
{
if(begin == list_size) begin = end;
if(tag.type != CartDebug::ROW)
length = BSPF_max(length, uInt32(tag.disasm.length()));
length = BSPF::max(length, uInt32(tag.disasm.length()));
--lines;
}
@ -383,7 +383,7 @@ bool CartDebug::addDirective(CartDebug::DisasmType type,
if(bank < 0) // Do we want the current bank or ZP RAM?
bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : int(myBankInfo.size())-1;
bank = BSPF_min(bank, bankCount());
bank = BSPF::min(bank, bankCount());
BankInfo& info = myBankInfo[bank];
DirectiveList& list = info.directiveList;
@ -515,7 +515,7 @@ bool CartDebug::addLabel(const string& label, uInt16 address)
removeLabel(label);
myUserAddresses.insert(make_pair(label, address));
myUserLabels.insert(make_pair(address, label));
myLabelLength = BSPF_max(myLabelLength, uInt16(label.size()));
myLabelLength = BSPF::max(myLabelLength, uInt16(label.size()));
mySystem.setDirtyPage(address);
return true;
}
@ -773,7 +773,7 @@ string CartDebug::loadSymbolFile()
// Make sure the value doesn't represent a constant
// For now, we simply ignore constants completely
const auto& iter = myUserCLabels.find(value);
if(iter == myUserCLabels.end() || !BSPF_equalsIgnoreCase(label, iter->second))
if(iter == myUserCLabels.end() || !BSPF::equalsIgnoreCase(label, iter->second))
{
// Check for period, and strip leading number
if(string::size_type pos = label.find_first_of(".", 0) != string::npos)
@ -859,32 +859,32 @@ string CartDebug::loadConfigFile()
string directive;
uInt16 start = 0, end = 0;
buf >> directive;
if(BSPF_startsWithIgnoreCase(directive, "ORG"))
if(BSPF::startsWithIgnoreCase(directive, "ORG"))
{
// TODO - figure out what to do with this
buf >> hex >> start;
}
else if(BSPF_startsWithIgnoreCase(directive, "CODE"))
else if(BSPF::startsWithIgnoreCase(directive, "CODE"))
{
buf >> hex >> start >> hex >> end;
addDirective(CartDebug::CODE, start, end, currentbank);
}
else if(BSPF_startsWithIgnoreCase(directive, "GFX"))
else if(BSPF::startsWithIgnoreCase(directive, "GFX"))
{
buf >> hex >> start >> hex >> end;
addDirective(CartDebug::GFX, start, end, currentbank);
}
else if(BSPF_startsWithIgnoreCase(directive, "PGFX"))
else if(BSPF::startsWithIgnoreCase(directive, "PGFX"))
{
buf >> hex >> start >> hex >> end;
addDirective(CartDebug::PGFX, start, end, currentbank);
}
else if(BSPF_startsWithIgnoreCase(directive, "DATA"))
else if(BSPF::startsWithIgnoreCase(directive, "DATA"))
{
buf >> hex >> start >> hex >> end;
addDirective(CartDebug::DATA, start, end, currentbank);
}
else if(BSPF_startsWithIgnoreCase(directive, "ROW"))
else if(BSPF::startsWithIgnoreCase(directive, "ROW"))
{
buf >> hex >> start;
buf >> hex >> end;
@ -1139,7 +1139,7 @@ string CartDebug::saveDisassembly()
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
int max_len = 0;
for(const auto& iter: myUserLabels)
max_len = BSPF_max(max_len, int(iter.second.size()));
max_len = BSPF::max(max_len, int(iter.second.size()));
for(const auto& iter: myUserLabels)
out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n";
}
@ -1153,7 +1153,7 @@ string CartDebug::saveDisassembly()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::saveRom()
{
const string& path = "~" BSPF_PATH_SEPARATOR +
const string& path = string("~") + BSPF::PATH_SEPARATOR +
myConsole.properties().get(Cartridge_Name) + ".a26";
FilesystemNode node(path);
@ -1229,23 +1229,23 @@ void CartDebug::getCompletions(const char* in, StringList& completions) const
{
// First scan system equates
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
if(ourTIAMnemonicR[addr] && BSPF_startsWithIgnoreCase(ourTIAMnemonicR[addr], in))
if(ourTIAMnemonicR[addr] && BSPF::startsWithIgnoreCase(ourTIAMnemonicR[addr], in))
completions.push_back(ourTIAMnemonicR[addr]);
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
if(ourTIAMnemonicW[addr] && BSPF_startsWithIgnoreCase(ourTIAMnemonicW[addr], in))
if(ourTIAMnemonicW[addr] && BSPF::startsWithIgnoreCase(ourTIAMnemonicW[addr], in))
completions.push_back(ourTIAMnemonicW[addr]);
for(uInt16 addr = 0; addr <= 0x297-0x280; ++addr)
if(ourIOMnemonic[addr] && BSPF_startsWithIgnoreCase(ourIOMnemonic[addr], in))
if(ourIOMnemonic[addr] && BSPF::startsWithIgnoreCase(ourIOMnemonic[addr], in))
completions.push_back(ourIOMnemonic[addr]);
for(uInt16 addr = 0; addr <= 0x7F; ++addr)
if(ourZPMnemonic[addr] && BSPF_startsWithIgnoreCase(ourZPMnemonic[addr], in))
if(ourZPMnemonic[addr] && BSPF::startsWithIgnoreCase(ourZPMnemonic[addr], in))
completions.push_back(ourZPMnemonic[addr]);
// Now scan user-defined labels
for(const auto& iter: myUserAddresses)
{
const char* l = iter.first.c_str();
if(BSPF_startsWithIgnoreCase(l, in))
if(BSPF::startsWithIgnoreCase(l, in))
completions.push_back(l);
}
}

View File

@ -143,10 +143,10 @@ void Debugger::initialize()
// The debugger dialog is resizable, within certain bounds
// We check those bounds now
myWidth = BSPF_max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW));
myHeight = BSPF_max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH));
myWidth = BSPF_min(myWidth, uInt32(d.w));
myHeight = BSPF_min(myHeight, uInt32(d.h));
myWidth = BSPF::max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW));
myHeight = BSPF::max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH));
myWidth = BSPF::min(myWidth, uInt32(d.w));
myHeight = BSPF::min(myHeight, uInt32(d.h));
myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight));
@ -613,12 +613,12 @@ void Debugger::getCompletions(const char* in, StringList& list) const
for(const auto& iter: myFunctions)
{
const char* l = iter.first.c_str();
if(BSPF_equalsIgnoreCase(l, in))
if(BSPF::equalsIgnoreCase(l, in))
list.push_back(l);
}
for(int i = 0; pseudo_registers[i][0] != 0; ++i)
if(BSPF_equalsIgnoreCase(pseudo_registers[i][0], in))
if(BSPF::equalsIgnoreCase(pseudo_registers[i][0], in))
list.push_back(pseudo_registers[i][0]);
}

View File

@ -108,7 +108,7 @@ string DebuggerParser::run(const string& command)
for(int i = 0; i < kNumCommands; ++i)
{
if(BSPF_equalsIgnoreCase(verb, commands[i].cmdString))
if(BSPF::equalsIgnoreCase(verb, commands[i].cmdString))
{
if(validateArgs(i))
commands[i].executor(this);
@ -160,7 +160,7 @@ void DebuggerParser::getCompletions(const char* in, StringList& completions) con
// cerr << "Attempting to complete \"" << in << "\"" << endl;
for(int i = 0; i < kNumCommands; ++i)
{
if(BSPF_startsWithIgnoreCase(commands[i].cmdString.c_str(), in))
if(BSPF::startsWithIgnoreCase(commands[i].cmdString.c_str(), in))
completions.push_back(commands[i].cmdString);
}
}
@ -1288,7 +1288,7 @@ void DebuggerParser::executeRunTo()
if(pcline >= 0)
{
const string& next = list[pcline].disasm;
done = (BSPF_findIgnoreCase(next, argStrings[0]) != string::npos);
done = (BSPF::findIgnoreCase(next, argStrings[0]) != string::npos);
}
// Update the progress bar
progress.setProgress(count);
@ -1437,7 +1437,7 @@ void DebuggerParser::executeTrap()
{
uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg;
if(beg > end) BSPF_swap(beg, end);
if(beg > end) BSPF::swap(beg, end);
for(uInt32 i = beg; i <= end; ++i)
{
@ -1453,7 +1453,7 @@ void DebuggerParser::executeTrapread()
{
uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg;
if(beg > end) BSPF_swap(beg, end);
if(beg > end) BSPF::swap(beg, end);
for(uInt32 i = beg; i <= end; ++i)
{
@ -1468,7 +1468,7 @@ void DebuggerParser::executeTrapwrite()
{
uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg;
if(beg > end) BSPF_swap(beg, end);
if(beg > end) BSPF::swap(beg, end);
for(uInt32 i = beg; i <= end; ++i)
{
@ -1483,7 +1483,7 @@ void DebuggerParser::executeType()
{
uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg;
if(beg > end) BSPF_swap(beg, end);
if(beg > end) BSPF::swap(beg, end);
for(uInt32 i = beg; i <= end; ++i)
{

View File

@ -706,7 +706,7 @@ string TIADebug::audFreq(uInt8 div)
double hz = 30000.0;
if(div) hz /= div;
BSPF_snprintf(buf, 9, "%5.1f", hz);
BSPF::snprintf(buf, 9, "%5.1f", hz);
ret += buf;
ret += "Hz";

View File

@ -111,8 +111,8 @@ CartRamWidget::InternalRamWidget::InternalRamWidget(GuiObject* boss,
int x, int y, int w, int h,
CartDebugWidget& dbg)
: RamWidget(boss, lfont, nfont, x, y, w, h,
dbg.internalRamSize(), BSPF_min(dbg.internalRamSize() / 16, 16u),
BSPF_min(dbg.internalRamSize() / 16, 16u) * 16),
dbg.internalRamSize(), BSPF::min(dbg.internalRamSize() / 16, 16u),
BSPF::min(dbg.internalRamSize() / 16, 16u) * 16),
myCart(dbg)
{
}

View File

@ -238,8 +238,8 @@ void DataGridWidget::setValue(int position, int value, bool changed,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setRange(int lower, int upper)
{
_lowerBound = BSPF_max(0, lower);
_upperBound = BSPF_min(1 << _bits, upper);
_lowerBound = BSPF::max(0, lower);
_upperBound = BSPF::min(1 << _bits, upper);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -453,7 +453,7 @@ void DebuggerDialog::addRomArea()
GUI::Rect DebuggerDialog::getTiaBounds() const
{
// The area showing the TIA image (NTSC and PAL supported, up to 260 lines)
GUI::Rect r(0, 0, 320, BSPF_max(260, int(_h * 0.35)));
GUI::Rect r(0, 0, 320, BSPF::max(260, int(_h * 0.35)));
return r;
}

View File

@ -37,7 +37,7 @@ class NullControlWidget : public ControllerWidget
<< controller.name() << "):";
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),
lwidth = BSPF_max(font.getStringWidth(buf.str()),
lwidth = BSPF::max(font.getStringWidth(buf.str()),
font.getStringWidth("Controller input"));
new StaticTextWidget(boss, font, x, y+2, lwidth,
fontHeight, buf.str(), kTextAlignLeft);

View File

@ -752,7 +752,7 @@ void PromptWidget::nextLine()
// Call this (at least) when the current line changes or when a new line is added
void PromptWidget::updateScrollBuffer()
{
int lastchar = BSPF_max(_promptEndPos, _currentPos);
int lastchar = BSPF::max(_promptEndPos, _currentPos);
int line = lastchar / _lineWidth;
int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer;
int firstline = line - numlines + 1;
@ -787,7 +787,7 @@ int PromptWidget::printf(const char* format, ...)
int PromptWidget::vprintf(const char* format, va_list argptr)
{
char buf[2048]; // Note: generates warnings about 'nonliteral' format
int count = BSPF_vsnprintf(buf, sizeof(buf), format, argptr);
int count = BSPF::vsnprintf(buf, sizeof(buf), format, argptr);
print(buf);
return count;
@ -908,7 +908,7 @@ string PromptWidget::getCompletionPrefix(const StringList& completions, string p
{
if(s.length() < prefix.length())
return prefix; // current prefix is the best we're going to get
else if(!BSPF_startsWithIgnoreCase(s, prefix))
else if(!BSPF::startsWithIgnoreCase(s, prefix))
{
prefix.erase(prefix.length()-1);
return prefix;

View File

@ -305,7 +305,7 @@ void RamWidget::fillGrid(bool updateOld)
// Update RAM labels
uInt32 rport = readPort(start), page = rport & 0xf0;
char buf[5];
BSPF_snprintf(buf, 5, "%04X", rport);
BSPF::snprintf(buf, 5, "%04X", rport);
buf[2] = buf[3] = 'x';
myRamStart->setLabel(buf);
for(uInt32 row = 0; row < myNumRows; ++row, page += 0x10)

View File

@ -344,7 +344,7 @@ void RiotWidget::loadConfig()
const string& cpurandom = instance().settings().getString("cpurandom");
const char* cpuregs[] = { "S", "A", "X", "Y", "P" };
for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setState(BSPF_containsIgnoreCase(cpurandom, cpuregs[i]));
myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i]));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -66,7 +66,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
const int fontWidth = lfont.getMaxCharWidth(),
numchars = w / fontWidth;
_labelWidth = BSPF_max(16, int(0.20 * (numchars - 12))) * fontWidth - 1;
_labelWidth = BSPF::max(16, int(0.20 * (numchars - 12))) * fontWidth - 1;
_bytesWidth = 12 * fontWidth;
//////////////////////////////////////////////////////
@ -75,7 +75,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
// rowheight is determined by largest item on a line,
// possibly meaning that number of rows will change
_fontHeight = BSPF_max(_fontHeight, CheckboxWidget::boxSize());
_fontHeight = BSPF::max(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list

View File

@ -38,8 +38,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
_bgcolor = _bgcolorhi = kDlgColor;
// Use all available space, up to the maximum bounds of the TIA image
_w = BSPF_min(w, 320);
_h = BSPF_min(h, 260);
_w = BSPF::min(w, 320);
_h = BSPF::min(h, 260);
addFocusWidget(this);
@ -96,8 +96,8 @@ void TiaZoomWidget::recalc()
th = instance().console().tia().height();
// Don't go past end of framebuffer
myXOff = BSPF_clamp(myXOff, 0, tw - myNumCols);
myYOff = BSPF_clamp(myYOff, 0, th - myNumRows);
myXOff = BSPF::clamp(myXOff, 0, tw - myNumCols);
myYOff = BSPF::clamp(myYOff, 0, th - myNumRows);
setDirty();
}

View File

@ -28,7 +28,7 @@ Cartridge0840::Cartridge0840(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));
memcpy(myImage, image, BSPF::min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank

View File

@ -27,7 +27,7 @@ Cartridge4K::Cartridge4K(const uInt8* image, uInt32 size, const Settings& settin
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(4096u, size));
memcpy(myImage, image, BSPF::min(4096u, size));
createCodeAccessBase(4096);
}

View File

@ -27,7 +27,7 @@ Cartridge4KSC::Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& se
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(4096u, size));
memcpy(myImage, image, BSPF::min(4096u, size));
createCodeAccessBase(4096);
}

View File

@ -27,7 +27,7 @@
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(BSPF_max(size, 8448u)),
mySize(BSPF::max(size, 8448u)),
myLoadImages(nullptr),
myWriteEnabled(false),
myPower(true),

View File

@ -28,7 +28,7 @@ CartridgeBF::CartridgeBF(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(262144u, size));
memcpy(myImage, image, BSPF::min(262144u, size));
createCodeAccessBase(262144);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeBFSC::CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(262144u, size));
memcpy(myImage, image, BSPF::min(262144u, size));
createCodeAccessBase(262144);
// Remember startup bank

View File

@ -31,7 +31,7 @@ CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));
memcpy(myImage, image, BSPF::min(16384u, size));
createCodeAccessBase(16384);
// On powerup, the last bank of ROM is enabled and RAM is disabled

View File

@ -39,7 +39,7 @@ CartridgeCTY::CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osyst
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(32768u, size));
memcpy(myImage, image, BSPF::min(32768u, size));
createCodeAccessBase(32768);
// Point to the first tune

View File

@ -28,7 +28,7 @@ CartridgeDF::CartridgeDF(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(131072u, size));
memcpy(myImage, image, BSPF::min(131072u, size));
createCodeAccessBase(131072);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeDFSC::CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(131072u, size));
memcpy(myImage, image, BSPF::min(131072u, size));
createCodeAccessBase(131072);
// Remember startup bank

View File

@ -32,7 +32,7 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size,
myCurrentBank(0)
{
// Make a copy of the entire image
memcpy(myImage, image, BSPF_min(size, 8192u + 2048u + 256u));
memcpy(myImage, image, BSPF::min(size, 8192u + 2048u + 256u));
createCodeAccessBase(8192);
// Pointer to the program ROM (8K @ 0 byte offset)

View File

@ -40,7 +40,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
{
// Store image, making sure it's at least 29KB
uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255;
mySize = BSPF_max(minsize, size);
mySize = BSPF::max(minsize, size);
myImage = make_ptr<uInt8[]>(mySize);
memcpy(myImage.get(), image, size);
createCodeAccessBase(4096 * 6);

View File

@ -27,7 +27,7 @@ CartridgeE0::CartridgeE0(const uInt8* image, uInt32 size, const Settings& settin
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));
memcpy(myImage, image, BSPF::min(8192u, size));
createCodeAccessBase(8192);
}

View File

@ -28,7 +28,7 @@ CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settin
myCurrentRAM(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));
memcpy(myImage, image, BSPF::min(16384u, size));
createCodeAccessBase(16384 + 2048);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeEF::CartridgeEF(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));
memcpy(myImage, image, BSPF::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -26,7 +26,7 @@ CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));
memcpy(myImage, image, BSPF::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF0::CartridgeF0(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));
memcpy(myImage, image, BSPF::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -29,7 +29,7 @@ CartridgeF4::CartridgeF4(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(32768u, size));
memcpy(myImage, image, BSPF::min(32768u, size));
createCodeAccessBase(32768);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(32768u, size));
memcpy(myImage, image, BSPF::min(32768u, size));
createCodeAccessBase(32768);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF6::CartridgeF6(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));
memcpy(myImage, image, BSPF::min(16384u, size));
createCodeAccessBase(16384);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));
memcpy(myImage, image, BSPF::min(16384u, size));
createCodeAccessBase(16384);
// Remember startup bank

View File

@ -29,7 +29,7 @@ CartridgeF8::CartridgeF8(const uInt8* image, uInt32 size, const string& md5,
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));
memcpy(myImage, image, BSPF::min(8192u, size));
createCodeAccessBase(8192);
// Normally bank 1 is the reset bank, unless we're dealing with ROMs

View File

@ -28,7 +28,7 @@ CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));
memcpy(myImage, image, BSPF::min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(12288u, size));
memcpy(myImage, image, BSPF::min(12288u, size));
createCodeAccessBase(12288);
// Remember startup bank

View File

@ -30,7 +30,7 @@ CartridgeFE::CartridgeFE(const uInt8* image, uInt32 size, const Settings& settin
myLastAddressChanged(false)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));
memcpy(myImage, image, BSPF::min(8192u, size));
// We use System::PageAccess.codeAccessBase, but don't allow its use
// through a pointer, since the address space of FE carts can change

View File

@ -28,7 +28,7 @@ CartridgeUA::CartridgeUA(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));
memcpy(myImage, image, BSPF::min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank

View File

@ -28,7 +28,7 @@
CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(BSPF_min(8195u, size)),
mySize(BSPF::min(8195u, size)),
myCyclesAtBankswitchInit(0),
myPendingBank(0),
myCurrentBank(0)

View File

@ -30,7 +30,7 @@ CartridgeX07::CartridgeX07(const uInt8* image, uInt32 size, const Settings& sett
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));
memcpy(myImage, image, BSPF::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -560,7 +560,7 @@ void Console::setTIAProperties()
myConsoleInfo.InitialFrameRate = "50";
// PAL ROMs normally need at least 250 lines
height = BSPF_max(height, 250u);
height = BSPF::max(height, 250u);
}
// Make sure these values fit within the bounds of the desktop
@ -569,7 +569,7 @@ void Console::setTIAProperties()
if(height > dheight)
{
ystart += height - dheight;
ystart = BSPF_min(ystart, 64u);
ystart = BSPF::min(ystart, 64u);
height = dheight;
}
myTIA->setYStart(ystart);
@ -619,7 +619,7 @@ void Console::setControllers(const string& rommd5)
{
leftC = make_ptr<Keyboard>(Controller::Left, myEvent, *mySystem);
}
else if(BSPF_startsWithIgnoreCase(left, "PADDLES"))
else if(BSPF::startsWithIgnoreCase(left, "PADDLES"))
{
bool swapAxis = false, swapDir = false;
if(left == "PADDLES_IAXIS")
@ -672,7 +672,7 @@ void Console::setControllers(const string& rommd5)
{
rightC = make_ptr<Keyboard>(Controller::Right, myEvent, *mySystem);
}
else if(BSPF_startsWithIgnoreCase(right, "PADDLES"))
else if(BSPF::startsWithIgnoreCase(right, "PADDLES"))
{
bool swapAxis = false, swapDir = false;
if(right == "PADDLES_IAXIS")

View File

@ -1827,7 +1827,7 @@ void EventHandler::takeSnapshot(uInt32 number)
VariantList comments;
ostringstream version;
version << "Stella " << STELLA_VERSION << " (Build " << STELLA_BUILD << ") ["
<< BSPF_ARCH << "]";
<< BSPF::ARCH << "]";
VarList::push_back(comments, "Software", version.str());
VarList::push_back(comments, "ROM Name", myOSystem.console().properties().get(Cartridge_Name));
VarList::push_back(comments, "ROM MD5", myOSystem.console().properties().get(Cartridge_MD5));
@ -1879,9 +1879,9 @@ void EventHandler::setMouseControllerMode(const string& enable)
if(myOSystem.hasConsole())
{
bool usemouse = false;
if(BSPF_equalsIgnoreCase(enable, "always"))
if(BSPF::equalsIgnoreCase(enable, "always"))
usemouse = true;
else if(BSPF_equalsIgnoreCase(enable, "never"))
else if(BSPF::equalsIgnoreCase(enable, "never"))
usemouse = false;
else // 'analog'
{

View File

@ -290,7 +290,7 @@ bool EventHandler::JoystickHandler::add(StellaJoystick* stick)
// Figure out what type of joystick this is
bool specialAdaptor = false;
if(BSPF_containsIgnoreCase(stick->name, "2600-daptor"))
if(BSPF::containsIgnoreCase(stick->name, "2600-daptor"))
{
// 2600-daptorII devices have 3 axes and 12 buttons, and the value of the z-axis
// determines how those 12 buttons are used (not all buttons are used in all modes)
@ -305,7 +305,7 @@ bool EventHandler::JoystickHandler::add(StellaJoystick* stick)
specialAdaptor = true;
}
else if(BSPF_containsIgnoreCase(stick->name, "Stelladaptor"))
else if(BSPF::containsIgnoreCase(stick->name, "Stelladaptor"))
{
stick->name = "Stelladaptor";
specialAdaptor = true;
@ -317,7 +317,7 @@ bool EventHandler::JoystickHandler::add(StellaJoystick* stick)
// we append ' #x', where 'x' increases consecutively
int count = 0;
for(const auto& i: myDatabase)
if(BSPF_startsWithIgnoreCase(i.first, stick->name) && i.second.joy)
if(BSPF::startsWithIgnoreCase(i.first, stick->name) && i.second.joy)
++count;
if(count > 0)
@ -411,14 +411,14 @@ void EventHandler::JoystickHandler::mapStelladaptors(const string& saport)
// in setupJoysticks take care of that
int saCount = 0;
int saOrder[2] = { 1, 2 };
if(BSPF_equalsIgnoreCase(saport, "rl"))
if(BSPF::equalsIgnoreCase(saport, "rl"))
{
saOrder[0] = 2; saOrder[1] = 1;
}
for(auto& stick: mySticks)
{
if(BSPF_startsWithIgnoreCase(stick.second->name, "Stelladaptor"))
if(BSPF::startsWithIgnoreCase(stick.second->name, "Stelladaptor"))
{
if(saOrder[saCount] == 1)
{
@ -432,7 +432,7 @@ void EventHandler::JoystickHandler::mapStelladaptors(const string& saport)
}
saCount++;
}
else if(BSPF_startsWithIgnoreCase(stick.second->name, "2600-daptor"))
else if(BSPF::startsWithIgnoreCase(stick.second->name, "2600-daptor"))
{
if(saOrder[saCount] == 1)
{

View File

@ -43,8 +43,8 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) c
memcpy(buffer, src, width() * height() * 4);
else
{
uInt32 w = BSPF_min(rect.width(), width());
uInt32 h = BSPF_min(rect.height(), height());
uInt32 w = BSPF::min(rect.width(), width());
uInt32 h = BSPF::min(rect.height(), height());
// Copy 'height' lines of width 'pitch' (in bytes for both)
uInt8* dst = buffer;

View File

@ -43,7 +43,7 @@ FilesystemNode::FilesystemNode(const string& p)
AbstractFSNode* tmp = nullptr;
// Is this potentially a ZIP archive?
if(BSPF_containsIgnoreCase(p, ".zip"))
if(BSPF::containsIgnoreCase(p, ".zip"))
tmp = FilesystemNodeFactory::create(p, FilesystemNodeFactory::ZIP);
else
tmp = FilesystemNodeFactory::create(p, FilesystemNodeFactory::SYSTEM);

View File

@ -110,7 +110,7 @@ class FilesystemNode
if (isDirectory() != node.isDirectory())
return isDirectory();
return BSPF_compareIgnoreCase(getName(), node.getName()) < 0;
return BSPF::compareIgnoreCase(getName(), node.getName()) < 0;
}
/**
@ -119,7 +119,7 @@ class FilesystemNode
*/
inline bool operator==(const FilesystemNode& node) const
{
return BSPF_compareIgnoreCase(getName(), node.getName()) == 0;
return BSPF::compareIgnoreCase(getName(), node.getName()) == 0;
}
/**

View File

@ -72,8 +72,8 @@ bool FrameBuffer::initialize()
query_h = s.h;
}
// Various parts of the codebase assume a minimum screen size
myDesktopSize.w = BSPF_max(query_w, uInt32(kFBMinW));
myDesktopSize.h = BSPF_max(query_h, uInt32(kFBMinH));
myDesktopSize.w = BSPF::max(query_w, uInt32(kFBMinW));
myDesktopSize.h = BSPF::max(query_h, uInt32(kFBMinH));
////////////////////////////////////////////////////////////////////
// Create fonts to draw text
@ -275,7 +275,7 @@ void FrameBuffer::update()
{
const ConsoleInfo& info = myOSystem.console().about();
char msg[30];
BSPF_snprintf(msg, 30, "%3u @ %3.2ffps => %s",
BSPF::snprintf(msg, 30, "%3u @ %3.2ffps => %s",
myOSystem.console().tia().scanlines(),
myOSystem.console().getFramerate(), info.DisplayFormat.c_str());
myStatsMsg.surface->fillRect(0, 0, myStatsMsg.w, myStatsMsg.h, kBGColor);
@ -743,10 +743,10 @@ VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
zoom(z),
description(desc)
{
sw = BSPF_max(sw, uInt32(FrameBuffer::kTIAMinW));
sh = BSPF_max(sh, uInt32(FrameBuffer::kTIAMinH));
iw = BSPF_min(iw, sw);
ih = BSPF_min(ih, sh);
sw = BSPF::max(sw, uInt32(FrameBuffer::kTIAMinW));
sh = BSPF::max(sh, uInt32(FrameBuffer::kTIAMinH));
iw = BSPF::min(iw, sw);
ih = BSPF::min(ih, sh);
int ix = (sw - iw) >> 1;
int iy = (sh - ih) >> 1;
image = GUI::Rect(ix, iy, ix+iw, iy+ih);
@ -801,8 +801,8 @@ void VideoMode::applyAspectCorrection(uInt32 aspect, bool stretch)
}
// Now re-calculate the dimensions
iw = BSPF_min(iw, screen.w);
ih = BSPF_min(ih, screen.h);
iw = BSPF::min(iw, screen.w);
ih = BSPF::min(ih, screen.h);
image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1);
image.setWidth(iw);

View File

@ -136,8 +136,7 @@ bool Joystick::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Joystick::setDeadZone(int deadzone)
{
if(deadzone < 0) deadzone = 0;
if(deadzone > 29) deadzone = 29;
deadzone = BSPF::clamp(deadzone, 0, 29);
_DEAD_ZONE = 3200 + deadzone * 1000;
}

View File

@ -83,15 +83,15 @@ void M6502::reset()
// Set registers to random or default values
const string& cpurandom = mySettings.getString("cpurandom");
SP = BSPF_containsIgnoreCase(cpurandom, "S") ?
SP = BSPF::containsIgnoreCase(cpurandom, "S") ?
mySystem->randGenerator().next() : 0xff;
A = BSPF_containsIgnoreCase(cpurandom, "A") ?
A = BSPF::containsIgnoreCase(cpurandom, "A") ?
mySystem->randGenerator().next() : 0x00;
X = BSPF_containsIgnoreCase(cpurandom, "X") ?
X = BSPF::containsIgnoreCase(cpurandom, "X") ?
mySystem->randGenerator().next() : 0x00;
Y = BSPF_containsIgnoreCase(cpurandom, "Y") ?
Y = BSPF::containsIgnoreCase(cpurandom, "Y") ?
mySystem->randGenerator().next() : 0x00;
PS(BSPF_containsIgnoreCase(cpurandom, "P") ?
PS(BSPF::containsIgnoreCase(cpurandom, "P") ?
mySystem->randGenerator().next() : 0x20);
// Reset access flag

View File

@ -87,7 +87,7 @@ OSystem::OSystem()
info << "Build " << STELLA_BUILD << ", using SDL " << int(ver.major)
<< "." << int(ver.minor) << "."<< int(ver.patch)
<< " [" << BSPF_ARCH << "]";
<< " [" << BSPF::ARCH << "]";
myBuildInfo = info.str();
mySettings = MediaFactory::createSettings(*this);
@ -369,27 +369,27 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
myEventHandler->handleEvent(Event::ConsoleSelect, 1);
const string& holdjoy0 = mySettings->getString("holdjoy0");
if(BSPF_containsIgnoreCase(holdjoy0, "U"))
if(BSPF::containsIgnoreCase(holdjoy0, "U"))
myEventHandler->handleEvent(Event::JoystickZeroUp, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "D"))
if(BSPF::containsIgnoreCase(holdjoy0, "D"))
myEventHandler->handleEvent(Event::JoystickZeroDown, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "L"))
if(BSPF::containsIgnoreCase(holdjoy0, "L"))
myEventHandler->handleEvent(Event::JoystickZeroLeft, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "R"))
if(BSPF::containsIgnoreCase(holdjoy0, "R"))
myEventHandler->handleEvent(Event::JoystickZeroRight, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "F"))
if(BSPF::containsIgnoreCase(holdjoy0, "F"))
myEventHandler->handleEvent(Event::JoystickZeroFire, 1);
const string& holdjoy1 = mySettings->getString("holdjoy1");
if(BSPF_containsIgnoreCase(holdjoy1, "U"))
if(BSPF::containsIgnoreCase(holdjoy1, "U"))
myEventHandler->handleEvent(Event::JoystickOneUp, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "D"))
if(BSPF::containsIgnoreCase(holdjoy1, "D"))
myEventHandler->handleEvent(Event::JoystickOneDown, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "L"))
if(BSPF::containsIgnoreCase(holdjoy1, "L"))
myEventHandler->handleEvent(Event::JoystickOneLeft, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "R"))
if(BSPF::containsIgnoreCase(holdjoy1, "R"))
myEventHandler->handleEvent(Event::JoystickOneRight, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "F"))
if(BSPF::containsIgnoreCase(holdjoy1, "F"))
myEventHandler->handleEvent(Event::JoystickOneFire, 1);
#ifdef DEBUGGER_SUPPORT
if(mySettings->getBool("debug"))

View File

@ -410,8 +410,8 @@ class OSystem
that usually isn't user-modifiable), we create a special method
for it.
*/
virtual string defaultSnapSaveDir() { return "~" BSPF_PATH_SEPARATOR; }
virtual string defaultSnapLoadDir() { return "~" BSPF_PATH_SEPARATOR; }
virtual string defaultSnapSaveDir() { return string("~") + BSPF::PATH_SEPARATOR; }
virtual string defaultSnapLoadDir() { return string("~") + BSPF::PATH_SEPARATOR; }
protected:
/**

View File

@ -276,7 +276,7 @@ void Paddles::update()
if(myMPaddleID > -1)
{
// We're in auto mode, where a single axis is used for one paddle only
myCharge[myMPaddleID] = BSPF_clamp(myCharge[myMPaddleID] -
myCharge[myMPaddleID] = BSPF::clamp(myCharge[myMPaddleID] -
(myEvent.get(myAxisMouseMotion) * MOUSE_SENSITIVITY),
TRIGMIN, TRIGRANGE);
if(myEvent.get(Event::MouseButtonLeftValue) ||
@ -289,7 +289,7 @@ void Paddles::update()
// mapped to a separate paddle
if(myMPaddleIDX > -1)
{
myCharge[myMPaddleIDX] = BSPF_clamp(myCharge[myMPaddleIDX] -
myCharge[myMPaddleIDX] = BSPF::clamp(myCharge[myMPaddleIDX] -
(myEvent.get(Event::MouseAxisXValue) * MOUSE_SENSITIVITY),
TRIGMIN, TRIGRANGE);
if(myEvent.get(Event::MouseButtonLeftValue))
@ -297,7 +297,7 @@ void Paddles::update()
}
if(myMPaddleIDY > -1)
{
myCharge[myMPaddleIDY] = BSPF_clamp(myCharge[myMPaddleIDY] -
myCharge[myMPaddleIDY] = BSPF::clamp(myCharge[myMPaddleIDY] -
(myEvent.get(Event::MouseAxisYValue) * MOUSE_SENSITIVITY),
TRIGMIN, TRIGRANGE);
if(myEvent.get(Event::MouseButtonRightValue))
@ -397,20 +397,20 @@ bool Paddles::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setDigitalSensitivity(int sensitivity)
{
DIGITAL_SENSITIVITY = BSPF_clamp(sensitivity, 1, MAX_DIGITAL_SENSE);
DIGITAL_SENSITIVITY = BSPF::clamp(sensitivity, 1, MAX_DIGITAL_SENSE);
DIGITAL_DISTANCE = 20 + (DIGITAL_SENSITIVITY << 3);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setMouseSensitivity(int sensitivity)
{
MOUSE_SENSITIVITY = BSPF_clamp(sensitivity, 1, MAX_MOUSE_SENSE);
MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, 1, MAX_MOUSE_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setPaddleRange(int range)
{
range = BSPF_clamp(range, 1, 100);
range = BSPF::clamp(range, 1, 100);
TRIGRANGE = int(TRIGMAX * (range / 100.0));
}

View File

@ -42,7 +42,7 @@ void Properties::set(PropertyType key, const string& value)
if(key != LastPropType)
{
myProperties[key] = value;
if(BSPF_equalsIgnoreCase(myProperties[key], "AUTO-DETECT"))
if(BSPF::equalsIgnoreCase(myProperties[key], "AUTO-DETECT"))
myProperties[key] = "AUTO";
switch(key)

View File

@ -101,7 +101,7 @@ bool PropertiesSet::getMD5(const string& md5, Properties& properties,
while(low <= high)
{
int i = (low + high) / 2;
int cmp = BSPF_compareIgnoreCase(md5, DefProps[i][Cartridge_MD5]);
int cmp = BSPF::compareIgnoreCase(md5, DefProps[i][Cartridge_MD5]);
if(cmp == 0) // found it
{

View File

@ -194,10 +194,10 @@ void TIA::frameReset()
// In any event, at most 320 lines can be processed
uInt32 scanlines = myFrameYStart + myFrameHeight;
if(myMaximumNumberOfScanlines == 290)
scanlines = BSPF_max(scanlines, 262u); // NTSC
scanlines = BSPF::max(scanlines, 262u); // NTSC
else
scanlines = BSPF_max(scanlines, 312u); // PAL
myStopDisplayOffset = 228 * BSPF_min(scanlines, 320u);
scanlines = BSPF::max(scanlines, 312u); // PAL
myStopDisplayOffset = 228 * BSPF::min(scanlines, 320u);
// Reasonable values to start and stop the current frame drawing
myClockWhenFrameStarted = mySystem->cycles() * 3;
@ -2294,12 +2294,12 @@ void TIA::pokeHMP0(uInt8 value, Int32 clock)
// Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF_min(myCurrentHMOVEPos + 6 + myMotionClockP0 * 4, 7))
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockP0 * 4, 7))
{
Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockP0 ||
hpos <= BSPF_min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{
myPOSP0 -= (newMotion - myMotionClockP0);
myMotionClockP0 = newMotion;
@ -2328,12 +2328,12 @@ void TIA::pokeHMP1(uInt8 value, Int32 clock)
// Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF_min(myCurrentHMOVEPos + 6 + myMotionClockP1 * 4, 7))
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockP1 * 4, 7))
{
Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockP1 ||
hpos <= BSPF_min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{
myPOSP1 -= (newMotion - myMotionClockP1);
myMotionClockP1 = newMotion;
@ -2362,12 +2362,12 @@ void TIA::pokeHMM0(uInt8 value, Int32 clock)
// Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF_min(myCurrentHMOVEPos + 6 + myMotionClockM0 * 4, 7))
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockM0 * 4, 7))
{
Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockM0 ||
hpos <= BSPF_min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{
myPOSM0 -= (newMotion - myMotionClockM0);
myMotionClockM0 = newMotion;
@ -2395,12 +2395,12 @@ void TIA::pokeHMM1(uInt8 value, Int32 clock)
// Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF_min(myCurrentHMOVEPos + 6 + myMotionClockM1 * 4, 7))
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockM1 * 4, 7))
{
Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockM1 ||
hpos <= BSPF_min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{
myPOSM1 -= (newMotion - myMotionClockM1);
myMotionClockM1 = newMotion;
@ -2428,12 +2428,12 @@ void TIA::pokeHMBL(uInt8 value, Int32 clock)
// Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF_min(myCurrentHMOVEPos + 6 + myMotionClockBL * 4, 7))
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockBL * 4, 7))
{
Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockBL ||
hpos <= BSPF_min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{
myPOSBL -= (newMotion - myMotionClockBL);
myMotionClockBL = newMotion;
@ -2468,7 +2468,7 @@ void TIA::pokeHMBL(uInt8 value, Int32 clock)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline void TIA::applyActiveHMOVEMotion(int hpos, Int16& pos, Int32 motionClock)
{
if(hpos < BSPF_min(myCurrentHMOVEPos + 6 + 16 * 4, 7))
if(hpos < BSPF::min(myCurrentHMOVEPos + 6 + 16 * 4, 7))
{
Int32 decrements_passed = (hpos - (myCurrentHMOVEPos + 4)) >> 2;
pos += 8;

View File

@ -213,8 +213,8 @@ uInt32 TIASurface::enableScanlines(int relative, int absolute)
FBSurface::Attributes& attr = mySLineSurface->attributes();
if(relative == 0) attr.blendalpha = absolute;
else attr.blendalpha += relative;
attr.blendalpha = BSPF_max(0u, attr.blendalpha);
attr.blendalpha = BSPF_min(100u, attr.blendalpha);
attr.blendalpha = BSPF::max(0u, attr.blendalpha);
attr.blendalpha = BSPF::min(100u, attr.blendalpha);
mySLineSurface->applyAttributes();
mySLineSurface->setDirty();
@ -245,7 +245,7 @@ void TIASurface::enablePhosphor(bool enable, int blend)
uInt8 TIASurface::getPhosphor(uInt8 c1, uInt8 c2) const
{
if(c2 > c1)
BSPF_swap(c1, c2);
BSPF::swap(c1, c2);
return ((c1 - c2) * myPhosphorBlend)/100 + c2;
}

View File

@ -29,7 +29,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
// rowheight is determined by largest item on a line,
// possibly meaning that number of rows will change
_fontHeight = BSPF_max(_fontHeight, CheckboxWidget::boxSize());
_fontHeight = BSPF::max(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list

View File

@ -54,7 +54,7 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
// Get maximum width of popupwidget
int pwidth = 0;
for(const auto& s: combolist)
pwidth = BSPF_max(font.getStringWidth(s.first), pwidth);
pwidth = BSPF::max(font.getStringWidth(s.first), pwidth);
// Label for dialog, indicating which combo is being changed
myComboName = new StaticTextWidget(this, font, xpos, ypos, _w - xpos - 10,
@ -109,7 +109,7 @@ void ComboDialog::loadConfig()
{
StringList events = instance().eventHandler().getComboListForEvent(myComboEvent);
uInt32 size = BSPF_min(uInt32(events.size()), 8u);
uInt32 size = BSPF::min(uInt32(events.size()), 8u);
for(uInt32 i = 0; i < size; ++i)
myEvents[i]->setSelected("", events[i]);

View File

@ -55,7 +55,7 @@ void ContextMenu::addItems(const VariantList& items)
// Resize to largest string
int maxwidth = 0;
for(const auto& e: _entries)
maxwidth = BSPF_max(maxwidth, _font.getStringWidth(e.first));
maxwidth = BSPF::max(maxwidth, _font.getStringWidth(e.first));
_x = _y = 0;
_w = maxwidth + 10;
@ -100,7 +100,7 @@ void ContextMenu::recalc(const GUI::Rect& image)
{
// Now is the time to adjust the height
// If it's higher than the screen, we need to scroll through
uInt32 maxentries = BSPF_min(18u, (image.height() - 4) / _rowHeight);
uInt32 maxentries = BSPF::min(18u, (image.height() - 4) / _rowHeight);
if(_entries.size() > maxentries)
{
// We show two less than the max, so we have room for two scroll buttons
@ -133,7 +133,7 @@ void ContextMenu::setSelected(const Variant& tag, const Variant& defaultTag)
{
for(uInt32 item = 0; item < _entries.size(); ++item)
{
if(BSPF_equalsIgnoreCase(_entries[item].second.toString(), tag.toString()))
if(BSPF::equalsIgnoreCase(_entries[item].second.toString(), tag.toString()))
{
setSelectedIndex(item);
return;
@ -144,7 +144,7 @@ void ContextMenu::setSelected(const Variant& tag, const Variant& defaultTag)
// If we get this far, the value wasn't found; use the default value
for(uInt32 item = 0; item < _entries.size(); ++item)
{
if(BSPF_equalsIgnoreCase(_entries[item].second.toString(), defaultTag.toString()))
if(BSPF::equalsIgnoreCase(_entries[item].second.toString(), defaultTag.toString()))
{
setSelectedIndex(item);
return;
@ -495,7 +495,7 @@ void ContextMenu::scrollUp(int distance)
if(_firstEntry == 0)
return;
_firstEntry = BSPF_max(_firstEntry - distance, 0);
_firstEntry = BSPF::max(_firstEntry - distance, 0);
_scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor;
_scrollDnColor = kScrollColor;
@ -509,7 +509,7 @@ void ContextMenu::scrollDown(int distance)
if(_firstEntry == max_offset)
return;
_firstEntry = BSPF_min(_firstEntry + distance, max_offset);
_firstEntry = BSPF::min(_firstEntry + distance, max_offset);
_scrollUpColor = kScrollColor;
_scrollDnColor = _firstEntry < max_offset ? kScrollColor : kColor;

View File

@ -648,9 +648,9 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
const string& okText, const string& cancelText)
{
int buttonWidth = BSPF_max(font.getStringWidth("Cancel"),
BSPF_max(font.getStringWidth(okText),
font.getStringWidth(okText))) + 15;
int buttonWidth = BSPF::max(font.getStringWidth("Cancel"),
BSPF::max(font.getStringWidth(okText),
font.getStringWidth(okText))) + 15;
int buttonHeight = font.getLineHeight() + 4;
ButtonWidget* b;
#ifndef BSPF_MAC_OSX

View File

@ -214,8 +214,8 @@ void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y)
}
if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay)
&& BSPF_abs(myLastClick.x - x) < 3
&& BSPF_abs(myLastClick.y - y) < 3)
&& BSPF::abs(myLastClick.x - x) < 3
&& BSPF::abs(myLastClick.y - y) < 3)
{
myLastClick.count++;
}

View File

@ -64,7 +64,7 @@ void FileListWidget::setLocation(const FilesystemNode& node, string select)
bool isDir = file.isDirectory();
if(isDir)
name = " [" + name + "]";
else if(!BSPF_endsWithIgnoreCase(name, _extension))
else if(!BSPF::endsWithIgnoreCase(name, _extension))
continue;
_gameList.appendGame(name, file.getPath(), "", isDir);

View File

@ -436,7 +436,7 @@ void GameInfoDialog::loadView()
istringstream m_axis(myGameProperties.get(Controller_MouseAxis));
string m_control, m_range;
m_axis >> m_control;
bool autoAxis = BSPF_equalsIgnoreCase(m_control, "AUTO");
bool autoAxis = BSPF::equalsIgnoreCase(m_control, "AUTO");
if(autoAxis)
{
myMouseControl->setSelectedIndex(0);

View File

@ -221,10 +221,10 @@ void GlobalPropsDialog::loadConfig()
const string& holdjoy0 = settings.getString("holdjoy0");
for(int i = kJ0Up; i <= kJ0Fire; ++i)
myJoy[i]->setState(BSPF_containsIgnoreCase(holdjoy0, ourJoyState[i]));
myJoy[i]->setState(BSPF::containsIgnoreCase(holdjoy0, ourJoyState[i]));
const string& holdjoy1 = settings.getString("holdjoy1");
for(int i = kJ1Up; i <= kJ1Fire; ++i)
myJoy[i]->setState(BSPF_containsIgnoreCase(holdjoy1, ourJoyState[i]));
myJoy[i]->setState(BSPF::containsIgnoreCase(holdjoy1, ourJoyState[i]));
myHoldSelect->setState(settings.getBool("holdselect"));
myHoldReset->setState(settings.getBool("holdreset"));

View File

@ -46,8 +46,8 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
StringList actions;
// Set real dimensions
_w = BSPF_min(50 * fontWidth + 10, max_w);
_h = BSPF_min(15 * (lineHeight + 4) + 14, max_h);
_w = BSPF::min(50 * fontWidth + 10, max_w);
_h = BSPF::min(15 * (lineHeight + 4) + 14, max_h);
// The tab widget
xpos = 2; ypos = vBorder;

View File

@ -37,10 +37,10 @@ Launcher::Launcher(OSystem& osystem)
// The launcher dialog is resizable, within certain bounds
// We check those bounds now
myWidth = BSPF_max(myWidth, uInt32(FrameBuffer::kFBMinW));
myHeight = BSPF_max(myHeight, uInt32(FrameBuffer::kFBMinH));
myWidth = BSPF_min(myWidth, uInt32(d.w));
myHeight = BSPF_min(myHeight, uInt32(d.h));
myWidth = BSPF::max(myWidth, uInt32(FrameBuffer::kFBMinW));
myHeight = BSPF::max(myHeight, uInt32(FrameBuffer::kFBMinH));
myWidth = BSPF::min(myWidth, uInt32(d.w));
myHeight = BSPF::min(myHeight, uInt32(d.h));
myOSystem.settings().setValue("launcherres",
GUI::Size(myWidth, myHeight));

View File

@ -82,7 +82,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// It has to fit between both labels
if(w >= 640)
{
int fwidth = BSPF_min(15 * fontWidth, xpos - 20 - lwidth);
int fwidth = BSPF::min(15 * fontWidth, xpos - 20 - lwidth);
xpos -= fwidth + 5;
myPattern = new EditTextWidget(this, font, xpos, ypos,
fwidth, fontHeight, "");

View File

@ -126,7 +126,7 @@ bool LauncherFilterDialog::isValidRomName(const string& name,
const char* ext = name.c_str() + idx + 1;
for(const auto& s: exts)
if(BSPF_equalsIgnoreCase(ext, s))
if(BSPF::equalsIgnoreCase(ext, s))
return true;
}
@ -144,7 +144,7 @@ bool LauncherFilterDialog::isValidRomName(const FilesystemNode& node, string& ex
for(uInt32 i = 0; i < 5; ++i)
{
if(BSPF_equalsIgnoreCase(e, ourRomTypes[1][i]))
if(BSPF::equalsIgnoreCase(e, ourRomTypes[1][i]))
{
ext = e;
return true;

View File

@ -264,7 +264,7 @@ bool ListWidget::handleText(char text)
int newSelectedItem = 0;
for(const auto& i: _list)
{
if(BSPF_startsWithIgnoreCase(i, _quickSelectStr))
if(BSPF::startsWithIgnoreCase(i, _quickSelectStr))
{
_selectedItem = newSelectedItem;
break;

View File

@ -111,7 +111,7 @@ void LoggerDialog::saveConfig()
void LoggerDialog::saveLogFile()
{
ostringstream path;
path << "~" << BSPF_PATH_SEPARATOR << "stella.log";
path << "~" << BSPF::PATH_SEPARATOR << "stella.log";
FilesystemNode node(path.str());
ofstream out(node.getPath());

View File

@ -69,9 +69,9 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text)
// Set real dimensions
int str_w = 0;
for(const auto& s: text)
str_w = BSPF_max(int(s.length()), str_w);
_w = BSPF_min(str_w * fontWidth + 20, _w);
_h = BSPF_min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h));
str_w = BSPF::max(int(s.length()), str_w);
_w = BSPF::min(str_w * fontWidth + 20, _w);
_h = BSPF::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h));
xpos = 10; ypos = 10;
for(const auto& s: text)

View File

@ -100,7 +100,7 @@ void RomInfoWidget::parseProperties()
// Scale surface to available image area
const GUI::Rect& src = mySurface->srcRect();
float scale = BSPF_min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height());
float scale = BSPF::min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height());
mySurface->setDstSize(uInt32(src.width() * scale), uInt32(src.height() * scale));
}
catch(const runtime_error& e)

View File

@ -134,7 +134,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add message concerning usage
xpos = vBorder; ypos += 1*(lineHeight + 4);
lwidth = ifont.getStringWidth("(*) Changes require application restart");
new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF_min(lwidth, _w-20), fontHeight,
new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF::min(lwidth, _w-20), fontHeight,
"(*) Changes require application restart",
kTextAlignLeft);
@ -284,7 +284,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add message concerning usage
xpos = vBorder; ypos += 1*(lineHeight + 4);
lwidth = ifont.getStringWidth("(*) Requires application restart");
new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF_min(lwidth, _w-20), fontHeight,
new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF::min(lwidth, _w-20), fontHeight,
"(*) Requires application restart",
kTextAlignLeft);
@ -310,10 +310,10 @@ void UIDialog::loadConfig()
const GUI::Size& ls = instance().settings().getSize("launcherres");
uInt32 w = ls.w, h = ls.h;
w = BSPF_max(w, uInt32(FrameBuffer::kFBMinW));
h = BSPF_max(h, uInt32(FrameBuffer::kFBMinH));
w = BSPF_min(w, instance().frameBuffer().desktopSize().w);
h = BSPF_min(h, instance().frameBuffer().desktopSize().h);
w = BSPF::max(w, uInt32(FrameBuffer::kFBMinW));
h = BSPF::max(h, uInt32(FrameBuffer::kFBMinH));
w = BSPF::min(w, instance().frameBuffer().desktopSize().w);
h = BSPF::min(h, instance().frameBuffer().desktopSize().h);
myLauncherWidthSlider->setValue(w);
myLauncherWidthLabel->setValue(w);
@ -336,10 +336,10 @@ void UIDialog::loadConfig()
// Debugger size
const GUI::Size& ds = instance().settings().getSize("dbg.res");
w = ds.w, h = ds.h;
w = BSPF_max(w, uInt32(DebuggerDialog::kSmallFontMinW));
h = BSPF_max(h, uInt32(DebuggerDialog::kSmallFontMinH));
w = BSPF_min(w, ds.w);
h = BSPF_min(h, ds.h);
w = BSPF::max(w, uInt32(DebuggerDialog::kSmallFontMinW));
h = BSPF::max(h, uInt32(DebuggerDialog::kSmallFontMinH));
w = BSPF::min(w, ds.w);
h = BSPF::min(h, ds.h);
myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w);
@ -417,8 +417,8 @@ void UIDialog::setDefaults()
{
case 0: // Launcher options
{
uInt32 w = BSPF_min(instance().frameBuffer().desktopSize().w, 1000u);
uInt32 h = BSPF_min(instance().frameBuffer().desktopSize().h, 600u);
uInt32 w = BSPF::min(instance().frameBuffer().desktopSize().w, 1000u);
uInt32 h = BSPF::min(instance().frameBuffer().desktopSize().h, 600u);
myLauncherWidthSlider->setValue(w);
myLauncherWidthLabel->setValue(w);
myLauncherHeightSlider->setValue(h);
@ -432,8 +432,8 @@ void UIDialog::setDefaults()
case 1: // Debugger options
{
#ifdef DEBUGGER_SUPPORT
uInt32 w = BSPF_min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW));
uInt32 h = BSPF_min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH));
uInt32 w = BSPF::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW));
uInt32 h = BSPF::min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH));
myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h);

View File

@ -53,8 +53,8 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
VariantList items;
// Set real dimensions
_w = BSPF_min(52 * fontWidth + 10, max_w);
_h = BSPF_min(14 * (lineHeight + 4) + 10, max_h);
_w = BSPF::min(52 * fontWidth + 10, max_w);
_h = BSPF::min(14 * (lineHeight + 4) + 10, max_h);
// The tab widget
xpos = ypos = 5;

View File

@ -312,7 +312,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
void StaticTextWidget::setValue(int value)
{
char buf[256];
BSPF_snprintf(buf, 255, "%d", value);
BSPF::snprintf(buf, 255, "%d", value);
_label = buf;
setDirty();
@ -701,7 +701,7 @@ int SliderWidget::valueToPos(int value)
{
if(value < _valueMin) value = _valueMin;
else if(value > _valueMax) value = _valueMax;
int range = BSPF_max(_valueMax - _valueMin, 1); // don't divide by zero
int range = BSPF::max(_valueMax - _valueMin, 1); // don't divide by zero
return ((_w - _labelWidth - 4) * (value - _valueMin) / range);
}

View File

@ -81,7 +81,7 @@ string FilesystemNodePOSIX::getShortPath() const
{
// If the path starts with the home directory, replace it with '~'
const char* home = getenv("HOME");
if(home != NULL && BSPF_startsWithIgnoreCase(_path, home))
if(home != NULL && BSPF::startsWithIgnoreCase(_path, home))
{
string path = "~";
const char* offset = _path.c_str() + strlen(home);

View File

@ -206,7 +206,7 @@ string FilesystemNodeWINDOWS::getShortPath() const
{
// If the path starts with the home directory, replace it with '~'
const string& home = myHomeFinder.getHomePath();
if(home != "" && BSPF_startsWithIgnoreCase(_path, home))
if(home != "" && BSPF::startsWithIgnoreCase(_path, home))
{
string path = "~";
const char* offset = _path.c_str() + home.length();

View File

@ -173,29 +173,29 @@ int const_to_int(char* ch) {
// special methods that get e.g. CPU registers
CpuMethod getCpuSpecial(char* ch)
{
if(BSPF_equalsIgnoreCase(ch, "a"))
if(BSPF::equalsIgnoreCase(ch, "a"))
return &CpuDebug::a;
else if(BSPF_equalsIgnoreCase(ch, "x"))
else if(BSPF::equalsIgnoreCase(ch, "x"))
return &CpuDebug::x;
else if(BSPF_equalsIgnoreCase(ch, "y"))
else if(BSPF::equalsIgnoreCase(ch, "y"))
return &CpuDebug::y;
else if(BSPF_equalsIgnoreCase(ch, "pc"))
else if(BSPF::equalsIgnoreCase(ch, "pc"))
return &CpuDebug::pc;
else if(BSPF_equalsIgnoreCase(ch, "sp"))
else if(BSPF::equalsIgnoreCase(ch, "sp"))
return &CpuDebug::sp;
else if(BSPF_equalsIgnoreCase(ch, "c"))
else if(BSPF::equalsIgnoreCase(ch, "c"))
return &CpuDebug::c;
else if(BSPF_equalsIgnoreCase(ch, "z"))
else if(BSPF::equalsIgnoreCase(ch, "z"))
return &CpuDebug::z;
else if(BSPF_equalsIgnoreCase(ch, "n"))
else if(BSPF::equalsIgnoreCase(ch, "n"))
return &CpuDebug::n;
else if(BSPF_equalsIgnoreCase(ch, "v"))
else if(BSPF::equalsIgnoreCase(ch, "v"))
return &CpuDebug::v;
else if(BSPF_equalsIgnoreCase(ch, "d"))
else if(BSPF::equalsIgnoreCase(ch, "d"))
return &CpuDebug::d;
else if(BSPF_equalsIgnoreCase(ch, "i"))
else if(BSPF::equalsIgnoreCase(ch, "i"))
return &CpuDebug::i;
else if(BSPF_equalsIgnoreCase(ch, "b"))
else if(BSPF::equalsIgnoreCase(ch, "b"))
return &CpuDebug::b;
else
return 0;
@ -204,9 +204,9 @@ CpuMethod getCpuSpecial(char* ch)
// special methods that get Cart RAM/ROM internal state
CartMethod getCartSpecial(char* ch)
{
if(BSPF_equalsIgnoreCase(ch, "_bank"))
if(BSPF::equalsIgnoreCase(ch, "_bank"))
return &CartDebug::getBank;
else if(BSPF_equalsIgnoreCase(ch, "_rwport"))
else if(BSPF::equalsIgnoreCase(ch, "_rwport"))
return &CartDebug::readFromWritePort;
else
return 0;
@ -215,15 +215,15 @@ CartMethod getCartSpecial(char* ch)
// special methods that get TIA internal state
TiaMethod getTiaSpecial(char* ch)
{
if(BSPF_equalsIgnoreCase(ch, "_scan"))
if(BSPF::equalsIgnoreCase(ch, "_scan"))
return &TIADebug::scanlines;
else if(BSPF_equalsIgnoreCase(ch, "_fcount"))
else if(BSPF::equalsIgnoreCase(ch, "_fcount"))
return &TIADebug::frameCount;
else if(BSPF_equalsIgnoreCase(ch, "_cclocks"))
else if(BSPF::equalsIgnoreCase(ch, "_cclocks"))
return &TIADebug::clocksThisLine;
else if(BSPF_equalsIgnoreCase(ch, "_vsync"))
else if(BSPF::equalsIgnoreCase(ch, "_vsync"))
return &TIADebug::vsyncAsInt;
else if(BSPF_equalsIgnoreCase(ch, "_vblank"))
else if(BSPF::equalsIgnoreCase(ch, "_vblank"))
return &TIADebug::vblankAsInt;
else
return 0;