diff --git a/src/emucore/elf/BusTransactionQueue.cxx b/src/emucore/elf/BusTransactionQueue.cxx index d283053f2..f6a3e53b5 100644 --- a/src/emucore/elf/BusTransactionQueue.cxx +++ b/src/emucore/elf/BusTransactionQueue.cxx @@ -47,9 +47,10 @@ void BusTransactionQueue::Transaction::setBusState(bool& bs_drive, uInt8& bs_val } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BusTransactionQueue::BusTransactionQueue(size_t capacity) : myQueueCapacity(capacity) +BusTransactionQueue::BusTransactionQueue(size_t capacity) + : myQueueCapacity{capacity}, + myQueue{make_unique(myQueueCapacity)} { - myQueue = make_unique(myQueueCapacity); reset(); } diff --git a/src/emucore/elf/ElfLinker.cxx b/src/emucore/elf/ElfLinker.cxx index ff108be42..c100b9dee 100644 --- a/src/emucore/elf/ElfLinker.cxx +++ b/src/emucore/elf/ElfLinker.cxx @@ -49,9 +49,11 @@ namespace { } // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ElfLinker::ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase, const ElfFile& elf) - : myTextBase(textBase), myDataBase(dataBase), myRodataBase(rodataBase), myElf(elf) -{} +ElfLinker::ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase, + const ElfFile& elf) + : myTextBase{textBase}, myDataBase{dataBase}, myRodataBase{rodataBase}, myElf{elf} +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ElfLinker& ElfLinker::setUndefinedSymbolDefault(uInt32 defaultValue) @@ -162,13 +164,15 @@ ElfLinker::RelocatedSymbol ElfLinker::findRelocatedSymbol(string_view name) cons } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const vector>& ElfLinker::getRelocatedSections() const +const vector>& +ElfLinker::getRelocatedSections() const { return myRelocatedSections; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const vector>& ElfLinker::getRelocatedSymbols() const +const vector>& +ElfLinker::getRelocatedSymbols() const { return myRelocatedSymbols; } diff --git a/src/emucore/elf/VcsLib.cxx b/src/emucore/elf/VcsLib.cxx index 2d903b049..7c3171da4 100644 --- a/src/emucore/elf/VcsLib.cxx +++ b/src/emucore/elf/VcsLib.cxx @@ -106,7 +106,8 @@ namespace { } // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -VcsLib::VcsLib(BusTransactionQueue& transactionQueue) : myTransactionQueue(transactionQueue) +VcsLib::VcsLib(BusTransactionQueue& transactionQueue) + : myTransactionQueue{transactionQueue} { } @@ -366,7 +367,7 @@ CortexM0::err_t VcsLib::fetch16(uInt32 address, uInt16& value, uInt8& op, Cortex } case ADDR_RANDINT: - cortex.setRegister(0, rand()); // FIXME: use C++11 random library instead + cortex.setRegister(0, myRand.next()); return returnFromStub(value, op); case ADDR_VCS_TXS2: diff --git a/src/emucore/elf/VcsLib.hxx b/src/emucore/elf/VcsLib.hxx index 987fdd4a3..f057818ca 100644 --- a/src/emucore/elf/VcsLib.hxx +++ b/src/emucore/elf/VcsLib.hxx @@ -19,6 +19,7 @@ #define VCSLIB_H #include "bspf.hxx" +#include "Random.hxx" #include "CortexM0.hxx" #include "BusTransactionQueue.hxx" @@ -71,6 +72,8 @@ class VcsLib: public CortexM0::BusTransactionDelegate { uInt16 myCurrentAddress{0}; uInt8 myCurrentValue{0}; + Random myRand; + private: VcsLib(const VcsLib&) = delete; VcsLib(VcsLib&&) = delete;