mirror of https://github.com/stella-emu/stella.git
After thinking about it a little, I wondered why we even need to wrap several
std:: functions into BSPF namespace at all. So I removed them, and have the calls map directly to the std:: versions. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3304 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
91e3afb3bb
commit
8dbd545433
|
@ -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);
|
||||
std::snprintf(vToS_buf, 4, "%3d", value);
|
||||
else
|
||||
BSPF::snprintf(vToS_buf, 6, "%5d", value);
|
||||
std::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);
|
||||
std::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);
|
||||
std::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);
|
||||
std::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);
|
||||
std::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);
|
||||
std::snprintf(vToS_buf, 3, myFmt[1], value);
|
||||
else if(value < 0x10000)
|
||||
BSPF::snprintf(vToS_buf, 5, myFmt[2], value);
|
||||
std::snprintf(vToS_buf, 5, myFmt[2], value);
|
||||
else
|
||||
BSPF::snprintf(vToS_buf, 9, myFmt[3], value);
|
||||
std::snprintf(vToS_buf, 9, myFmt[3], value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)),
|
||||
std::min(input_remaining, (uInt32)sizeof(zip->buffer)),
|
||||
read_length);
|
||||
if(!success)
|
||||
{
|
||||
|
|
|
@ -97,13 +97,6 @@ namespace BSPF
|
|||
// Some convenience functions
|
||||
template<typename T> inline T clamp(T a, T l, T u) { return (a<l) ? l : (a>u) ? u : a; }
|
||||
|
||||
using std::swap;
|
||||
using std::min;
|
||||
using std::max;
|
||||
using std::abs;
|
||||
using std::snprintf;
|
||||
using std::vsnprintf;
|
||||
|
||||
// Compare two strings, ignoring case
|
||||
inline int compareIgnoreCase(const string& s1, const string& s2)
|
||||
{
|
||||
|
|
|
@ -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 = std::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",
|
||||
std::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 = std::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 = std::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 = std::max(myLabelLength, uInt16(label.size()));
|
||||
mySystem.setDirtyPage(address);
|
||||
return true;
|
||||
}
|
||||
|
@ -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 = std::max(max_len, int(iter.second.size()));
|
||||
for(const auto& iter: myUserLabels)
|
||||
out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n";
|
||||
}
|
||||
|
|
|
@ -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 = std::max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW));
|
||||
myHeight = std::max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH));
|
||||
myWidth = std::min(myWidth, uInt32(d.w));
|
||||
myHeight = std::min(myHeight, uInt32(d.h));
|
||||
|
||||
myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight));
|
||||
|
||||
|
|
|
@ -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) std::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) std::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) std::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) std::swap(beg, end);
|
||||
|
||||
for(uInt32 i = beg; i <= end; ++i)
|
||||
{
|
||||
|
|
|
@ -706,7 +706,7 @@ string TIADebug::audFreq(uInt8 div)
|
|||
|
||||
double hz = 30000.0;
|
||||
if(div) hz /= div;
|
||||
BSPF::snprintf(buf, 9, "%5.1f", hz);
|
||||
std::snprintf(buf, 9, "%5.1f", hz);
|
||||
ret += buf;
|
||||
ret += "Hz";
|
||||
|
||||
|
|
|
@ -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(), std::min(dbg.internalRamSize() / 16, 16u),
|
||||
std::min(dbg.internalRamSize() / 16, 16u) * 16),
|
||||
myCart(dbg)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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 = std::max(0, lower);
|
||||
_upperBound = std::min(1 << _bits, upper);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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, std::max(260, int(_h * 0.35)));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = std::max(font.getStringWidth(buf.str()),
|
||||
font.getStringWidth("Controller input"));
|
||||
new StaticTextWidget(boss, font, x, y+2, lwidth,
|
||||
fontHeight, buf.str(), kTextAlignLeft);
|
||||
|
|
|
@ -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 = std::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 = std::vsnprintf(buf, sizeof(buf), format, argptr);
|
||||
|
||||
print(buf);
|
||||
return count;
|
||||
|
|
|
@ -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);
|
||||
std::snprintf(buf, 5, "%04X", rport);
|
||||
buf[2] = buf[3] = 'x';
|
||||
myRamStart->setLabel(buf);
|
||||
for(uInt32 row = 0; row < myNumRows; ++row, page += 0x10)
|
||||
|
|
|
@ -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 = std::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 = std::max(_fontHeight, CheckboxWidget::boxSize());
|
||||
_rows = h / _fontHeight;
|
||||
|
||||
// Create a CheckboxWidget for each row in the list
|
||||
|
|
|
@ -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 = std::min(w, 320);
|
||||
_h = std::min(h, 260);
|
||||
|
||||
addFocusWidget(this);
|
||||
|
||||
|
|
|
@ -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, std::min(8192u, size));
|
||||
createCodeAccessBase(8192);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(4096u, size));
|
||||
createCodeAccessBase(4096);
|
||||
}
|
||||
|
||||
|
|
|
@ -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, std::min(4096u, size));
|
||||
createCodeAccessBase(4096);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
|
||||
const Settings& settings)
|
||||
: Cartridge(settings),
|
||||
mySize(BSPF::max(size, 8448u)),
|
||||
mySize(std::max(size, 8448u)),
|
||||
myLoadImages(nullptr),
|
||||
myWriteEnabled(false),
|
||||
myPower(true),
|
||||
|
|
|
@ -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, std::min(262144u, size));
|
||||
createCodeAccessBase(262144);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(262144u, size));
|
||||
createCodeAccessBase(262144);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(16384u, size));
|
||||
createCodeAccessBase(16384);
|
||||
|
||||
// On powerup, the last bank of ROM is enabled and RAM is disabled
|
||||
|
|
|
@ -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, std::min(32768u, size));
|
||||
createCodeAccessBase(32768);
|
||||
|
||||
// Point to the first tune
|
||||
|
|
|
@ -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, std::min(131072u, size));
|
||||
createCodeAccessBase(131072);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(131072u, size));
|
||||
createCodeAccessBase(131072);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(size, 8192u + 2048u + 256u));
|
||||
createCodeAccessBase(8192);
|
||||
|
||||
// Pointer to the program ROM (8K @ 0 byte offset)
|
||||
|
|
|
@ -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 = std::max(minsize, size);
|
||||
myImage = make_ptr<uInt8[]>(mySize);
|
||||
memcpy(myImage.get(), image, size);
|
||||
createCodeAccessBase(4096 * 6);
|
||||
|
|
|
@ -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, std::min(8192u, size));
|
||||
createCodeAccessBase(8192);
|
||||
}
|
||||
|
||||
|
|
|
@ -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, std::min(16384u, size));
|
||||
createCodeAccessBase(16384 + 2048);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(65536u, size));
|
||||
createCodeAccessBase(65536);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(65536u, size));
|
||||
createCodeAccessBase(65536);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(65536u, size));
|
||||
createCodeAccessBase(65536);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(32768u, size));
|
||||
createCodeAccessBase(32768);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(32768u, size));
|
||||
createCodeAccessBase(32768);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(16384u, size));
|
||||
createCodeAccessBase(16384);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(16384u, size));
|
||||
createCodeAccessBase(16384);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(8192u, size));
|
||||
createCodeAccessBase(8192);
|
||||
|
||||
// Normally bank 1 is the reset bank, unless we're dealing with ROMs
|
||||
|
|
|
@ -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, std::min(8192u, size));
|
||||
createCodeAccessBase(8192);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::min(12288u, size));
|
||||
createCodeAccessBase(12288);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -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, std::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
|
||||
|
|
|
@ -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, std::min(8192u, size));
|
||||
createCodeAccessBase(8192);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size,
|
||||
const Settings& settings)
|
||||
: Cartridge(settings),
|
||||
mySize(BSPF::min(8195u, size)),
|
||||
mySize(std::min(8195u, size)),
|
||||
myCyclesAtBankswitchInit(0),
|
||||
myPendingBank(0),
|
||||
myCurrentBank(0)
|
||||
|
|
|
@ -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, std::min(65536u, size));
|
||||
createCodeAccessBase(65536);
|
||||
|
||||
// Remember startup bank
|
||||
|
|
|
@ -560,7 +560,7 @@ void Console::setTIAProperties()
|
|||
myConsoleInfo.InitialFrameRate = "50";
|
||||
|
||||
// PAL ROMs normally need at least 250 lines
|
||||
height = BSPF::max(height, 250u);
|
||||
height = std::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 = std::min(ystart, 64u);
|
||||
height = dheight;
|
||||
}
|
||||
myTIA->setYStart(ystart);
|
||||
|
|
|
@ -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 = std::min(rect.width(), width());
|
||||
uInt32 h = std::min(rect.height(), height());
|
||||
|
||||
// Copy 'height' lines of width 'pitch' (in bytes for both)
|
||||
uInt8* dst = buffer;
|
||||
|
|
|
@ -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 = std::max(query_w, uInt32(kFBMinW));
|
||||
myDesktopSize.h = std::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",
|
||||
std::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 = std::max(sw, uInt32(FrameBuffer::kTIAMinW));
|
||||
sh = std::max(sh, uInt32(FrameBuffer::kTIAMinH));
|
||||
iw = std::min(iw, sw);
|
||||
ih = std::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 = std::min(iw, screen.w);
|
||||
ih = std::min(ih, screen.h);
|
||||
|
||||
image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1);
|
||||
image.setWidth(iw);
|
||||
|
|
|
@ -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 = std::max(scanlines, 262u); // NTSC
|
||||
else
|
||||
scanlines = BSPF::max(scanlines, 312u); // PAL
|
||||
myStopDisplayOffset = 228 * BSPF::min(scanlines, 320u);
|
||||
scanlines = std::max(scanlines, 312u); // PAL
|
||||
myStopDisplayOffset = 228 * std::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 < std::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 <= std::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 < std::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 <= std::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 < std::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 <= std::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 < std::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 <= std::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 < std::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 <= std::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 < std::min(myCurrentHMOVEPos + 6 + 16 * 4, 7))
|
||||
{
|
||||
Int32 decrements_passed = (hpos - (myCurrentHMOVEPos + 4)) >> 2;
|
||||
pos += 8;
|
||||
|
|
|
@ -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 = std::max(0u, attr.blendalpha);
|
||||
attr.blendalpha = std::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);
|
||||
std::swap(c1, c2);
|
||||
|
||||
return ((c1 - c2) * myPhosphorBlend)/100 + c2;
|
||||
}
|
||||
|
|
|
@ -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 = std::max(_fontHeight, CheckboxWidget::boxSize());
|
||||
_rows = h / _fontHeight;
|
||||
|
||||
// Create a CheckboxWidget for each row in the list
|
||||
|
|
|
@ -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 = std::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 = std::min(uInt32(events.size()), 8u);
|
||||
for(uInt32 i = 0; i < size; ++i)
|
||||
myEvents[i]->setSelected("", events[i]);
|
||||
|
||||
|
|
|
@ -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 = std::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 = std::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
|
||||
|
@ -495,7 +495,7 @@ void ContextMenu::scrollUp(int distance)
|
|||
if(_firstEntry == 0)
|
||||
return;
|
||||
|
||||
_firstEntry = BSPF::max(_firstEntry - distance, 0);
|
||||
_firstEntry = std::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 = std::min(_firstEntry + distance, max_offset);
|
||||
_scrollUpColor = kScrollColor;
|
||||
_scrollDnColor = _firstEntry < max_offset ? kScrollColor : kColor;
|
||||
|
||||
|
|
|
@ -648,8 +648,8 @@ 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),
|
||||
int buttonWidth = std::max(font.getStringWidth("Cancel"),
|
||||
std::max(font.getStringWidth(okText),
|
||||
font.getStringWidth(okText))) + 15;
|
||||
int buttonHeight = font.getLineHeight() + 4;
|
||||
ButtonWidget* b;
|
||||
|
|
|
@ -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)
|
||||
&& std::abs(myLastClick.x - x) < 3
|
||||
&& std::abs(myLastClick.y - y) < 3)
|
||||
{
|
||||
myLastClick.count++;
|
||||
}
|
||||
|
|
|
@ -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 = std::min(50 * fontWidth + 10, max_w);
|
||||
_h = std::min(15 * (lineHeight + 4) + 14, max_h);
|
||||
|
||||
// The tab widget
|
||||
xpos = 2; ypos = vBorder;
|
||||
|
|
|
@ -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 = std::max(myWidth, uInt32(FrameBuffer::kFBMinW));
|
||||
myHeight = std::max(myHeight, uInt32(FrameBuffer::kFBMinH));
|
||||
myWidth = std::min(myWidth, uInt32(d.w));
|
||||
myHeight = std::min(myHeight, uInt32(d.h));
|
||||
|
||||
myOSystem.settings().setValue("launcherres",
|
||||
GUI::Size(myWidth, myHeight));
|
||||
|
|
|
@ -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 = std::min(15 * fontWidth, xpos - 20 - lwidth);
|
||||
xpos -= fwidth + 5;
|
||||
myPattern = new EditTextWidget(this, font, xpos, ypos,
|
||||
fwidth, fontHeight, "");
|
||||
|
|
|
@ -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 = std::max(int(s.length()), str_w);
|
||||
_w = std::min(str_w * fontWidth + 20, _w);
|
||||
_h = std::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h));
|
||||
|
||||
xpos = 10; ypos = 10;
|
||||
for(const auto& s: text)
|
||||
|
|
|
@ -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 = std::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)
|
||||
|
|
|
@ -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, std::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, std::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 = std::max(w, uInt32(FrameBuffer::kFBMinW));
|
||||
h = std::max(h, uInt32(FrameBuffer::kFBMinH));
|
||||
w = std::min(w, instance().frameBuffer().desktopSize().w);
|
||||
h = std::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 = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW));
|
||||
h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH));
|
||||
w = std::min(w, ds.w);
|
||||
h = std::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 = std::min(instance().frameBuffer().desktopSize().w, 1000u);
|
||||
uInt32 h = std::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 = std::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW));
|
||||
uInt32 h = std::min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH));
|
||||
myDebuggerWidthSlider->setValue(w);
|
||||
myDebuggerWidthLabel->setValue(w);
|
||||
myDebuggerHeightSlider->setValue(h);
|
||||
|
|
|
@ -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 = std::min(52 * fontWidth + 10, max_w);
|
||||
_h = std::min(14 * (lineHeight + 4) + 10, max_h);
|
||||
|
||||
// The tab widget
|
||||
xpos = ypos = 5;
|
||||
|
|
|
@ -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);
|
||||
std::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 = std::max(_valueMax - _valueMin, 1); // don't divide by zero
|
||||
|
||||
return ((_w - _labelWidth - 4) * (value - _valueMin) / range);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue