Move to C++14, now that all the minimum required compilers support it.

Clang 3.8, gcc 5, Visual Studio 2017 and Xcode 8 are now the minimum
supported compilers, and they all support C++14, so we may as well use it.

 - Change all make_ptr to make_unique
 - Change iterator begin(), end(), etc to const versions where appropriate
 - Remove UniquePtr, since C++14 supports it natively
This commit is contained in:
Stephen Anthony 2017-07-21 21:10:13 -02:30
parent 5c114e69d2
commit cd689941b6
55 changed files with 220 additions and 289 deletions

View File

@ -51,7 +51,7 @@ else
endif endif
CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers
ifdef HAVE_GCC ifdef HAVE_GCC
CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++11 CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
endif endif
ifdef PROFILE ifdef PROFILE

2
configure vendored
View File

@ -360,7 +360,7 @@ else
fi fi
for compiler in $compilers; do for compiler in $compilers; do
if test_compiler "$compiler -std=c++11"; then if test_compiler "$compiler -std=c++14"; then
CXX=$compiler CXX=$compiler
echo $CXX echo $CXX
break break

View File

@ -81,7 +81,7 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
StringList labels; StringList labels;
labels.push_back("Name "); labels.push_back("Name ");
labels.push_back("Code (hex) "); labels.push_back("Code (hex) ");
myCheatInput = make_ptr<InputTextDialog>(this, font, labels); myCheatInput = make_unique<InputTextDialog>(this, font, labels);
myCheatInput->setTarget(this); myCheatInput->setTarget(this);
// Add filtering for each textfield // Add filtering for each textfield

View File

@ -207,4 +207,4 @@ AbstractFSNode* FilesystemNodeZIP::getParent() const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<ZipHandler> FilesystemNodeZIP::myZipHandler = make_ptr<ZipHandler>(); unique_ptr<ZipHandler> FilesystemNodeZIP::myZipHandler = make_unique<ZipHandler>();

View File

@ -287,7 +287,7 @@ void FrameBufferSDL2::setWindowIcon()
unique_ptr<FBSurface> FrameBufferSDL2::createSurface(uInt32 w, uInt32 h, unique_ptr<FBSurface> FrameBufferSDL2::createSurface(uInt32 w, uInt32 h,
const uInt32* data) const const uInt32* data) const
{ {
return make_ptr<FBSurfaceSDL2>(const_cast<FrameBufferSDL2&>(*this), w, h, data); return make_unique<FBSurfaceSDL2>(const_cast<FrameBufferSDL2&>(*this), w, h, data);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -67,11 +67,11 @@ class MediaFactory
static unique_ptr<OSystem> createOSystem() static unique_ptr<OSystem> createOSystem()
{ {
#if defined(BSPF_UNIX) #if defined(BSPF_UNIX)
return make_ptr<OSystemUNIX>(); return make_unique<OSystemUNIX>();
#elif defined(BSPF_WINDOWS) #elif defined(BSPF_WINDOWS)
return make_ptr<OSystemWINDOWS>(); return make_unique<OSystemWINDOWS>();
#elif defined(BSPF_MAC_OSX) #elif defined(BSPF_MAC_OSX)
return make_ptr<OSystemMACOSX>(); return make_unique<OSystemMACOSX>();
#else #else
#error Unsupported platform for OSystem! #error Unsupported platform for OSystem!
#endif #endif
@ -80,11 +80,11 @@ class MediaFactory
static unique_ptr<Settings> createSettings(OSystem& osystem) static unique_ptr<Settings> createSettings(OSystem& osystem)
{ {
#if defined(BSPF_UNIX) #if defined(BSPF_UNIX)
return make_ptr<SettingsUNIX>(osystem); return make_unique<SettingsUNIX>(osystem);
#elif defined(BSPF_WINDOWS) #elif defined(BSPF_WINDOWS)
return make_ptr<SettingsWINDOWS>(osystem); return make_unique<SettingsWINDOWS>(osystem);
#elif defined(BSPF_MAC_OSX) #elif defined(BSPF_MAC_OSX)
return make_ptr<SettingsMACOSX>(osystem); return make_unique<SettingsMACOSX>(osystem);
#else #else
#error Unsupported platform for Settings! #error Unsupported platform for Settings!
#endif #endif
@ -93,33 +93,33 @@ class MediaFactory
static unique_ptr<SerialPort> createSerialPort() static unique_ptr<SerialPort> createSerialPort()
{ {
#if defined(BSPF_UNIX) #if defined(BSPF_UNIX)
return make_ptr<SerialPortUNIX>(); return make_unique<SerialPortUNIX>();
#elif defined(BSPF_WINDOWS) #elif defined(BSPF_WINDOWS)
return make_ptr<SerialPortWINDOWS>(); return make_unique<SerialPortWINDOWS>();
#elif defined(BSPF_MAC_OSX) #elif defined(BSPF_MAC_OSX)
return make_ptr<SerialPortMACOSX>(); return make_unique<SerialPortMACOSX>();
#else #else
return make_ptr<SerialPort>(); return make_unique<SerialPort>();
#endif #endif
} }
static unique_ptr<FrameBuffer> createVideo(OSystem& osystem) static unique_ptr<FrameBuffer> createVideo(OSystem& osystem)
{ {
return make_ptr<FrameBufferSDL2>(osystem); return make_unique<FrameBufferSDL2>(osystem);
} }
static unique_ptr<Sound> createAudio(OSystem& osystem) static unique_ptr<Sound> createAudio(OSystem& osystem)
{ {
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
return make_ptr<SoundSDL2>(osystem); return make_unique<SoundSDL2>(osystem);
#else #else
return make_ptr<SoundNull>(osystem); return make_unique<SoundNull>(osystem);
#endif #endif
} }
static unique_ptr<EventHandler> createEventHandler(OSystem& osystem) static unique_ptr<EventHandler> createEventHandler(OSystem& osystem)
{ {
return make_ptr<EventHandlerSDL2>(osystem); return make_unique<EventHandlerSDL2>(osystem);
} }
private: private:

View File

@ -125,11 +125,11 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments)
png_uint_32 width = rect.width(), height = rect.height(); png_uint_32 width = rect.width(), height = rect.height();
// Get framebuffer pixel data (we get ABGR format) // Get framebuffer pixel data (we get ABGR format)
unique_ptr<png_byte[]> buffer = make_ptr<png_byte[]>(width * height * 4); unique_ptr<png_byte[]> buffer = make_unique<png_byte[]>(width * height * 4);
myFB.readPixels(buffer.get(), width*4, rect); myFB.readPixels(buffer.get(), width*4, rect);
// Set up pointers into "buffer" byte array // Set up pointers into "buffer" byte array
unique_ptr<png_bytep[]> rows = make_ptr<png_bytep[]>(height); unique_ptr<png_bytep[]> rows = make_unique<png_bytep[]>(height);
for(png_uint_32 k = 0; k < height; ++k) for(png_uint_32 k = 0; k < height; ++k)
rows[k] = png_bytep(buffer.get() + k*width*4); rows[k] = png_bytep(buffer.get() + k*width*4);
@ -154,11 +154,11 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface,
} }
// Get the surface pixel data (we get ABGR format) // Get the surface pixel data (we get ABGR format)
unique_ptr<png_byte[]> buffer = make_ptr<png_byte[]>(width * height * 4); unique_ptr<png_byte[]> buffer = make_unique<png_byte[]>(width * height * 4);
surface.readPixels(buffer.get(), width, rect); surface.readPixels(buffer.get(), width, rect);
// Set up pointers into "buffer" byte array // Set up pointers into "buffer" byte array
unique_ptr<png_bytep[]> rows = make_ptr<png_bytep[]>(height); unique_ptr<png_bytep[]> rows = make_unique<png_bytep[]>(height);
for(png_uint_32 k = 0; k < height; ++k) for(png_uint_32 k = 0; k < height; ++k)
rows[k] = png_bytep(buffer.get() + k*width*4); rows[k] = png_bytep(buffer.get() + k*width*4);
@ -234,7 +234,7 @@ bool PNGLibrary::allocateStorage(png_uint_32 w, png_uint_32 h)
uInt32 req_buffer_size = w * h * 3; uInt32 req_buffer_size = w * h * 3;
if(req_buffer_size > ReadInfo.buffer_size) if(req_buffer_size > ReadInfo.buffer_size)
{ {
ReadInfo.buffer = make_ptr<png_byte[]>(req_buffer_size); ReadInfo.buffer = make_unique<png_byte[]>(req_buffer_size);
if(ReadInfo.buffer == nullptr) if(ReadInfo.buffer == nullptr)
return false; return false;
@ -243,7 +243,7 @@ bool PNGLibrary::allocateStorage(png_uint_32 w, png_uint_32 h)
uInt32 req_row_size = h; uInt32 req_row_size = h;
if(req_row_size > ReadInfo.row_size) if(req_row_size > ReadInfo.row_size)
{ {
ReadInfo.row_pointers = make_ptr<png_bytep[]>(req_row_size); ReadInfo.row_pointers = make_unique<png_bytep[]>(req_row_size);
if(ReadInfo.row_pointers == nullptr) if(ReadInfo.row_pointers == nullptr)
return false; return false;
@ -293,7 +293,7 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr,
if(numComments == 0) if(numComments == 0)
return; return;
unique_ptr<png_text[]> text_ptr = make_ptr<png_text[]>(numComments); unique_ptr<png_text[]> text_ptr = make_unique<png_text[]>(numComments);
for(uInt32 i = 0; i < numComments; ++i) for(uInt32 i = 0; i < numComments; ++i)
{ {
text_ptr[i].key = const_cast<char*>(comments[i].first.c_str()); text_ptr[i].key = const_cast<char*>(comments[i].first.c_str());

View File

@ -440,7 +440,7 @@ bool SoundSDL2::load(Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundSDL2::RegWriteQueue::RegWriteQueue(uInt32 capacity) SoundSDL2::RegWriteQueue::RegWriteQueue(uInt32 capacity)
: myBuffer(make_ptr<RegWrite[]>(capacity)), : myBuffer(make_unique<RegWrite[]>(capacity)),
myCapacity(capacity), myCapacity(capacity),
mySize(0), mySize(0),
myHead(0), myHead(0),
@ -504,7 +504,7 @@ uInt32 SoundSDL2::RegWriteQueue::size() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL2::RegWriteQueue::grow() void SoundSDL2::RegWriteQueue::grow()
{ {
unique_ptr<RegWrite[]> buffer = make_ptr<RegWrite[]>(myCapacity*2); unique_ptr<RegWrite[]> buffer = make_unique<RegWrite[]>(myCapacity*2);
for(uInt32 i = 0; i < mySize; ++i) for(uInt32 i = 0; i < mySize; ++i)
buffer[i] = myBuffer[(myHead + i) % myCapacity]; buffer[i] = myBuffer[(myHead + i) % myCapacity];

View File

@ -1,65 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef UNIQUE_PTR_HXX
#define UNIQUE_PTR_HXX
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
/**
The following templates implement 'make_unique' from C++14, which is
named 'make_ptr' here. Eventually, when compilers are updated, this code
can be removed.
@author Stephen Anthony, based on a C++14 proposal by Stephan T. Lavavej.
*/
namespace std {
template<class T> struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template<class T> struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template<class T, size_t N> struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
template<class T, class... Args>
typename _Unique_if<T>::_Single_object
make_ptr(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template<class T>
typename _Unique_if<T>::_Unknown_bound
make_ptr(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_ptr(Args&&...) = delete;
}
#endif

View File

@ -25,19 +25,19 @@ namespace Vec {
template<class T> template<class T>
void append(vector<T>& dst, const vector<T>& src) void append(vector<T>& dst, const vector<T>& src)
{ {
dst.insert(dst.end(), src.begin(), src.end()); dst.insert(dst.cend(), src.cbegin(), src.cend());
} }
template<class T> template<class T>
void insertAt(vector<T>& dst, uInt32 idx, const T& element) void insertAt(vector<T>& dst, uInt32 idx, const T& element)
{ {
dst.insert(dst.begin()+idx, element); dst.insert(dst.cbegin()+idx, element);
} }
template<class T> template<class T>
void removeAt(vector<T>& dst, uInt32 idx) void removeAt(vector<T>& dst, uInt32 idx)
{ {
dst.erase(dst.begin()+idx); dst.erase(dst.cbegin()+idx);
} }
} // Namespace Vec } // Namespace Vec

View File

@ -102,7 +102,7 @@ uInt32 ZipHandler::decompress(BytePtr& image)
if(myZip) if(myZip)
{ {
uInt32 length = myZip->header.uncompressed_length; uInt32 length = myZip->header.uncompressed_length;
image = make_ptr<uInt8[]>(length); image = make_unique<uInt8[]>(length);
ZipHandler::zip_error err = zip_file_decompress(myZip, image.get(), length); ZipHandler::zip_error err = zip_file_decompress(myZip, image.get(), length);
if(err == ZIPERR_NONE) if(err == ZIPERR_NONE)

View File

@ -49,7 +49,6 @@ using uInt64 = uint64_t;
#include <cstdio> #include <cstdio>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "UniquePtr.hxx" // only until C++14 compilers are more common
using std::cin; using std::cin;
using std::cout; using std::cout;
@ -67,7 +66,7 @@ using std::istringstream;
using std::stringstream; using std::stringstream;
using std::unique_ptr; using std::unique_ptr;
using std::shared_ptr; using std::shared_ptr;
using std::make_ptr; using std::make_unique;
using std::make_shared; using std::make_shared;
using std::array; using std::array;
using std::vector; using std::vector;
@ -163,11 +162,11 @@ namespace BSPF
// starting from 'startpos' in the first string // starting from 'startpos' in the first string
inline size_t 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(), auto pos = std::search(s1.cbegin()+startpos, s1.cend(),
s2.begin(), s2.end(), [](char ch1, char ch2) { s2.cbegin(), s2.cend(), [](char ch1, char ch2) {
return toupper(uInt8(ch1)) == toupper(uInt8(ch2)); return toupper(uInt8(ch1)) == toupper(uInt8(ch2));
}); });
return pos == s1.end() ? string::npos : size_t(pos - (s1.begin()+startpos)); return pos == s1.cend() ? string::npos : size_t(pos - (s1.cbegin()+startpos));
} }
// Test whether the first string ends with the second one (case insensitive) // Test whether the first string ends with the second one (case insensitive)

View File

@ -266,8 +266,8 @@ bool CartDebug::disassemble(bool force)
// Distella expects the addresses to be unique and in sorted order // Distella expects the addresses to be unique and in sorted order
if(bankChanged || !pcfound) if(bankChanged || !pcfound)
{ {
AddressList::iterator i; // TODO - change to C++11 const when available AddressList::const_iterator i;
for(i = addresses.begin(); i != addresses.end(); ++i) for(i = addresses.cbegin(); i != addresses.cend(); ++i)
{ {
if(PC < *i) if(PC < *i)
{ {

View File

@ -117,13 +117,13 @@ Debugger::Debugger(OSystem& osystem, Console& console)
myHeight(DebuggerDialog::kSmallFontMinH) myHeight(DebuggerDialog::kSmallFontMinH)
{ {
// Init parser // Init parser
myParser = make_ptr<DebuggerParser>(*this, osystem.settings()); myParser = make_unique<DebuggerParser>(*this, osystem.settings());
// Create debugger subsystems // Create debugger subsystems
myCpuDebug = make_ptr<CpuDebug>(*this, myConsole); myCpuDebug = make_unique<CpuDebug>(*this, myConsole);
myCartDebug = make_ptr<CartDebug>(*this, myConsole, osystem); myCartDebug = make_unique<CartDebug>(*this, myConsole, osystem);
myRiotDebug = make_ptr<RiotDebug>(*this, myConsole); myRiotDebug = make_unique<RiotDebug>(*this, myConsole);
myTiaDebug = make_ptr<TIADebug>(*this, myConsole); myTiaDebug = make_unique<TIADebug>(*this, myConsole);
// Allow access to this object from any class // Allow access to this object from any class
// Technically this violates pure OO programming, but since I know // Technically this violates pure OO programming, but since I know
@ -152,7 +152,7 @@ void Debugger::initialize()
myDialog = new DebuggerDialog(myOSystem, *this, 0, 0, myWidth, myHeight); myDialog = new DebuggerDialog(myOSystem, *this, 0, 0, myWidth, myHeight);
myBaseDialog = myDialog; myBaseDialog = myDialog;
myRewindManager = make_ptr<RewindManager>(myOSystem, myDialog->rewindButton()); myRewindManager = make_unique<RewindManager>(myOSystem, myDialog->rewindButton());
myCartDebug->setDebugWidget(&(myDialog->cartDebug())); myCartDebug->setDebugWidget(&(myDialog->cartDebug()));
} }

View File

@ -42,7 +42,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
bool resolve_code = mySettings.resolve_code; bool resolve_code = mySettings.resolve_code;
CartDebug::AddressList::iterator it = addresses.begin(); auto it = addresses.cbegin();
uInt16 start = *it++; uInt16 start = *it++;
myOffset = info.offset; myOffset = info.offset;

View File

@ -210,53 +210,53 @@ void DebuggerDialog::createFont()
if(_w >= kLargeFontMinW && _h >= kLargeFontMinH) if(_w >= kLargeFontMinW && _h >= kLargeFontMinH)
{ {
// Large font doesn't use fontstyle at all // Large font doesn't use fontstyle at all
myLFont = make_ptr<GUI::Font>(GUI::stellaMediumDesc); myLFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
myNFont = make_ptr<GUI::Font>(GUI::stellaMediumDesc); myNFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
} }
else if(_w >= kMediumFontMinW && _h >= kMediumFontMinH) else if(_w >= kMediumFontMinW && _h >= kMediumFontMinH)
{ {
if(fontstyle == 1) if(fontstyle == 1)
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc); myLFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc); myNFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
} }
else if(fontstyle == 2) else if(fontstyle == 2)
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc); myLFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc); myNFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
} }
else if(fontstyle == 3) else if(fontstyle == 3)
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc); myLFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc); myNFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
} }
else // default to zero else // default to zero
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc); myLFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc); myNFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
} }
} }
else else
{ {
if(fontstyle == 1) if(fontstyle == 1)
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleBDesc); myLFont = make_unique<GUI::Font>(GUI::consoleBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleDesc); myNFont = make_unique<GUI::Font>(GUI::consoleDesc);
} }
else if(fontstyle == 2) else if(fontstyle == 2)
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleDesc); myLFont = make_unique<GUI::Font>(GUI::consoleDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleBDesc); myNFont = make_unique<GUI::Font>(GUI::consoleBDesc);
} }
else if(fontstyle == 3) else if(fontstyle == 3)
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleBDesc); myLFont = make_unique<GUI::Font>(GUI::consoleBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleBDesc); myNFont = make_unique<GUI::Font>(GUI::consoleBDesc);
} }
else // default to zero else // default to zero
{ {
myLFont = make_ptr<GUI::Font>(GUI::consoleDesc); myLFont = make_unique<GUI::Font>(GUI::consoleDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleDesc); myNFont = make_unique<GUI::Font>(GUI::consoleDesc);
} }
} }
} }
@ -264,7 +264,7 @@ void DebuggerDialog::createFont()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::showFatalMessage(const string& msg) void DebuggerDialog::showFatalMessage(const string& msg)
{ {
myFatalError = make_ptr<GUI::MessageBox>(this, *myLFont, msg, _w/2, _h/2, myFatalError = make_unique<GUI::MessageBox>(this, *myLFont, msg, _w/2, _h/2,
kDDExitFatalCmd, "Exit ROM", "Continue"); kDDExitFatalCmd, "Exit ROM", "Continue");
myFatalError->show(); myFatalError->show();
} }

View File

@ -146,7 +146,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Inputbox which will pop up when searching RAM // Inputbox which will pop up when searching RAM
StringList labels = { "Search " }; StringList labels = { "Search " };
myInputBox = make_ptr<InputTextDialog>(boss, lfont, nfont, labels); myInputBox = make_unique<InputTextDialog>(boss, lfont, nfont, labels);
myInputBox->setTarget(this); myInputBox->setTarget(this);
// Start with these buttons disabled // Start with these buttons disabled

View File

@ -58,7 +58,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
myScrollBar->setTarget(this); myScrollBar->setTarget(this);
// Add settings menu // Add settings menu
myMenu = make_ptr<RomListSettings>(this, lfont); myMenu = make_unique<RomListSettings>(this, lfont);
// Take advantage of a wide debugger window when possible // Take advantage of a wide debugger window when possible
const int fontWidth = lfont.getMaxCharWidth(), const int fontWidth = lfont.getMaxCharWidth(),

View File

@ -46,7 +46,7 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(l, "Set breakpoint", "bp"); VarList::push_back(l, "Set breakpoint", "bp");
VarList::push_back(l, "Set zoom position", "zoom"); VarList::push_back(l, "Set zoom position", "zoom");
VarList::push_back(l, "Save snapshot", "snap"); VarList::push_back(l, "Save snapshot", "snap");
myMenu = make_ptr<ContextMenu>(this, font, l); myMenu = make_unique<ContextMenu>(this, font, l);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -55,7 +55,7 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(l, "2x zoom", "2"); VarList::push_back(l, "2x zoom", "2");
VarList::push_back(l, "4x zoom", "4"); VarList::push_back(l, "4x zoom", "4");
VarList::push_back(l, "8x zoom", "8"); VarList::push_back(l, "8x zoom", "8");
myMenu = make_ptr<ContextMenu>(this, font, l); myMenu = make_unique<ContextMenu>(this, font, l);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -35,7 +35,7 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
else else
myAboutString = " (invalid serial port \'" + portname + "\')"; myAboutString = " (invalid serial port \'" + portname + "\')";
myEEPROM = make_ptr<MT24LC256>(eepromfile, system); myEEPROM = make_unique<MT24LC256>(eepromfile, system);
myDigitalPinState[One] = myDigitalPinState[Two] = myDigitalPinState[One] = myDigitalPinState[Two] =
myDigitalPinState[Three] = myDigitalPinState[Four] = true; myDigitalPinState[Three] = myDigitalPinState[Four] = true;

View File

@ -80,7 +80,7 @@ void Cartridge::triggerReadFromWritePort(uInt16 address)
void Cartridge::createCodeAccessBase(uInt32 size) void Cartridge::createCodeAccessBase(uInt32 size)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myCodeAccessBase = make_ptr<uInt8[]>(size); myCodeAccessBase = make_unique<uInt8[]>(size);
memset(myCodeAccessBase.get(), CartDebug::ROW, size); memset(myCodeAccessBase.get(), CartDebug::ROW, size);
#else #else
myCodeAccessBase = nullptr; myCodeAccessBase = nullptr;

View File

@ -38,7 +38,7 @@ Cartridge2K::Cartridge2K(const BytePtr& image, uInt32 size,
mySize = 64; mySize = 64;
// Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam // Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
memset(myImage.get(), 0x02, mySize); memset(myImage.get(), 0x02, mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer

View File

@ -27,7 +27,7 @@ Cartridge3E::Cartridge3E(const BytePtr& image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -26,7 +26,7 @@ Cartridge3EPlus::Cartridge3EPlus(const BytePtr& image, uInt32 size,
mySize(size) mySize(size)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -27,7 +27,7 @@ Cartridge3F::Cartridge3F(const BytePtr& image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -33,7 +33,7 @@ CartridgeAR::CartridgeAR(const BytePtr& image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Create a load image buffer and copy the given image // Create a load image buffer and copy the given image
myLoadImages = make_ptr<uInt8[]>(mySize); myLoadImages = make_unique<uInt8[]>(mySize);
myNumberOfLoadImages = mySize / 8448; myNumberOfLoadImages = mySize / 8448;
memcpy(myLoadImages.get(), image.get(), size); memcpy(myLoadImages.get(), image.get(), size);

View File

@ -65,7 +65,7 @@ CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size,
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator // Create Thumbulator ARM emulator
myThumbEmulator = make_ptr<Thumbulator>((uInt16*)myImage, (uInt16*)myBUSRAM, myThumbEmulator = make_unique<Thumbulator>((uInt16*)myImage, (uInt16*)myBUSRAM,
settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this); settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this);
#endif #endif
setInitialState(); setInitialState();

View File

@ -64,7 +64,7 @@ CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
myDisplayImage = myCDFRAM + DSRAM; myDisplayImage = myCDFRAM + DSRAM;
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator // Create Thumbulator ARM emulator
myThumbEmulator = make_ptr<Thumbulator>((uInt16*)myImage, (uInt16*)myCDFRAM, myThumbEmulator = make_unique<Thumbulator>((uInt16*)myImage, (uInt16*)myCDFRAM,
settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::CDF, this); settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::CDF, this);
#endif #endif
setInitialState(); setInitialState();

View File

@ -38,7 +38,7 @@ CartridgeCV::CartridgeCV(const BytePtr& image, uInt32 size,
memcpy(myImage, image.get() + 2048, 2048); memcpy(myImage, image.get() + 2048, 2048);
// Copy the RAM image into a buffer for use in reset() // Copy the RAM image into a buffer for use in reset()
myInitialRAM = make_ptr<uInt8[]>(1024); myInitialRAM = make_unique<uInt8[]>(1024);
memcpy(myInitialRAM.get(), image.get(), 1024); memcpy(myInitialRAM.get(), image.get(), 1024);
} }
createCodeAccessBase(2048+1024); createCodeAccessBase(2048+1024);

View File

@ -27,7 +27,7 @@ CartridgeCVPlus::CartridgeCVPlus(const BytePtr& image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -26,7 +26,7 @@ CartridgeDASH::CartridgeDASH(const BytePtr& image, uInt32 size,
mySize(size) mySize(size)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -54,7 +54,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size,
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator // Create Thumbulator ARM emulator
myThumbEmulator = make_ptr<Thumbulator> myThumbEmulator = make_unique<Thumbulator>
(reinterpret_cast<uInt16*>(myImage), (reinterpret_cast<uInt16*>(myImage),
reinterpret_cast<uInt16*>(myDPCRAM), reinterpret_cast<uInt16*>(myDPCRAM),
settings.getBool("thumb.trapfatal"), settings.getBool("thumb.trapfatal"),

View File

@ -210,7 +210,7 @@ CartDetector::createFromMultiCart(const BytePtr& image, uInt32& size,
// Get a piece of the larger image // Get a piece of the larger image
uInt32 i = osystem.settings().getInt("romloadcount"); uInt32 i = osystem.settings().getInt("romloadcount");
size /= numroms; size /= numroms;
BytePtr slice = make_ptr<uInt8[]>(size); BytePtr slice = make_unique<uInt8[]>(size);
memcpy(slice.get(), image.get()+i*size, size); memcpy(slice.get(), image.get()+i*size, size);
// We need a new md5 and name // We need a new md5 and name
@ -239,89 +239,89 @@ CartDetector::createFromImage(const BytePtr& image, uInt32 size, BSType type,
switch(type) switch(type)
{ {
case BSType::_0840: case BSType::_0840:
return make_ptr<Cartridge0840>(image, size, osystem.settings()); return make_unique<Cartridge0840>(image, size, osystem.settings());
case BSType::_2K: case BSType::_2K:
return make_ptr<Cartridge2K>(image, size, osystem.settings()); return make_unique<Cartridge2K>(image, size, osystem.settings());
case BSType::_3E: case BSType::_3E:
return make_ptr<Cartridge3E>(image, size, osystem.settings()); return make_unique<Cartridge3E>(image, size, osystem.settings());
case BSType::_3EP: case BSType::_3EP:
return make_ptr<Cartridge3EPlus>(image, size, osystem.settings()); return make_unique<Cartridge3EPlus>(image, size, osystem.settings());
case BSType::_3F: case BSType::_3F:
return make_ptr<Cartridge3F>(image, size, osystem.settings()); return make_unique<Cartridge3F>(image, size, osystem.settings());
case BSType::_4A50: case BSType::_4A50:
return make_ptr<Cartridge4A50>(image, size, osystem.settings()); return make_unique<Cartridge4A50>(image, size, osystem.settings());
case BSType::_4K: case BSType::_4K:
return make_ptr<Cartridge4K>(image, size, osystem.settings()); return make_unique<Cartridge4K>(image, size, osystem.settings());
case BSType::_4KSC: case BSType::_4KSC:
return make_ptr<Cartridge4KSC>(image, size, osystem.settings()); return make_unique<Cartridge4KSC>(image, size, osystem.settings());
case BSType::_AR: case BSType::_AR:
return make_ptr<CartridgeAR>(image, size, osystem.settings()); return make_unique<CartridgeAR>(image, size, osystem.settings());
case BSType::_BUS: case BSType::_BUS:
return make_ptr<CartridgeBUS>(image, size, osystem.settings()); return make_unique<CartridgeBUS>(image, size, osystem.settings());
case BSType::_CDF: case BSType::_CDF:
return make_ptr<CartridgeCDF>(image, size, osystem.settings()); return make_unique<CartridgeCDF>(image, size, osystem.settings());
case BSType::_CM: case BSType::_CM:
return make_ptr<CartridgeCM>(image, size, osystem.settings()); return make_unique<CartridgeCM>(image, size, osystem.settings());
case BSType::_CTY: case BSType::_CTY:
return make_ptr<CartridgeCTY>(image, size, osystem); return make_unique<CartridgeCTY>(image, size, osystem);
case BSType::_CV: case BSType::_CV:
return make_ptr<CartridgeCV>(image, size, osystem.settings()); return make_unique<CartridgeCV>(image, size, osystem.settings());
case BSType::_CVP: case BSType::_CVP:
return make_ptr<CartridgeCVPlus>(image, size, osystem.settings()); return make_unique<CartridgeCVPlus>(image, size, osystem.settings());
case BSType::_DASH: case BSType::_DASH:
return make_ptr<CartridgeDASH>(image, size, osystem.settings()); return make_unique<CartridgeDASH>(image, size, osystem.settings());
case BSType::_DPC: case BSType::_DPC:
return make_ptr<CartridgeDPC>(image, size, osystem.settings()); return make_unique<CartridgeDPC>(image, size, osystem.settings());
case BSType::_DPCP: case BSType::_DPCP:
return make_ptr<CartridgeDPCPlus>(image, size, osystem.settings()); return make_unique<CartridgeDPCPlus>(image, size, osystem.settings());
case BSType::_E0: case BSType::_E0:
return make_ptr<CartridgeE0>(image, size, osystem.settings()); return make_unique<CartridgeE0>(image, size, osystem.settings());
case BSType::_E7: case BSType::_E7:
return make_ptr<CartridgeE7>(image, size, osystem.settings()); return make_unique<CartridgeE7>(image, size, osystem.settings());
case BSType::_EF: case BSType::_EF:
return make_ptr<CartridgeEF>(image, size, osystem.settings()); return make_unique<CartridgeEF>(image, size, osystem.settings());
case BSType::_EFSC: case BSType::_EFSC:
return make_ptr<CartridgeEFSC>(image, size, osystem.settings()); return make_unique<CartridgeEFSC>(image, size, osystem.settings());
case BSType::_BF: case BSType::_BF:
return make_ptr<CartridgeBF>(image, size, osystem.settings()); return make_unique<CartridgeBF>(image, size, osystem.settings());
case BSType::_BFSC: case BSType::_BFSC:
return make_ptr<CartridgeBFSC>(image, size, osystem.settings()); return make_unique<CartridgeBFSC>(image, size, osystem.settings());
case BSType::_DF: case BSType::_DF:
return make_ptr<CartridgeDF>(image, size, osystem.settings()); return make_unique<CartridgeDF>(image, size, osystem.settings());
case BSType::_DFSC: case BSType::_DFSC:
return make_ptr<CartridgeDFSC>(image, size, osystem.settings()); return make_unique<CartridgeDFSC>(image, size, osystem.settings());
case BSType::_F0: case BSType::_F0:
return make_ptr<CartridgeF0>(image, size, osystem.settings()); return make_unique<CartridgeF0>(image, size, osystem.settings());
case BSType::_F4: case BSType::_F4:
return make_ptr<CartridgeF4>(image, size, osystem.settings()); return make_unique<CartridgeF4>(image, size, osystem.settings());
case BSType::_F4SC: case BSType::_F4SC:
return make_ptr<CartridgeF4SC>(image, size, osystem.settings()); return make_unique<CartridgeF4SC>(image, size, osystem.settings());
case BSType::_F6: case BSType::_F6:
return make_ptr<CartridgeF6>(image, size, osystem.settings()); return make_unique<CartridgeF6>(image, size, osystem.settings());
case BSType::_F6SC: case BSType::_F6SC:
return make_ptr<CartridgeF6SC>(image, size, osystem.settings()); return make_unique<CartridgeF6SC>(image, size, osystem.settings());
case BSType::_F8: case BSType::_F8:
return make_ptr<CartridgeF8>(image, size, md5, osystem.settings()); return make_unique<CartridgeF8>(image, size, md5, osystem.settings());
case BSType::_F8SC: case BSType::_F8SC:
return make_ptr<CartridgeF8SC>(image, size, osystem.settings()); return make_unique<CartridgeF8SC>(image, size, osystem.settings());
case BSType::_FA: case BSType::_FA:
return make_ptr<CartridgeFA>(image, size, osystem.settings()); return make_unique<CartridgeFA>(image, size, osystem.settings());
case BSType::_FA2: case BSType::_FA2:
return make_ptr<CartridgeFA2>(image, size, osystem); return make_unique<CartridgeFA2>(image, size, osystem);
case BSType::_FE: case BSType::_FE:
return make_ptr<CartridgeFE>(image, size, osystem.settings()); return make_unique<CartridgeFE>(image, size, osystem.settings());
case BSType::_MC: case BSType::_MC:
return make_ptr<CartridgeMC>(image, size, osystem.settings()); return make_unique<CartridgeMC>(image, size, osystem.settings());
case BSType::_MDM: case BSType::_MDM:
return make_ptr<CartridgeMDM>(image, size, osystem.settings()); return make_unique<CartridgeMDM>(image, size, osystem.settings());
case BSType::_UA: case BSType::_UA:
return make_ptr<CartridgeUA>(image, size, osystem.settings()); return make_unique<CartridgeUA>(image, size, osystem.settings());
case BSType::_SB: case BSType::_SB:
return make_ptr<CartridgeSB>(image, size, osystem.settings()); return make_unique<CartridgeSB>(image, size, osystem.settings());
case BSType::_WD: case BSType::_WD:
return make_ptr<CartridgeWD>(image, size, osystem.settings()); return make_unique<CartridgeWD>(image, size, osystem.settings());
case BSType::_X07: case BSType::_X07:
return make_ptr<CartridgeX07>(image, size, osystem.settings()); return make_unique<CartridgeX07>(image, size, osystem.settings());
default: default:
return nullptr; // The remaining types have already been handled return nullptr; // The remaining types have already been handled
} }

View File

@ -27,7 +27,7 @@ CartridgeMDM::CartridgeMDM(const BytePtr& image, uInt32 size,
myBankingDisabled(false) myBankingDisabled(false)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -26,7 +26,7 @@ CartridgeSB::CartridgeSB(const BytePtr& image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = make_ptr<uInt8[]>(mySize); myImage = make_unique<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize); memcpy(myImage.get(), image.get(), mySize);

View File

@ -29,8 +29,8 @@ CompuMate::CompuMate(const Console& console, const Event& event,
{ {
// These controller pointers will be retrieved by the Console, which will // These controller pointers will be retrieved by the Console, which will
// also take ownership of them // also take ownership of them
myLeftController = make_ptr<CMControl>(*this, Controller::Left, event, system); myLeftController = make_unique<CMControl>(*this, Controller::Left, event, system);
myRightController = make_ptr<CMControl>(*this, Controller::Right, event, system); myRightController = make_unique<CMControl>(*this, Controller::Right, event, system);
myLeftController->updateAnalogPin(Controller::Nine, Controller::maximumResistance); myLeftController->updateAnalogPin(Controller::Nine, Controller::maximumResistance);
myLeftController->updateAnalogPin(Controller::Five, Controller::minimumResistance); myLeftController->updateAnalogPin(Controller::Five, Controller::minimumResistance);

View File

@ -85,20 +85,20 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
loadUserPalette(); loadUserPalette();
// Create subsystems for the console // Create subsystems for the console
my6502 = make_ptr<M6502>(myOSystem.settings()); my6502 = make_unique<M6502>(myOSystem.settings());
myRiot = make_ptr<M6532>(*this, myOSystem.settings()); myRiot = make_unique<M6532>(*this, myOSystem.settings());
myTIA = make_ptr<TIA>(*this, myOSystem.sound(), myOSystem.settings()); myTIA = make_unique<TIA>(*this, myOSystem.sound(), myOSystem.settings());
mySwitches = make_ptr<Switches>(myEvent, myProperties); mySwitches = make_unique<Switches>(myEvent, myProperties);
// Construct the system and components // Construct the system and components
mySystem = make_ptr<System>(osystem, *my6502, *myRiot, *myTIA, *myCart); mySystem = make_unique<System>(osystem, *my6502, *myRiot, *myTIA, *myCart);
// The real controllers for this console will be added later // The real controllers for this console will be added later
// For now, we just add dummy joystick controllers, since autodetection // For now, we just add dummy joystick controllers, since autodetection
// runs the emulation for a while, and this may interfere with 'smart' // runs the emulation for a while, and this may interfere with 'smart'
// controllers such as the AVox and SaveKey // controllers such as the AVox and SaveKey
myLeftControl = make_ptr<Joystick>(Controller::Left, myEvent, *mySystem); myLeftControl = make_unique<Joystick>(Controller::Left, myEvent, *mySystem);
myRightControl = make_ptr<Joystick>(Controller::Right, myEvent, *mySystem); myRightControl = make_unique<Joystick>(Controller::Right, myEvent, *mySystem);
// We can only initialize after all the devices/components have been created // We can only initialize after all the devices/components have been created
mySystem->initialize(); mySystem->initialize();
@ -727,19 +727,19 @@ void Console::setControllers(const string& rommd5)
// Already created in c'tor // Already created in c'tor
// We save some time by not looking at all the other types // We save some time by not looking at all the other types
if(!leftC) if(!leftC)
leftC = make_ptr<Joystick>(Controller::Left, myEvent, *mySystem); leftC = make_unique<Joystick>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "BOOSTERGRIP") else if(left == "BOOSTERGRIP")
{ {
leftC = make_ptr<BoosterGrip>(Controller::Left, myEvent, *mySystem); leftC = make_unique<BoosterGrip>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "DRIVING") else if(left == "DRIVING")
{ {
leftC = make_ptr<Driving>(Controller::Left, myEvent, *mySystem); leftC = make_unique<Driving>(Controller::Left, myEvent, *mySystem);
} }
else if((left == "KEYBOARD") || (left == "KEYPAD")) else if((left == "KEYBOARD") || (left == "KEYPAD"))
{ {
leftC = make_ptr<Keyboard>(Controller::Left, myEvent, *mySystem); leftC = make_unique<Keyboard>(Controller::Left, myEvent, *mySystem);
} }
else if(BSPF::startsWithIgnoreCase(left, "PADDLES")) else if(BSPF::startsWithIgnoreCase(left, "PADDLES"))
{ {
@ -750,28 +750,28 @@ void Console::setControllers(const string& rommd5)
swapDir = true; swapDir = true;
else if(left == "PADDLES_IAXDR") else if(left == "PADDLES_IAXDR")
swapAxis = swapDir = true; swapAxis = swapDir = true;
leftC = make_ptr<Paddles>(Controller::Left, myEvent, *mySystem, leftC = make_unique<Paddles>(Controller::Left, myEvent, *mySystem,
swapPaddles, swapAxis, swapDir); swapPaddles, swapAxis, swapDir);
} }
else if(left == "AMIGAMOUSE") else if(left == "AMIGAMOUSE")
{ {
leftC = make_ptr<AmigaMouse>(Controller::Left, myEvent, *mySystem); leftC = make_unique<AmigaMouse>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "ATARIMOUSE") else if(left == "ATARIMOUSE")
{ {
leftC = make_ptr<AtariMouse>(Controller::Left, myEvent, *mySystem); leftC = make_unique<AtariMouse>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "TRAKBALL") else if(left == "TRAKBALL")
{ {
leftC = make_ptr<TrakBall>(Controller::Left, myEvent, *mySystem); leftC = make_unique<TrakBall>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "GENESIS") else if(left == "GENESIS")
{ {
leftC = make_ptr<Genesis>(Controller::Left, myEvent, *mySystem); leftC = make_unique<Genesis>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "MINDLINK") else if(left == "MINDLINK")
{ {
leftC = make_ptr<MindLink>(Controller::Left, myEvent, *mySystem); leftC = make_unique<MindLink>(Controller::Left, myEvent, *mySystem);
} }
// Construct right controller // Construct right controller
@ -780,19 +780,19 @@ void Console::setControllers(const string& rommd5)
// Already created in c'tor // Already created in c'tor
// We save some time by not looking at all the other types // We save some time by not looking at all the other types
if(!rightC) if(!rightC)
rightC = make_ptr<Joystick>(Controller::Right, myEvent, *mySystem); rightC = make_unique<Joystick>(Controller::Right, myEvent, *mySystem);
} }
else if(right == "BOOSTERGRIP") else if(right == "BOOSTERGRIP")
{ {
rightC = make_ptr<BoosterGrip>(Controller::Right, myEvent, *mySystem); rightC = make_unique<BoosterGrip>(Controller::Right, myEvent, *mySystem);
} }
else if(right == "DRIVING") else if(right == "DRIVING")
{ {
rightC = make_ptr<Driving>(Controller::Right, myEvent, *mySystem); rightC = make_unique<Driving>(Controller::Right, myEvent, *mySystem);
} }
else if((right == "KEYBOARD") || (right == "KEYPAD")) else if((right == "KEYBOARD") || (right == "KEYPAD"))
{ {
rightC = make_ptr<Keyboard>(Controller::Right, myEvent, *mySystem); rightC = make_unique<Keyboard>(Controller::Right, myEvent, *mySystem);
} }
else if(BSPF::startsWithIgnoreCase(right, "PADDLES")) else if(BSPF::startsWithIgnoreCase(right, "PADDLES"))
{ {
@ -803,45 +803,45 @@ void Console::setControllers(const string& rommd5)
swapDir = true; swapDir = true;
else if(right == "PADDLES_IAXDR") else if(right == "PADDLES_IAXDR")
swapAxis = swapDir = true; swapAxis = swapDir = true;
rightC = make_ptr<Paddles>(Controller::Right, myEvent, *mySystem, rightC = make_unique<Paddles>(Controller::Right, myEvent, *mySystem,
swapPaddles, swapAxis, swapDir); swapPaddles, swapAxis, swapDir);
} }
else if(left == "AMIGAMOUSE") else if(left == "AMIGAMOUSE")
{ {
rightC = make_ptr<AmigaMouse>(Controller::Left, myEvent, *mySystem); rightC = make_unique<AmigaMouse>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "ATARIMOUSE") else if(left == "ATARIMOUSE")
{ {
rightC = make_ptr<AtariMouse>(Controller::Left, myEvent, *mySystem); rightC = make_unique<AtariMouse>(Controller::Left, myEvent, *mySystem);
} }
else if(left == "TRAKBALL") else if(left == "TRAKBALL")
{ {
rightC = make_ptr<TrakBall>(Controller::Left, myEvent, *mySystem); rightC = make_unique<TrakBall>(Controller::Left, myEvent, *mySystem);
} }
else if(right == "ATARIVOX") else if(right == "ATARIVOX")
{ {
const string& nvramfile = myOSystem.nvramDir() + "atarivox_eeprom.dat"; const string& nvramfile = myOSystem.nvramDir() + "atarivox_eeprom.dat";
rightC = make_ptr<AtariVox>(Controller::Right, myEvent, rightC = make_unique<AtariVox>(Controller::Right, myEvent,
*mySystem, myOSystem.serialPort(), *mySystem, myOSystem.serialPort(),
myOSystem.settings().getString("avoxport"), nvramfile); myOSystem.settings().getString("avoxport"), nvramfile);
} }
else if(right == "SAVEKEY") else if(right == "SAVEKEY")
{ {
const string& nvramfile = myOSystem.nvramDir() + "savekey_eeprom.dat"; const string& nvramfile = myOSystem.nvramDir() + "savekey_eeprom.dat";
rightC = make_ptr<SaveKey>(Controller::Right, myEvent, *mySystem, rightC = make_unique<SaveKey>(Controller::Right, myEvent, *mySystem,
nvramfile); nvramfile);
} }
else if(right == "GENESIS") else if(right == "GENESIS")
{ {
rightC = make_ptr<Genesis>(Controller::Right, myEvent, *mySystem); rightC = make_unique<Genesis>(Controller::Right, myEvent, *mySystem);
} }
else if(right == "KIDVID") else if(right == "KIDVID")
{ {
rightC = make_ptr<KidVid>(Controller::Right, myEvent, *mySystem, rommd5); rightC = make_unique<KidVid>(Controller::Right, myEvent, *mySystem, rommd5);
} }
else if(right == "MINDLINK") else if(right == "MINDLINK")
{ {
rightC = make_ptr<MindLink>(Controller::Right, myEvent, *mySystem); rightC = make_unique<MindLink>(Controller::Right, myEvent, *mySystem);
} }
// Swap the ports if necessary // Swap the ports if necessary

View File

@ -76,7 +76,7 @@ EventHandler::EventHandler(OSystem& osystem)
myComboTable[i][j] = Event::NoType; myComboTable[i][j] = Event::NoType;
// Create joystick handler (to handle all joystick functionality) // Create joystick handler (to handle all joystick functionality)
myJoyHandler = make_ptr<JoystickHandler>(osystem); myJoyHandler = make_unique<JoystickHandler>(osystem);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1283,7 +1283,7 @@ void EventHandler::setKeymap()
if(event == Event::LastType && map.size() == KBDK_LAST * kNumModes) if(event == Event::LastType && map.size() == KBDK_LAST * kNumModes)
{ {
// Fill the keymap table with events // Fill the keymap table with events
auto e = map.begin(); auto e = map.cbegin();
for(int mode = 0; mode < kNumModes; ++mode) for(int mode = 0; mode < kNumModes; ++mode)
for(int i = 0; i < KBDK_LAST; ++i) for(int i = 0; i < KBDK_LAST; ++i)
myKeyTable[i][mode] = Event::Type(*e++); myKeyTable[i][mode] = Event::Type(*e++);
@ -1920,7 +1920,7 @@ void EventHandler::setMouseControllerMode(const string& enable)
const string& control = usemouse ? const string& control = usemouse ?
myOSystem.console().properties().get(Controller_MouseAxis) : "none"; myOSystem.console().properties().get(Controller_MouseAxis) : "none";
myMouseControl = make_ptr<MouseControl>(myOSystem.console(), control); myMouseControl = make_unique<MouseControl>(myOSystem.console(), control);
myMouseControl->next(); // set first available mode myMouseControl->next(); // set first available mode
} }
} }

View File

@ -138,7 +138,7 @@ bool EventHandler::StellaJoystick::setMap(const string& mapString)
if(int(map.size()) == numAxes * 2 * kNumModes) if(int(map.size()) == numAxes * 2 * kNumModes)
{ {
// Fill the axes table with events // Fill the axes table with events
auto event = map.begin(); auto event = map.cbegin();
for(int m = 0; m < kNumModes; ++m) for(int m = 0; m < kNumModes; ++m)
for(int a = 0; a < numAxes; ++a) for(int a = 0; a < numAxes; ++a)
for(int k = 0; k < 2; ++k) for(int k = 0; k < 2; ++k)
@ -147,7 +147,7 @@ bool EventHandler::StellaJoystick::setMap(const string& mapString)
getValues(items[2], map); getValues(items[2], map);
if(int(map.size()) == numButtons * kNumModes) if(int(map.size()) == numButtons * kNumModes)
{ {
auto event = map.begin(); auto event = map.cbegin();
for(int m = 0; m < kNumModes; ++m) for(int m = 0; m < kNumModes; ++m)
for(int b = 0; b < numButtons; ++b) for(int b = 0; b < numButtons; ++b)
btnTable[b][m] = Event::Type(*event++); btnTable[b][m] = Event::Type(*event++);
@ -155,7 +155,7 @@ bool EventHandler::StellaJoystick::setMap(const string& mapString)
getValues(items[3], map); getValues(items[3], map);
if(int(map.size()) == numHats * 4 * kNumModes) if(int(map.size()) == numHats * 4 * kNumModes)
{ {
auto event = map.begin(); auto event = map.cbegin();
for(int m = 0; m < kNumModes; ++m) for(int m = 0; m < kNumModes; ++m)
for(int h = 0; h < numHats; ++h) for(int h = 0; h < numHats; ++h)
for(int k = 0; k < 4; ++k) for(int k = 0; k < 4; ++k)

View File

@ -189,7 +189,7 @@ uInt32 FilesystemNode::read(BytePtr& image) const
gzFile f = gzopen(getPath().c_str(), "rb"); gzFile f = gzopen(getPath().c_str(), "rb");
if(f) if(f)
{ {
image = make_ptr<uInt8[]>(512 * 1024); image = make_unique<uInt8[]>(512 * 1024);
size = gzread(f, image.get(), 512 * 1024); size = gzread(f, image.get(), 512 * 1024);
gzclose(f); gzclose(f);

View File

@ -88,15 +88,15 @@ bool FrameBuffer::initialize()
// This font is used in a variety of situations when a really small // This font is used in a variety of situations when a really small
// font is needed; we let the specific widget/dialog decide when to // font is needed; we let the specific widget/dialog decide when to
// use it // use it
mySmallFont = make_ptr<GUI::Font>(GUI::stellaDesc); mySmallFont = make_unique<GUI::Font>(GUI::stellaDesc);
// The general font used in all UI elements // The general font used in all UI elements
// This is determined by the size of the framebuffer // This is determined by the size of the framebuffer
myFont = make_ptr<GUI::Font>(smallScreen ? GUI::stellaDesc : GUI::stellaMediumDesc); myFont = make_unique<GUI::Font>(smallScreen ? GUI::stellaDesc : GUI::stellaMediumDesc);
// The info font used in all UI elements // The info font used in all UI elements
// This is determined by the size of the framebuffer // This is determined by the size of the framebuffer
myInfoFont = make_ptr<GUI::Font>(smallScreen ? GUI::stellaDesc : GUI::consoleDesc); myInfoFont = make_unique<GUI::Font>(smallScreen ? GUI::stellaDesc : GUI::consoleDesc);
// The font used by the ROM launcher // The font used by the ROM launcher
// Normally, this is configurable by the user, except in the case of // Normally, this is configurable by the user, except in the case of
@ -105,14 +105,14 @@ bool FrameBuffer::initialize()
{ {
const string& lf = myOSystem.settings().getString("launcherfont"); const string& lf = myOSystem.settings().getString("launcherfont");
if(lf == "small") if(lf == "small")
myLauncherFont = make_ptr<GUI::Font>(GUI::consoleDesc); myLauncherFont = make_unique<GUI::Font>(GUI::consoleDesc);
else if(lf == "medium") else if(lf == "medium")
myLauncherFont = make_ptr<GUI::Font>(GUI::stellaMediumDesc); myLauncherFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
else else
myLauncherFont = make_ptr<GUI::Font>(GUI::stellaLargeDesc); myLauncherFont = make_unique<GUI::Font>(GUI::stellaLargeDesc);
} }
else else
myLauncherFont = make_ptr<GUI::Font>(GUI::stellaDesc); myLauncherFont = make_unique<GUI::Font>(GUI::stellaDesc);
// Determine possible TIA windowed zoom levels // Determine possible TIA windowed zoom levels
uInt32 maxZoom = maxWindowSizeForScreen(uInt32(kTIAMinW), uInt32(kTIAMinH), uInt32 maxZoom = maxWindowSizeForScreen(uInt32(kTIAMinW), uInt32(kTIAMinH),
@ -141,7 +141,7 @@ bool FrameBuffer::initialize()
FBSurface::setPalette(myPalette); FBSurface::setPalette(myPalette);
// Create a TIA surface; we need it for rendering TIA images // Create a TIA surface; we need it for rendering TIA images
myTIASurface = make_ptr<TIASurface>(myOSystem); myTIASurface = make_unique<TIASurface>(myOSystem);
return true; return true;
} }

View File

@ -89,7 +89,7 @@ OSystem::OSystem()
myBuildInfo = info.str(); myBuildInfo = info.str();
mySettings = MediaFactory::createSettings(*this); mySettings = MediaFactory::createSettings(*this);
myRandom = make_ptr<Random>(*this); myRandom = make_unique<Random>(*this);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -128,18 +128,18 @@ bool OSystem::create()
myEventHandler->initialize(); myEventHandler->initialize();
// Create a properties set for us to use and set it up // Create a properties set for us to use and set it up
myPropSet = make_ptr<PropertiesSet>(propertiesFile()); myPropSet = make_unique<PropertiesSet>(propertiesFile());
#ifdef CHEATCODE_SUPPORT #ifdef CHEATCODE_SUPPORT
myCheatManager = make_ptr<CheatManager>(*this); myCheatManager = make_unique<CheatManager>(*this);
myCheatManager->loadCheatDatabase(); myCheatManager->loadCheatDatabase();
#endif #endif
// Create menu and launcher GUI objects // Create menu and launcher GUI objects
myMenu = make_ptr<Menu>(*this); myMenu = make_unique<Menu>(*this);
myCommandMenu = make_ptr<CommandMenu>(*this); myCommandMenu = make_unique<CommandMenu>(*this);
myLauncher = make_ptr<Launcher>(*this); myLauncher = make_unique<Launcher>(*this);
myStateManager = make_ptr<StateManager>(*this); myStateManager = make_unique<StateManager>(*this);
// Create the sound object; the sound subsystem isn't actually // Create the sound object; the sound subsystem isn't actually
// opened until needed, so this is non-blocking (on those systems // opened until needed, so this is non-blocking (on those systems
@ -155,7 +155,7 @@ bool OSystem::create()
myRandom->initSeed(); myRandom->initSeed();
// Create PNG handler // Create PNG handler
myPNGLib = make_ptr<PNGLibrary>(*myFrameBuffer); myPNGLib = make_unique<PNGLibrary>(*myFrameBuffer);
return true; return true;
} }
@ -323,7 +323,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
if(myConsole) if(myConsole)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myDebugger = make_ptr<Debugger>(*this, *myConsole); myDebugger = make_unique<Debugger>(*this, *myConsole);
myDebugger->initialize(); myDebugger->initialize();
myConsole->attachDebugger(*myDebugger); myConsole->attachDebugger(*myDebugger);
#endif #endif
@ -536,7 +536,7 @@ OSystem::openConsole(const FilesystemNode& romfile, string& md5)
// Finally, create the cart with the correct properties // Finally, create the cart with the correct properties
if(cart) if(cart)
console = make_ptr<Console>(*this, cart, props); console = make_unique<Console>(*this, cart, props);
} }
return console; return console;

View File

@ -24,7 +24,7 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile) const string& eepromfile)
: Controller(jack, event, system, Controller::SaveKey) : Controller(jack, event, system, Controller::SaveKey)
{ {
myEEPROM = make_ptr<MT24LC256>(eepromfile, system); myEEPROM = make_unique<MT24LC256>(eepromfile, system);
myDigitalPinState[One] = myDigitalPinState[Two] = true; myDigitalPinState[One] = myDigitalPinState[Two] = true;
} }

View File

@ -33,7 +33,7 @@ Serializer::Serializer(const string& filename, bool readonly)
FilesystemNode node(filename); FilesystemNode node(filename);
if(node.isFile() && node.isReadable()) if(node.isFile() && node.isReadable())
{ {
unique_ptr<fstream> str = make_ptr<fstream>(filename, ios::in | ios::binary); unique_ptr<fstream> str = make_unique<fstream>(filename, ios::in | ios::binary);
if(str && str->is_open()) if(str && str->is_open())
{ {
myStream = std::move(str); myStream = std::move(str);
@ -54,7 +54,7 @@ Serializer::Serializer(const string& filename, bool readonly)
fstream temp(filename, ios::out | ios::app); fstream temp(filename, ios::out | ios::app);
temp.close(); temp.close();
unique_ptr<fstream> str = make_ptr<fstream>(filename, ios::in | ios::out | ios::binary); unique_ptr<fstream> str = make_unique<fstream>(filename, ios::in | ios::out | ios::binary);
if(str && str->is_open()) if(str && str->is_open())
{ {
myStream = std::move(str); myStream = std::move(str);
@ -68,7 +68,7 @@ Serializer::Serializer(const string& filename, bool readonly)
Serializer::Serializer() Serializer::Serializer()
: myStream(nullptr) : myStream(nullptr)
{ {
myStream = make_ptr<stringstream>(ios::in | ios::out | ios::binary); myStream = make_unique<stringstream>(ios::in | ios::out | ios::binary);
// For some reason, Windows and possibly OSX needs to store something in // For some reason, Windows and possibly OSX needs to store something in
// the stream before it is used for the first time // the stream before it is used for the first time

View File

@ -293,5 +293,5 @@ void ConfigPathDialog::createBrowser()
// Create file browser dialog // Create file browser dialog
if(!myBrowser || uInt32(myBrowser->getWidth()) != w || if(!myBrowser || uInt32(myBrowser->getWidth()) != w ||
uInt32(myBrowser->getHeight()) != h) uInt32(myBrowser->getHeight()) != h)
myBrowser = make_ptr<BrowserDialog>(this, myFont, w, h); myBrowser = make_unique<BrowserDialog>(this, myFont, w, h);
} }

View File

@ -31,11 +31,11 @@ void GameList::sortByName()
auto cmp = [](const Entry& a, const Entry& b) auto cmp = [](const Entry& a, const Entry& b)
{ {
auto it1 = a._name.begin(), it2 = b._name.begin(); auto it1 = a._name.cbegin(), it2 = b._name.cbegin();
// Account for ending ']' character in directory entries // Account for ending ']' character in directory entries
auto end1 = a._isdir ? a._name.end() - 1 : a._name.end(); auto end1 = a._isdir ? a._name.cend() - 1 : a._name.cend();
auto end2 = b._isdir ? b._name.end() - 1 : b._name.end(); auto end2 = b._isdir ? b._name.cend() - 1 : b._name.cend();
// Stop when either string's end has been reached // Stop when either string's end has been reached
while((it1 != end1) && (it2 != end2)) while((it1 != end1) && (it2 != end2))

View File

@ -435,7 +435,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
case kDBButtonPressed: case kDBButtonPressed:
if(!myJoyDialog) if(!myJoyDialog)
myJoyDialog = make_ptr<JoystickDialog> myJoyDialog = make_unique<JoystickDialog>
(this, instance().frameBuffer().font(), _w-60, _h-60); (this, instance().frameBuffer().font(), _w-60, _h-60);
myJoyDialog->show(); myJoyDialog->show();
break; break;

View File

@ -163,12 +163,12 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
mySelectedItem = 0; // Highlight 'Rom Listing' mySelectedItem = 0; // Highlight 'Rom Listing'
// Create an options dialog, similar to the in-game one // Create an options dialog, similar to the in-game one
myOptions = make_ptr<OptionsDialog>(osystem, parent, this, myOptions = make_unique<OptionsDialog>(osystem, parent, this,
int(w * 0.8), int(h * 0.8), true); int(w * 0.8), int(h * 0.8), true);
// Create a game list, which contains all the information about a ROM that // Create a game list, which contains all the information about a ROM that
// the launcher needs // the launcher needs
myGameList = make_ptr<GameList>(); myGameList = make_unique<GameList>();
addToFocusList(wid); addToFocusList(wid);
@ -177,14 +177,14 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
VarList::push_back(l, "Power-on options", "override"); VarList::push_back(l, "Power-on options", "override");
VarList::push_back(l, "Filter listing", "filter"); VarList::push_back(l, "Filter listing", "filter");
VarList::push_back(l, "Reload listing", "reload"); VarList::push_back(l, "Reload listing", "reload");
myMenu = make_ptr<ContextMenu>(this, osystem.frameBuffer().font(), l); myMenu = make_unique<ContextMenu>(this, osystem.frameBuffer().font(), l);
// Create global props dialog, which is used to temporarily overrride // Create global props dialog, which is used to temporarily overrride
// ROM properties // ROM properties
myGlobalProps = make_ptr<GlobalPropsDialog>(this, osystem.frameBuffer().font()); myGlobalProps = make_unique<GlobalPropsDialog>(this, osystem.frameBuffer().font());
// Create dialog whereby the files shown in the ROM listing can be customized // Create dialog whereby the files shown in the ROM listing can be customized
myFilters = make_ptr<LauncherFilterDialog>(this, osystem.frameBuffer().font()); myFilters = make_unique<LauncherFilterDialog>(this, osystem.frameBuffer().font());
// Figure out which filters are needed for the ROM listing // Figure out which filters are needed for the ROM listing
setListFilters(); setListFilters();
@ -229,7 +229,7 @@ void LauncherDialog::loadConfig()
msg.push_back(""); msg.push_back("");
msg.push_back("Click 'OK' to select a default ROM directory,"); msg.push_back("Click 'OK' to select a default ROM directory,");
msg.push_back("or 'Cancel' to browse the filesystem manually."); msg.push_back("or 'Cancel' to browse the filesystem manually.");
myFirstRunMsg = make_ptr<GUI::MessageBox> myFirstRunMsg = make_unique<GUI::MessageBox>
(this, instance().frameBuffer().font(), (this, instance().frameBuffer().font(),
msg, _w, _h, kFirstRunMsgChosenCmd); msg, _w, _h, kFirstRunMsgChosenCmd);
} }
@ -514,7 +514,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
case kFirstRunMsgChosenCmd: case kFirstRunMsgChosenCmd:
// Show a file browser, starting from the users' home directory // Show a file browser, starting from the users' home directory
if(!myRomDir) if(!myRomDir)
myRomDir = make_ptr<BrowserDialog>(this, instance().frameBuffer().font(), _w, _h); myRomDir = make_unique<BrowserDialog>(this, instance().frameBuffer().font(), _w, _h);
myRomDir->show("Select ROM directory", "~", myRomDir->show("Select ROM directory", "~",
BrowserDialog::Directories, kStartupRomDirChosenCmd); BrowserDialog::Directories, kStartupRomDirChosenCmd);

View File

@ -116,20 +116,20 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
addCancelWidget(b); addCancelWidget(b);
// Now create all the dialogs attached to each menu button // Now create all the dialogs attached to each menu button
myVideoDialog = make_ptr<VideoDialog>(osystem, parent, font, max_w, max_h, myIsGlobal); myVideoDialog = make_unique<VideoDialog>(osystem, parent, font, max_w, max_h, myIsGlobal);
myAudioDialog = make_ptr<AudioDialog>(osystem, parent, font); myAudioDialog = make_unique<AudioDialog>(osystem, parent, font);
myInputDialog = make_ptr<InputDialog>(osystem, parent, font, max_w, max_h); myInputDialog = make_unique<InputDialog>(osystem, parent, font, max_w, max_h);
myUIDialog = make_ptr<UIDialog>(osystem, parent, font); myUIDialog = make_unique<UIDialog>(osystem, parent, font);
mySnapshotDialog = make_ptr<SnapshotDialog>(osystem, parent, font); mySnapshotDialog = make_unique<SnapshotDialog>(osystem, parent, font);
myConfigPathDialog = make_ptr<ConfigPathDialog>(osystem, parent, font, boss); myConfigPathDialog = make_unique<ConfigPathDialog>(osystem, parent, font, boss);
myRomAuditDialog = make_ptr<RomAuditDialog>(osystem, parent, font, max_w, max_h); myRomAuditDialog = make_unique<RomAuditDialog>(osystem, parent, font, max_w, max_h);
myGameInfoDialog = make_ptr<GameInfoDialog>(osystem, parent, font, this); myGameInfoDialog = make_unique<GameInfoDialog>(osystem, parent, font, this);
#ifdef CHEATCODE_SUPPORT #ifdef CHEATCODE_SUPPORT
myCheatCodeDialog = make_ptr<CheatCodeDialog>(osystem, parent, font); myCheatCodeDialog = make_unique<CheatCodeDialog>(osystem, parent, font);
#endif #endif
myLoggerDialog = make_ptr<LoggerDialog>(osystem, parent, font, max_w, max_h); myLoggerDialog = make_unique<LoggerDialog>(osystem, parent, font, max_w, max_h);
myHelpDialog = make_ptr<HelpDialog>(osystem, parent, font); myHelpDialog = make_unique<HelpDialog>(osystem, parent, font);
myAboutDialog = make_ptr<AboutDialog>(osystem, parent, font); myAboutDialog = make_unique<AboutDialog>(osystem, parent, font);
addToFocusList(wid); addToFocusList(wid);
@ -218,7 +218,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
uInt32 w = 0, h = 0; uInt32 w = 0, h = 0;
bool uselargefont = getResizableBounds(w, h); bool uselargefont = getResizableBounds(w, h);
myLoggerDialog = make_ptr<LoggerDialog>(instance(), parent(), myLoggerDialog = make_unique<LoggerDialog>(instance(), parent(),
instance().frameBuffer().font(), w, h, uselargefont); instance().frameBuffer().font(), w, h, uselargefont);
} }
myLoggerDialog->open(); myLoggerDialog->open();

View File

@ -59,7 +59,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
myTextY = (_h - _font.getFontHeight()) / 2; myTextY = (_h - _font.getFontHeight()) / 2;
myArrowsY = (_h - 8) / 2; myArrowsY = (_h - 8) / 2;
myMenu = make_ptr<ContextMenu>(this, font, list, cmd); myMenu = make_unique<ContextMenu>(this, font, list, cmd);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -88,7 +88,7 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
addBGroupToFocusList(wid); addBGroupToFocusList(wid);
// Create file browser dialog // Create file browser dialog
myBrowser = make_ptr<BrowserDialog>(this, font, myMaxWidth, myMaxHeight); myBrowser = make_unique<BrowserDialog>(this, font, myMaxWidth, myMaxHeight);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -179,7 +179,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
msg.push_back(""); msg.push_back("");
msg.push_back("If you're sure you want to proceed with the"); msg.push_back("If you're sure you want to proceed with the");
msg.push_back("audit, click 'OK', otherwise click 'Cancel'."); msg.push_back("audit, click 'OK', otherwise click 'Cancel'.");
myConfirmMsg = make_ptr<GUI::MessageBox> myConfirmMsg = make_unique<GUI::MessageBox>
(this, instance().frameBuffer().font(), msg, (this, instance().frameBuffer().font(), msg,
myMaxWidth, myMaxHeight, kConfirmAuditCmd); myMaxWidth, myMaxHeight, kConfirmAuditCmd);
} }

View File

@ -218,5 +218,5 @@ void SnapshotDialog::createBrowser()
// Create file browser dialog // Create file browser dialog
if(!myBrowser || uInt32(myBrowser->getWidth()) != w || if(!myBrowser || uInt32(myBrowser->getWidth()) != w ||
uInt32(myBrowser->getHeight()) != h) uInt32(myBrowser->getHeight()) != h)
myBrowser = make_ptr<BrowserDialog>(this, myFont, w, h); myBrowser = make_unique<BrowserDialog>(this, myFont, w, h);
} }

View File

@ -6,7 +6,6 @@
#include <cstdlib> #include <cstdlib>
#include <list> #include <list>
#include "../common/UniquePtr.hxx"
using namespace std; using namespace std;
using uInt8 = unsigned char; using uInt8 = unsigned char;
@ -50,18 +49,18 @@ int main(int ac, char* av[])
} }
if(ac > 3) if(ac > 3)
offset = atoi(av[3]); offset = atoi(av[3]);
ifstream in(av[1], ios_base::binary); ifstream in(av[1], ios_base::binary);
in.seekg(0, ios::end); in.seekg(0, ios::end);
int i_size = (int) in.tellg(); int i_size = (int) in.tellg();
in.seekg(0, ios::beg); in.seekg(0, ios::beg);
unique_ptr<uInt8[]> image = make_ptr<uInt8[]>(i_size); unique_ptr<uInt8[]> image = make_unique<uInt8[]>(i_size);
in.read((char*)(image.get()), i_size); in.read((char*)(image.get()), i_size);
in.close(); in.close();
int s_size = 0; int s_size = 0;
unique_ptr<uInt8[]> sig = make_ptr<uInt8[]>(strlen(av[2])/2); unique_ptr<uInt8[]> sig = make_unique<uInt8[]>(strlen(av[2])/2);
istringstream buf(av[2]); istringstream buf(av[2]);
uInt32 c; uInt32 c;

View File

@ -8,8 +8,6 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
#include "../common/UniquePtr.hxx"
using namespace std; using namespace std;
using uInt8 = unsigned char; using uInt8 = unsigned char;
@ -37,7 +35,7 @@ int main(int ac, char* av[])
int len = (int)in.tellg(); int len = (int)in.tellg();
in.seekg(0, ios::beg); in.seekg(0, ios::beg);
unique_ptr<uInt8[]> data = make_ptr<uInt8[]>(len); unique_ptr<uInt8[]> data = make_unique<uInt8[]>(len);
in.read((char*)data.get(), len); in.read((char*)data.get(), len);
in.close(); in.close();