Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ case $host in
;;
esac

dnl **** Check for c++11 ****

dnl Prefer C++20, fall back to C++17, then 14
AC_LANG_PUSH([C++])
CXX="$CXX -Werror -std=c++11"
AC_MSG_CHECKING([whether CXX supports -std=c++11])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CXXFLAGS="$CXXFLAGS -std=c++11"], [AC_MSG_RESULT([no])])
CXX="$save_CXX"
for flag in -std=c++20 -std=c++17 -std=c++14; do
AC_MSG_CHECKING([whether $CXX supports $flag])
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flag"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes]); CXX_STD="$flag"; break],
[AC_MSG_RESULT([no]); CXXFLAGS="$save_CXXFLAGS"])
done
CXXFLAGS="$CXXFLAGS $CXX_STD"
AC_LANG_POP([C++])

AM_CONDITIONAL([BUILD32LIB], [test "x$with_i386" = "xyes" || test "x$enable_i386_lib" = "xyes"])
Expand Down
12 changes: 6 additions & 6 deletions src/external/qhexview/src/qhexview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ QHexView::QHexView(QWidget* parent)
p.setBrush(QPalette::Window, p.base());

connect(this->verticalScrollBar(), &QScrollBar::valueChanged, this,
[=](int) { this->viewport()->update(); });
[=, this](int) { this->viewport()->update(); });

m_hexmetadata = new QHexMetadata(&m_options, this);
connect(m_hexmetadata, &QHexMetadata::changed, this,
[=]() { this->viewport()->update(); });
[=, this]() { this->viewport()->update(); });

m_hexcursor = new QHexCursor(&m_options, this);
this->setDocument(
QHexDocument::fromMemory<QMemoryBuffer>(QByteArray(), this));
this->checkState();

connect(m_hexcursor, &QHexCursor::positionChanged, this, [=]() {
connect(m_hexcursor, &QHexCursor::positionChanged, this, [=, this]() {
m_writing = false;
this->ensureVisible();
Q_EMIT positionChanged();
});

connect(m_hexcursor, &QHexCursor::modeChanged, this, [=]() {
connect(m_hexcursor, &QHexCursor::modeChanged, this, [=, this]() {
m_writing = false;
this->viewport()->update();
Q_EMIT modeChanged();
Expand Down Expand Up @@ -149,7 +149,7 @@ void QHexView::setDocument(QHexDocument* doc) {

m_hexdocument = doc;

connect(m_hexdocument, &QHexDocument::reset, this, [=]() {
connect(m_hexdocument, &QHexDocument::reset, this, [=, this]() {
m_writing = false;
m_hexcursor->move(0);
this->checkAndUpdate(true);
Expand All @@ -159,7 +159,7 @@ void QHexView::setDocument(QHexDocument* doc) {
&QHexView::dataChanged);

connect(m_hexdocument, &QHexDocument::changed, this,
[=]() { this->checkAndUpdate(true); });
[=, this]() { this->checkAndUpdate(true); });

this->checkAndUpdate(true);
}
Expand Down
4 changes: 2 additions & 2 deletions src/library/Profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct ScopeInfo

int nodeId;
int parentNodeId;
int depth;
unsigned int depth;
};

struct Database
Expand All @@ -61,7 +61,7 @@ struct Database
int nextNodeId = 0;
int maxNodeId = 0;
int currentNodeId = -1;
int currentDepth = 0;
unsigned int currentDepth = 0;
bool dirty = true;

static Database& get();
Expand Down
1 change: 1 addition & 0 deletions src/library/hookpatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ static int instruction_length(const unsigned char *func, instr_info *instr)
instr->operand_size_prefix = false;
instr->quad_prefix = false;
instr->multibyte_opcode = 0;
instr->modRM = 0;

int operandSizeDouble = 4; // operand size for instructions that depend only on 16-bit prefix, and cannot be promoted by REX.W 64-bit
int operandSize = 4; // operand size for instructions that depend on both operand-size prefixes
Expand Down
18 changes: 9 additions & 9 deletions src/library/inputs/udevwrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,8 @@ Device::Device() : parent(), valid() {

for (int num = 0; num < Global::shared_config.nb_controllers; ++num) {
int devNum = 2 + num;
char numStr[2], devStr[2];
std::snprintf(numStr, sizeof(numStr), "%d", num);
std::snprintf(devStr, sizeof(devStr), "%d", devNum);
std::string numStr = std::to_string(num);
std::string devStr = std::to_string(devNum);

Device &controller = hub.newChild(String::concat("1-", devStr));
controller.setUsb(1, devNum);
Expand Down Expand Up @@ -830,21 +829,22 @@ Device &Device::newBus(String &&name) {
}

void Device::setDev(dev_t devNum, String &&devnode) {
char majorStr[4], minorStr[4];
snprintf(majorStr, sizeof(majorStr), "%u", major(devNum));
std::string majorStr = std::to_string(major(devNum));
std::string minorStr = std::to_string(minor(devNum));
propertiesMap.emplace("MAJOR", String::concat(majorStr));
snprintf(minorStr, sizeof(minorStr), "%u", minor(devNum));
propertiesMap.emplace("MINOR", String::concat(minorStr));
propertiesMap.emplace("DEVNAME", std::move(devnode));
dev = devNum;
sysattrsMap.emplace("dev", String::concat(majorStr, ':', minorStr));
}

void Device::setUsb(unsigned busNum, unsigned devNum) {
char busStr[4], devStr[4];
snprintf(busStr, sizeof(busStr), "%03u", busNum);
std::ostringstream busStream, devStream;
busStream << std::setw(3) << std::setfill('0') << busNum;
devStream << std::setw(3) << std::setfill('0') << devNum;
std::string busStr = busStream.str();
std::string devStr = devStream.str();
propertiesMap.emplace("BUSNUM", String::concat(busStr));
snprintf(devStr, sizeof(devStr), "%03u", devNum);
propertiesMap.emplace("DEVNUM", String::concat(devStr));
propertiesMap.emplace("DEVTYPE", "usb_device");
setDriver("usb");
Expand Down
3 changes: 1 addition & 2 deletions src/library/renderhud/FileDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ void FileDebug::draw(uint64_t framecount, bool* p_open = nullptr)

/* Build the whole files as PlotShaded data */
float xs[2], ys1[2], ys2[2];
char name[32];
for (int fd = 0; fd < FD_LIMIT; fd++) {
for (fd_history_t fdh : fd_history[fd]) {
xs[0] = fdh.first_frame;
Expand All @@ -131,7 +130,7 @@ void FileDebug::draw(uint64_t framecount, bool* p_open = nullptr)
(mouse.y - hovered_fd) < (BAR_HEIGHT / 2) &&
(mouse.y - hovered_fd) > (-BAR_HEIGHT / 2)) {

int frame = (int) std::roundf(mouse.x);
uint64_t frame = (uint64_t) std::roundf(mouse.x);

for (fd_history_t fdh : fd_history[hovered_fd]) {
if ((frame >= fdh.first_frame) && (frame <= fdh.last_frame)) {
Expand Down
5 changes: 2 additions & 3 deletions src/library/renderhud/ProfilerDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ void ProfilerDebug::draw(uint64_t framecount, bool* p_open = nullptr)
}

static uint64_t old_framecount = 0;
static bool will_update;
static uint64_t older_framecount = 0;

currentTime = Profiler::currentTimeWithoutPause();
Expand Down Expand Up @@ -166,7 +165,7 @@ void ProfilerDebug::draw(uint64_t framecount, bool* p_open = nullptr)

/* Convert frames to length here */
const std::vector<TimeHolder>& frameTimings = Profiler::getFrameTimings();
if (frameTimings.size() < timeWindowFrames)
if (frameTimings.size() < static_cast<unsigned int>(timeWindowFrames))
timeWindowFrames = frameTimings.size();

if (timeWindowFrames > 0) {
Expand Down Expand Up @@ -224,7 +223,7 @@ void ProfilerDebug::draw(uint64_t framecount, bool* p_open = nullptr)

const std::vector<TimeHolder>& frameTimings = Profiler::getFrameTimings();
if (frameTimings.size() > 0) {
for (int f = 0; f < frameTimings.size() - 1; f++) {
for (long unsigned int f = 0; f < frameTimings.size() - 1; f++) {
/* Don't print frames that won't show up on screen */
if (frameTimings[f] < minTime)
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/library/renderhud/UnityDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void UnityDebug::update(uint64_t framecount)

/* Build the array that will be used to plot */
preloadAll.clear();
int size = 400;
size_t size = 400;
if (preloadPending.size() < size)
size = preloadPending.size();

Expand Down
2 changes: 1 addition & 1 deletion src/program/Signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ uint8_t* SigSearch::FindCommon(uint8_t* input, size_t inputLen, const Signature
const uint8_t *memPtr = ptr+1;
bool found = true;

for (int i = 0; (i < sigLen-2) && (memPtr < end); ++mskPtr, ++patPtr, ++memPtr, i++) {
for (size_t i = 0; (i < sigLen-2) && (memPtr < end); ++mskPtr, ++patPtr, ++memPtr, i++) {
if (!*mskPtr)
continue;

Expand Down
12 changes: 6 additions & 6 deletions src/program/ui/InputEditorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void InputEditorView::fillMenu(QMenu* frameMenu)

eventAct = menu->addAction(tr("Edit frame events"), this, &InputEditorView::editEvents);

insertAct = menu->addAction(tr("Insert"), this, &InputEditorView::insertInput, QKeySequence(Qt::CTRL + Qt::Key_Plus));
insertAct = menu->addAction(tr("Insert"), this, &InputEditorView::insertInput, QKeySequence(int(Qt::CTRL) | int(Qt::Key_Plus)));

/* Shortcuts for context menus are special, they won't work by default
* because the menu is hidden, so actions need to be added to the View as
Expand All @@ -144,25 +144,25 @@ void InputEditorView::fillMenu(QMenu* frameMenu)

insertsAct = menu->addAction(tr("Insert # frames"), this, &InputEditorView::insertInputs);

markAct = menu->addAction(tr("Add marker"), this, &InputEditorView::addMarker, QKeySequence(Qt::CTRL + Qt::Key_M));
markAct = menu->addAction(tr("Add marker"), this, &InputEditorView::addMarker, QKeySequence("Ctrl+M"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
markAct->setShortcutVisibleInContextMenu(true);
#endif
this->addAction(markAct);

unmarkAct = menu->addAction(tr("Remove marker"), this, &InputEditorView::removeMarker, QKeySequence(Qt::CTRL + Qt::Key_R));
unmarkAct = menu->addAction(tr("Remove marker"), this, &InputEditorView::removeMarker, QKeySequence("Ctrl+R"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
unmarkAct->setShortcutVisibleInContextMenu(true);
#endif
this->addAction(unmarkAct);

duplicateAct = menu->addAction(tr("Duplicate"), this, &InputEditorView::duplicateInput, QKeySequence(Qt::CTRL + Qt::Key_D));
duplicateAct = menu->addAction(tr("Duplicate"), this, &InputEditorView::duplicateInput, QKeySequence("Ctrl+D"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
duplicateAct->setShortcutVisibleInContextMenu(true);
#endif
this->addAction(duplicateAct);

deleteAct = menu->addAction(tr("Delete"), this, &InputEditorView::deleteInput, QKeySequence(Qt::CTRL + Qt::Key_Minus));
deleteAct = menu->addAction(tr("Delete"), this, &InputEditorView::deleteInput, QKeySequence(int(Qt::CTRL) | int(Qt::Key_Minus)));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
deleteAct->setShortcutVisibleInContextMenu(true);
#endif
Expand Down Expand Up @@ -194,7 +194,7 @@ void InputEditorView::fillMenu(QMenu* frameMenu)
#endif
this->addAction(pasteAct);

pasteInsertAct = menu->addAction(tr("Paste Insert"), this, &InputEditorView::pasteInsertInputs, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
pasteInsertAct = menu->addAction(tr("Paste Insert"), this, &InputEditorView::pasteInsertInputs, QKeySequence("Ctrl+Shift+V"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
pasteInsertAct->setShortcutVisibleInContextMenu(true);
#endif
Expand Down
12 changes: 6 additions & 6 deletions src/program/ui/InputEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ InputEditorWindow::InputEditorWindow(Context* c, MovieFile *movie, QWidget *pare
QMenu* panelMenu = menuBar()->addMenu(tr("Panels"));

markerPanelAct = panelMenu->addAction(tr("Markers"), this,
[=](bool checked){context->config.editor_panel_marker = checked; markerBox->setVisible(checked);});
[=, this](bool checked){context->config.editor_panel_marker = checked; markerBox->setVisible(checked);});

markerPanelAct->setCheckable(true);

Expand All @@ -85,26 +85,26 @@ InputEditorWindow::InputEditorWindow(Context* c, MovieFile *movie, QWidget *pare
QMenu* optionMenu = menuBar()->addMenu(tr("Options"));

scrollingAct = optionMenu->addAction(tr("Disable autoscrolling"), this,
[=](bool checked){context->config.editor_autoscroll = !checked;});
[=, this](bool checked){context->config.editor_autoscroll = !checked;});
scrollingAct->setCheckable(true);

rewindAct = optionMenu->addAction(tr("Rewind seeks to current frame"), this,
[=](bool checked){context->config.editor_rewind_seek = checked;});
[=, this](bool checked){context->config.editor_rewind_seek = checked;});

rewindAct->setCheckable(true);

fastforwardAct = optionMenu->addAction(tr("Disable fastforward during rewind"), this,
[=](bool checked){context->config.editor_rewind_fastforward = !checked;});
[=, this](bool checked){context->config.editor_rewind_fastforward = !checked;});

fastforwardAct->setCheckable(true);

markerPauseAct = optionMenu->addAction(tr("Autopause on markers"), this,
[=](bool checked){context->config.editor_marker_pause = checked;});
[=, this](bool checked){context->config.editor_marker_pause = checked;});

markerPauseAct->setCheckable(true);

moveMarkerAct = optionMenu->addAction(tr("Move markers on frame addition or removal"), this,
[=](bool checked){context->config.editor_move_marker = checked;});
[=, this](bool checked){context->config.editor_move_marker = checked;});

moveMarkerAct->setCheckable(true);

Expand Down
14 changes: 7 additions & 7 deletions src/program/ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ do {\
}\
} while(false)

#define LAMBDABOOLSLOT(parameter) [=](bool checked) {\
#define LAMBDABOOLSLOT(parameter) [=, this](bool checked) {\
parameter = checked;\
context->config.sc_modified = true;\
}\

#define LAMBDACHECKBOXSLOT(group, parameter) [=](bool) {\
#define LAMBDACHECKBOXSLOT(group, parameter) [=, this](bool) {\
setMaskFromCheckboxes(group, parameter);\
context->config.sc_modified = true;\
}\

#define LAMBDARADIOSLOT(group, parameter) [=]() {\
#define LAMBDARADIOSLOT(group, parameter) [=, this]() {\
setListFromRadio(group, parameter);\
context->config.sc_modified = true;\
}\
Expand Down Expand Up @@ -245,15 +245,15 @@ MainWindow::MainWindow(Context* c) : QMainWindow(), context(c)
fpsNumField = new QSpinBox();
fpsNumField->setMaximum(std::numeric_limits<int>::max());
fpsNumField->setMinimum(1);
connect(fpsNumField, QOverload<int>::of(&QSpinBox::valueChanged),[=](int i){
connect(fpsNumField, QOverload<int>::of(&QSpinBox::valueChanged),[=, this](int i){
context->current_framerate_num = i;
gameLoop->movie.inputs->variable_framerate = true;
});

fpsDenField = new QSpinBox();
fpsDenField->setMaximum(std::numeric_limits<int>::max());
fpsDenField->setMinimum(1);
connect(fpsDenField, QOverload<int>::of(&QSpinBox::valueChanged),[=](int i){
connect(fpsDenField, QOverload<int>::of(&QSpinBox::valueChanged),[=, this](int i){
context->current_framerate_den = i;
gameLoop->movie.inputs->variable_framerate = true;
});
Expand Down Expand Up @@ -285,7 +285,7 @@ MainWindow::MainWindow(Context* c) : QMainWindow(), context(c)
connect(realTimeNsec, QOverload<int>::of(&QSpinBox::valueChanged), this, &MainWindow::slotRealTimeFormat);

QPushButton* realTimeChange = new QPushButton("Set");
connect(realTimeChange, &QAbstractButton::clicked, [=](){
connect(realTimeChange, &QAbstractButton::clicked, [=, this](){
context->new_realtime_sec = realTimeSec->value();
context->new_realtime_nsec = realTimeNsec->value();
});
Expand Down Expand Up @@ -646,7 +646,7 @@ void MainWindow::createMenus()
exportMovieAction->setEnabled(false);
settingsMovieAction = movieMenu->addAction(tr("Movie Settings..."), movieSettingsWindow, &MovieSettingsWindow::exec);
settingsMovieAction->setEnabled(false);
action = movieMenu->addAction(tr("Don't enforce movie settings"), this, [=](bool checked){gameLoop->movie.header->skipLoadSettings = checked;});
action = movieMenu->addAction(tr("Don't enforce movie settings"), this, [=, this](bool checked){gameLoop->movie.header->skipLoadSettings = checked;});
action->setCheckable(true);
action->setToolTip("When checked, settings stored inside the movie metadata won't be enforced (e.g. initial time, mouse/controller support, framerate...). You can then save your movie with the new settings.");

Expand Down